TestConcurrentUpdateAndRead makes sure orchestrator can receive updates and return origin proxy concurrently
(t *testing.T)
| 247 | |
| 248 | // TestConcurrentUpdateAndRead makes sure orchestrator can receive updates and return origin proxy concurrently |
| 249 | func TestConcurrentUpdateAndRead(t *testing.T) { |
| 250 | const ( |
| 251 | concurrentRequests = 200 |
| 252 | hostname = "public.tunnels.org" |
| 253 | expectedHost = "internal.tunnels.svc.cluster.local" |
| 254 | tcpBody = "testProxyTCP" |
| 255 | ) |
| 256 | |
| 257 | httpOrigin := httptest.NewServer(&validateHostHandler{ |
| 258 | expectedHost: expectedHost, |
| 259 | body: t.Name(), |
| 260 | }) |
| 261 | defer httpOrigin.Close() |
| 262 | |
| 263 | tcpOrigin, err := net.Listen("tcp", "127.0.0.1:0") |
| 264 | require.NoError(t, err) |
| 265 | defer tcpOrigin.Close() |
| 266 | |
| 267 | originDialer := ingress.NewOriginDialer(ingress.OriginConfig{ |
| 268 | DefaultDialer: testDefaultDialer, |
| 269 | TCPWriteTimeout: 1 * time.Second, |
| 270 | }, &testLogger) |
| 271 | |
| 272 | var ( |
| 273 | configJSONV1 = []byte(fmt.Sprintf(` |
| 274 | { |
| 275 | "originRequest": { |
| 276 | "connectTimeout": 90, |
| 277 | "noHappyEyeballs": true |
| 278 | }, |
| 279 | "ingress": [ |
| 280 | { |
| 281 | "hostname": "%s", |
| 282 | "service": "%s", |
| 283 | "originRequest": { |
| 284 | "httpHostHeader": "%s", |
| 285 | "connectTimeout": 10 |
| 286 | } |
| 287 | }, |
| 288 | { |
| 289 | "service": "http_status:404" |
| 290 | } |
| 291 | ], |
| 292 | "warp-routing": { |
| 293 | } |
| 294 | } |
| 295 | `, hostname, httpOrigin.URL, expectedHost)) |
| 296 | configJSONV2 = []byte(` |
| 297 | { |
| 298 | "ingress": [ |
| 299 | { |
| 300 | "service": "http_status:204" |
| 301 | } |
| 302 | ], |
| 303 | "warp-routing": { |
| 304 | } |
| 305 | } |
| 306 | `) |
nothing calls this directly
no test coverage detected