github.com/hellofresh/janus@v0.0.0-20230925145208-ce8de8183c67/features/HotReload.feature (about) 1 Feature: Apply proxy changes to all instances, when changing via API on single instance. 2 3 Background: 4 Given request JWT token is valid admin token 5 6 Scenario: Proxy registered on the primary instance is available on the secondary instance 7 Given request JSON payload: 8 """ 9 { 10 "name":"example", 11 "active":true, 12 "proxy":{ 13 "preserve_host":false, 14 "listen_path":"/example/*", 15 "upstreams":{ 16 "balancing":"roundrobin", 17 "targets":[ 18 { 19 "target":"http://localhost:9089/hello-world" 20 } 21 ] 22 }, 23 "strip_path":false, 24 "append_path":false, 25 "methods":[ 26 "GET" 27 ] 28 }, 29 "health_check":{ 30 "url":"https://example.com/status" 31 } 32 } 33 """ 34 When I request "/apis" API path with "POST" method 35 Then I should receive 201 response code 36 And header "Location" should be "/apis/example" 37 38 When I wait for a while 39 And I request "/example" path with "GET" method 40 Then I should receive 200 response code 41 And response JSON body has "hello" path with value 'world' 42 43 When I wait for a while 44 And I request "/example" secondary path with "GET" method 45 Then I should receive 200 response code 46 And response JSON body has "hello" path with value 'world' 47 48 When I request "/example" path with "GET" method 49 Then I should receive 200 response code 50 And response JSON body has "hello" path with value 'world' 51 52 When I request "/example" secondary path with "GET" method 53 Then I should receive 200 response code 54 And response JSON body has "hello" path with value 'world' 55 56 Scenario: Proxy registered on the secondary instance is available on the primary instance 57 Given request JSON payload: 58 """ 59 { 60 "name":"example", 61 "active":true, 62 "proxy":{ 63 "preserve_host":false, 64 "listen_path":"/example/*", 65 "upstreams":{ 66 "balancing":"roundrobin", 67 "targets":[ 68 { 69 "target":"http://localhost:9089/hello-world" 70 } 71 ] 72 }, 73 "strip_path":false, 74 "append_path":false, 75 "methods":[ 76 "GET" 77 ] 78 }, 79 "health_check":{ 80 "url":"https://example.com/status" 81 } 82 } 83 """ 84 When I request "/apis" secondary API path with "POST" method 85 Then I should receive 201 response code 86 And header "Location" should be "/apis/example" 87 88 When I wait for a while 89 And I request "/example" secondary path with "GET" method 90 Then I should receive 200 response code 91 And response JSON body has "hello" path with value 'world' 92 93 When I wait for a while 94 And I request "/example" path with "GET" method 95 Then I should receive 200 response code 96 And response JSON body has "hello" path with value 'world' 97 98 When I request "/example" secondary path with "GET" method 99 Then I should receive 200 response code 100 And response JSON body has "hello" path with value 'world' 101 102 When I request "/example" path with "GET" method 103 Then I should receive 200 response code 104 And response JSON body has "hello" path with value 'world' 105 106 Scenario: Proxy removed on the primary instance is not available on the secondary instance 107 Given request JSON payload: 108 """ 109 { 110 "name":"example", 111 "active":true, 112 "proxy":{ 113 "preserve_host":false, 114 "listen_path":"/example/*", 115 "upstreams":{ 116 "balancing":"roundrobin", 117 "targets":[ 118 { 119 "target":"http://localhost:9089/hello-world" 120 } 121 ] 122 }, 123 "strip_path":false, 124 "append_path":false, 125 "methods":[ 126 "GET" 127 ] 128 }, 129 "health_check":{ 130 "url":"https://example.com/status" 131 } 132 } 133 """ 134 When I request "/apis" API path with "POST" method 135 Then I should receive 201 response code 136 And header "Location" should be "/apis/example" 137 138 When I wait for a while 139 And I request "/example" path with "GET" method 140 Then I should receive 200 response code 141 And response JSON body has "hello" path with value 'world' 142 143 When I wait for a while 144 And I request "/example" secondary path with "GET" method 145 Then I should receive 200 response code 146 And response JSON body has "hello" path with value 'world' 147 148 When I request "/apis/example" API path with "DELETE" method 149 Then I should receive 204 response code 150 151 When I wait for a while 152 And I request "/example" path with "GET" method 153 Then I should receive 404 response code 154 And response JSON body has "error" path with value 'no API found with those values' 155 156 When I wait for a while 157 And I request "/example" secondary path with "GET" method 158 Then I should receive 404 response code 159 And response JSON body has "error" path with value 'no API found with those values' 160 161 When I request "/example" path with "GET" method 162 Then I should receive 404 response code 163 And response JSON body has "error" path with value 'no API found with those values' 164 165 When I request "/example" secondary path with "GET" method 166 Then I should receive 404 response code 167 And response JSON body has "error" path with value 'no API found with those values' 168 169 Scenario: Proxy removed on the secondary instance is not available on the primary instance 170 Given request JSON payload: 171 """ 172 { 173 "name":"example", 174 "active":true, 175 "proxy":{ 176 "preserve_host":false, 177 "listen_path":"/example/*", 178 "upstreams":{ 179 "balancing":"roundrobin", 180 "targets":[ 181 { 182 "target":"http://localhost:9089/hello-world" 183 } 184 ] 185 }, 186 "strip_path":false, 187 "append_path":false, 188 "methods":[ 189 "GET" 190 ] 191 }, 192 "health_check":{ 193 "url":"https://example.com/status" 194 } 195 } 196 """ 197 When I request "/apis" secondary API path with "POST" method 198 Then I should receive 201 response code 199 And header "Location" should be "/apis/example" 200 201 When I wait for a while 202 And I request "/example" secondary path with "GET" method 203 Then I should receive 200 response code 204 And response JSON body has "hello" path with value 'world' 205 206 When I wait for a while 207 And I request "/example" path with "GET" method 208 Then I should receive 200 response code 209 And response JSON body has "hello" path with value 'world' 210 211 When I request "/apis/example" secondary API path with "DELETE" method 212 Then I should receive 204 response code 213 214 When I wait for a while 215 And I request "/example" secondary path with "GET" method 216 Then I should receive 404 response code 217 And response JSON body has "error" path with value 'no API found with those values' 218 219 When I wait for a while 220 And I request "/example" path with "GET" method 221 Then I should receive 404 response code 222 And response JSON body has "error" path with value 'no API found with those values' 223 224 When I request "/example" secondary path with "GET" method 225 Then I should receive 404 response code 226 And response JSON body has "error" path with value 'no API found with those values' 227 228 When I request "/example" path with "GET" method 229 Then I should receive 404 response code 230 And response JSON body has "error" path with value 'no API found with those values'