(t *testing.T, listenPort, serverAddr string)
| 356 | } |
| 357 | |
| 358 | func startNginx(t *testing.T, listenPort, serverAddr string) { |
| 359 | cfg := `events {} |
| 360 | http { |
| 361 | server { |
| 362 | listen ` + listenPort + `; |
| 363 | server_name _; |
| 364 | location / { |
| 365 | proxy_pass http://` + serverAddr + `; |
| 366 | proxy_http_version 1.1; |
| 367 | proxy_set_header Upgrade $http_upgrade; |
| 368 | proxy_set_header Connection "upgrade"; |
| 369 | proxy_set_header Host $host; |
| 370 | proxy_set_header X-Real-IP $remote_addr; |
| 371 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 372 | proxy_set_header X-Forwarded-Proto $scheme; |
| 373 | proxy_set_header X-Forwarded-Host $server_name; |
| 374 | } |
| 375 | } |
| 376 | } |
| 377 | ` |
| 378 | |
| 379 | dir := t.TempDir() |
| 380 | cfgPath := filepath.Join(dir, "nginx.conf") |
| 381 | err := os.WriteFile(cfgPath, []byte(cfg), 0o600) |
| 382 | require.NoError(t, err) |
| 383 | |
| 384 | // ExecBackground will handle cleanup. |
| 385 | _, _ = ExecBackground(t, "server.nginx", nil, "nginx", []string{"-c", cfgPath}) |
| 386 | } |
| 387 | |
| 388 | type BasicClientStarter struct { |
| 389 | BlockEndpoints bool |
no test coverage detected