| 80 | } |
| 81 | |
| 82 | func TestWorkerEnv(t *testing.T) { |
| 83 | runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) { |
| 84 | req := httptest.NewRequest("GET", fmt.Sprintf("http://example.com/worker-env.php?i=%d", i), nil) |
| 85 | w := httptest.NewRecorder() |
| 86 | handler(w, req) |
| 87 | |
| 88 | resp := w.Result() |
| 89 | body, _ := io.ReadAll(resp.Body) |
| 90 | |
| 91 | assert.Equal(t, fmt.Sprintf("bar%d", i), string(body)) |
| 92 | }, &testOptions{workerScript: "worker-env.php", nbWorkers: 1, env: map[string]string{"FOO": "bar"}, nbParallelRequests: 10}) |
| 93 | } |
| 94 | |
| 95 | func TestWorkerGetOpt(t *testing.T) { |
| 96 | logger, buf := newTestLogger(t) |