diff options
author | Valery Piashchynski <[email protected]> | 2021-01-15 19:32:18 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-15 19:32:18 +0300 |
commit | 4c970f1876dfb5918ec2dc1d358a52698c6de040 (patch) | |
tree | 37222d13701c84b00ccc1e5d57844d2756369b5a | |
parent | f648d96c8516652f3231eb87be1f0a000e12793f (diff) | |
parent | 609fe5057f9f3cc2f7f5104f305f08a0496e8fef (diff) |
Merge pull request #477 from spiral/feature/worker_watcher_testsv2.0.0-beta8
feat(worker_watcher): Add stack tests
54 files changed, 1472 insertions, 348 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f67b944..fd1a9dda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,9 +18,9 @@ jobs: strategy: fail-fast: false matrix: - php: ["7.4", "8.0"] - go: ["1.14", "1.15"] - os: [ubuntu-latest, windows-latest] + php: [ "7.4", "8.0" ] + go: [ "1.14", "1.15" ] + os: [ ubuntu-latest, windows-latest ] steps: - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@v2 # action page: <https://github.com/actions/setup-go> @@ -66,31 +66,32 @@ jobs: if: ${{ matrix.os == 'windows-latest' }} run: | docker-compose -f ./tests/docker-compose.yaml up -d - go test -v -race -cover -tags=debug ./utils - go test -v -race -cover -tags=debug ./pkg/pipe - go test -v -race -cover -tags=debug ./pkg/pool - go test -v -race -cover -tags=debug ./pkg/socket - go test -v -race -cover -tags=debug ./pkg/worker - go test -v -race -cover -tags=debug ./tests/plugins/http - go test -v -race -cover -tags=debug ./tests/plugins/informer - go test -v -race -cover -tags=debug ./tests/plugins/reload - go test -v -race -cover -tags=debug ./tests/plugins/server - go test -v -race -cover -tags=debug ./tests/plugins/checker - go test -v -race -cover -tags=debug ./tests/plugins/config - go test -v -race -cover -tags=debug ./tests/plugins/gzip - go test -v -race -cover -tags=debug ./tests/plugins/headers - go test -v -race -cover -tags=debug ./tests/plugins/logger - go test -v -race -cover -tags=debug ./tests/plugins/metrics - go test -v -race -cover -tags=debug ./tests/plugins/redis - go test -v -race -cover -tags=debug ./tests/plugins/resetter - go test -v -race -cover -tags=debug ./tests/plugins/rpc - go test -v -race -cover -tags=debug ./tests/plugins/static - go test -v -race -cover -tags=debug ./plugins/kv/boltdb - go test -v -race -cover -tags=debug ./plugins/kv/memory - go test -v -race -cover -tags=debug ./plugins/kv/memcached - go test -v -race -cover -tags=debug ./tests/plugins/kv/boltdb - go test -v -race -cover -tags=debug ./tests/plugins/kv/memory - go test -v -race -cover -tags=debug ./tests/plugins/kv/memcached + go test -v -race -tags=debug ./utils + go test -v -race -tags=debug ./pkg/pipe + go test -v -race -tags=debug ./pkg/pool + go test -v -race -tags=debug ./pkg/socket + go test -v -race -tags=debug ./pkg/worker + go test -v -race -tags=debug ./pkg/worker_watcher + go test -v -race -tags=debug ./tests/plugins/http + go test -v -race -tags=debug ./tests/plugins/informer + go test -v -race -tags=debug ./tests/plugins/reload + go test -v -race -tags=debug ./tests/plugins/server + go test -v -race -tags=debug ./tests/plugins/checker + go test -v -race -tags=debug ./tests/plugins/config + go test -v -race -tags=debug ./tests/plugins/gzip + go test -v -race -tags=debug ./tests/plugins/headers + go test -v -race -tags=debug ./tests/plugins/logger + go test -v -race -tags=debug ./tests/plugins/metrics + go test -v -race -tags=debug ./tests/plugins/redis + go test -v -race -tags=debug ./tests/plugins/resetter + go test -v -race -tags=debug ./tests/plugins/rpc + go test -v -race -tags=debug ./tests/plugins/static + go test -v -race -tags=debug ./plugins/kv/boltdb + go test -v -race -tags=debug ./plugins/kv/memory + go test -v -race -tags=debug ./plugins/kv/memcached + go test -v -race -tags=debug ./tests/plugins/kv/boltdb + go test -v -race -tags=debug ./tests/plugins/kv/memory + go test -v -race -tags=debug ./tests/plugins/kv/memcached docker-compose -f ./tests/docker-compose.yaml down - name: Run golang tests on Linux @@ -98,31 +99,32 @@ jobs: run: | docker-compose -f ./tests/docker-compose.yaml up -d mkdir ./coverage-ci - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/utils.txt -covermode=atomic ./utils - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/pipe.txt -covermode=atomic ./pkg/pipe - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/pool.txt -covermode=atomic ./pkg/pool - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/socket.txt -covermode=atomic ./pkg/socket - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/worker.txt -covermode=atomic ./pkg/worker - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/http.txt -covermode=atomic ./tests/plugins/http - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/informer.txt -covermode=atomic ./tests/plugins/informer - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/reload.txt -covermode=atomic ./tests/plugins/reload - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/server.txt -covermode=atomic ./tests/plugins/server - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/checker.txt -covermode=atomic ./tests/plugins/checker - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/config.txt -covermode=atomic ./tests/plugins/config - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/gzip.txt -covermode=atomic ./tests/plugins/gzip - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/headers.txt -covermode=atomic ./tests/plugins/headers - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/logger.txt -covermode=atomic ./tests/plugins/logger - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/metrics.txt -covermode=atomic ./tests/plugins/metrics - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/redis.txt -covermode=atomic ./tests/plugins/redis - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/resetter.txt -covermode=atomic ./tests/plugins/resetter - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/rpc.txt -covermode=atomic ./tests/plugins/rpc - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/static.txt -covermode=atomic ./tests/plugins/static - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/boltdb_unit.txt -covermode=atomic ./plugins/kv/boltdb - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/kv_unit.txt -covermode=atomic ./plugins/kv/memory - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/memcached_unit.txt -covermode=atomic ./plugins/kv/memcached - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/boltdb.txt -covermode=atomic ./tests/plugins/kv/boltdb - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/memory.txt -covermode=atomic ./tests/plugins/kv/memory - go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/memcached.txt -covermode=atomic ./tests/plugins/kv/memcached + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/utils.txt -covermode=atomic ./utils + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipe.txt -covermode=atomic ./pkg/pipe + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pool.txt -covermode=atomic ./pkg/pool + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/socket.txt -covermode=atomic ./pkg/socket + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/worker.txt -covermode=atomic ./pkg/worker + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/worker_stack.txt -covermode=atomic ./pkg/worker_watcher + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/http.txt -covermode=atomic ./tests/plugins/http + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/informer.txt -covermode=atomic ./tests/plugins/informer + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/reload.txt -covermode=atomic ./tests/plugins/reload + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/server.txt -covermode=atomic ./tests/plugins/server + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/checker.txt -covermode=atomic ./tests/plugins/checker + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/config.txt -covermode=atomic ./tests/plugins/config + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/gzip.txt -covermode=atomic ./tests/plugins/gzip + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/headers.txt -covermode=atomic ./tests/plugins/headers + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/logger.txt -covermode=atomic ./tests/plugins/logger + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/metrics.txt -covermode=atomic ./tests/plugins/metrics + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/redis.txt -covermode=atomic ./tests/plugins/redis + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/resetter.txt -covermode=atomic ./tests/plugins/resetter + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/rpc.txt -covermode=atomic ./tests/plugins/rpc + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/static.txt -covermode=atomic ./tests/plugins/static + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/boltdb_unit.txt -covermode=atomic ./plugins/kv/boltdb + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/kv_unit.txt -covermode=atomic ./plugins/kv/memory + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/memcached_unit.txt -covermode=atomic ./plugins/kv/memcached + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/boltdb.txt -covermode=atomic ./tests/plugins/kv/boltdb + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/memory.txt -covermode=atomic ./tests/plugins/kv/memory + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/memcached.txt -covermode=atomic ./tests/plugins/kv/memcached docker-compose -f ./tests/docker-compose.yaml down cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt @@ -24,4 +24,5 @@ tests/vendor/ .rr-sample.yaml unit_tests unit_tests_copied -dir1
\ No newline at end of file +dir1 +coverage
\ No newline at end of file @@ -9,7 +9,7 @@ server: "RR_HTTP": "true" "RR_RPC": "tcp://127.0.0.1:6001" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" logs: mode: development diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index f43ef860..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch test file", - "type": "go", - "request": "launch", - "mode": "test", - "program": "${file}" - }, - { - "name": "Launch main debug, race", - "type": "go", - "request": "launch", - "mode": "auto", - "showLog": true, - "buildFlags": "-race", - "args": ["serve", "-c", "../.rr.yaml"], - "program": "${workspaceFolder}/cmd/main.go" - } - ] -}
\ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 78560788..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "workbench.editor.enablePreview": false, - "go.testFlags": ["-v", "-tags=debug", "-race"], - "go.lintTool": "golangci-lint", - "go.lintFlags": [ - "--fast" - ], - "cSpell.words": [ - "asdf", - "bbolt", - "gofiber", - "stopc", - "treshholdc" - ] -}
\ No newline at end of file @@ -23,6 +23,40 @@ install: build ## Build and install RR locally uninstall: ## Uninstall locally installed RR rm -f /usr/local/bin/rr +test_coverage: + go clean -testcache + docker-compose -f tests/docker-compose.yaml up -d + rm -rf coverage + mkdir coverage + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/utils.out -covermode=atomic ./utils + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/pipe.out -covermode=atomic ./pkg/pipe + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/pool.out -covermode=atomic ./pkg/pool + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/socket.out -covermode=atomic ./pkg/socket + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/worker.out -covermode=atomic ./pkg/worker + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/worker_stack.out -covermode=atomic ./pkg/worker_watcher + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/http.out -covermode=atomic ./tests/plugins/http + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/informer.out -covermode=atomic ./tests/plugins/informer + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/reload.out -covermode=atomic ./tests/plugins/reload + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/server.out -covermode=atomic ./tests/plugins/server + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/checker.out -covermode=atomic ./tests/plugins/checker + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/config.out -covermode=atomic ./tests/plugins/config + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/gzip.out -covermode=atomic ./tests/plugins/gzip + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/headers.out -covermode=atomic ./tests/plugins/headers + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/logger.out -covermode=atomic ./tests/plugins/logger + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/metrics.out -covermode=atomic ./tests/plugins/metrics + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/redis.out -covermode=atomic ./tests/plugins/redis + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/resetter.out -covermode=atomic ./tests/plugins/resetter + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/rpc.out -covermode=atomic ./tests/plugins/rpc + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/static.out -covermode=atomic ./tests/plugins/static + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/boltdb_unit.out -covermode=atomic ./plugins/kv/boltdb + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/kv_unit.out -covermode=atomic ./plugins/kv/memory + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/memcached_unit.out -covermode=atomic ./plugins/kv/memcached + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/boltdb.out -covermode=atomic ./tests/plugins/kv/boltdb + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/memory.out -covermode=atomic ./tests/plugins/kv/memory + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/memcached.out -covermode=atomic ./tests/plugins/kv/memcached + cat ./coverage/*.out > ./coverage/summary.out + docker-compose -f tests/docker-compose.yaml down + test: ## Run application tests go clean -testcache docker-compose -f tests/docker-compose.yaml up -d @@ -31,6 +65,7 @@ test: ## Run application tests go test -v -race -cover -tags=debug -covermode=atomic ./pkg/pool go test -v -race -cover -tags=debug -covermode=atomic ./pkg/socket go test -v -race -cover -tags=debug -covermode=atomic ./pkg/worker + go test -v -race -cover -tags=debug -covermode=atomic ./pkg/worker_watcher go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/http go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/informer go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/reload diff --git a/codecov.yml b/codecov.yml index eb499c3a..45fccc1d 100644 --- a/codecov.yml +++ b/codecov.yml @@ -16,4 +16,6 @@ ignore: - "tests" - "plugins/kv/boltdb/plugin_unit_test.go" - "plugins/kv/memcached/plugin_unit_test.go" - - "plugins/kv/memory/plugin_unit_test.go"
\ No newline at end of file + - "plugins/kv/memory/plugin_unit_test.go" + - "interfaces" + - "systemd"
\ No newline at end of file diff --git a/pkg/pipe/pipe_factory_spawn_test.go b/pkg/pipe/pipe_factory_spawn_test.go new file mode 100644 index 00000000..6decedf8 --- /dev/null +++ b/pkg/pipe/pipe_factory_spawn_test.go @@ -0,0 +1,490 @@ +package pipe + +import ( + "os/exec" + "strings" + "sync" + "testing" + "time" + + "github.com/spiral/errors" + "github.com/spiral/roadrunner/v2/interfaces/events" + "github.com/spiral/roadrunner/v2/internal" + "github.com/spiral/roadrunner/v2/pkg/payload" + workerImpl "github.com/spiral/roadrunner/v2/pkg/worker" + "github.com/stretchr/testify/assert" +) + +func Test_GetState2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + + w, err := NewPipeFactory().SpawnWorker(cmd) + go func() { + assert.NoError(t, w.Wait()) + assert.Equal(t, internal.StateStopped, w.State().Value()) + }() + + assert.NoError(t, err) + assert.NotNil(t, w) + + assert.Equal(t, internal.StateReady, w.State().Value()) + err = w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } +} + +func Test_Kill2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + + w, err := NewPipeFactory().SpawnWorker(cmd) + wg := &sync.WaitGroup{} + wg.Add(1) + go func() { + defer wg.Done() + assert.Error(t, w.Wait()) + assert.Equal(t, internal.StateErrored, w.State().Value()) + }() + + assert.NoError(t, err) + assert.NotNil(t, w) + + assert.Equal(t, internal.StateReady, w.State().Value()) + err = w.Kill() + if err != nil { + t.Errorf("error killing the Process: error %v", err) + } + wg.Wait() +} + +func Test_Pipe_Start2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + + w, err := NewPipeFactory().SpawnWorker(cmd) + assert.NoError(t, err) + assert.NotNil(t, w) + + go func() { + assert.NoError(t, w.Wait()) + }() + + assert.NoError(t, w.Stop()) +} + +func Test_Pipe_StartError2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + err := cmd.Start() + if err != nil { + t.Errorf("error running the command: error %v", err) + } + + w, err := NewPipeFactory().SpawnWorker(cmd) + assert.Error(t, err) + assert.Nil(t, w) +} + +func Test_Pipe_PipeError3(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + _, err := cmd.StdinPipe() + if err != nil { + t.Errorf("error creating the STDIN pipe: error %v", err) + } + + w, err := NewPipeFactory().SpawnWorker(cmd) + assert.Error(t, err) + assert.Nil(t, w) +} + +func Test_Pipe_PipeError4(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + _, err := cmd.StdinPipe() + if err != nil { + t.Errorf("error creating the STDIN pipe: error %v", err) + } + + w, err := NewPipeFactory().SpawnWorker(cmd) + assert.Error(t, err) + assert.Nil(t, w) +} + +func Test_Pipe_Failboot2(t *testing.T) { + cmd := exec.Command("php", "../../tests/failboot.php") + w, err := NewPipeFactory().SpawnWorker(cmd) + + assert.Nil(t, w) + assert.Error(t, err) + assert.Contains(t, err.Error(), "failboot") +} + +func Test_Pipe_Invalid2t(t *testing.T) { + cmd := exec.Command("php", "../../tests/invalid.php") + w, err := NewPipeFactory().SpawnWorker(cmd) + assert.Error(t, err) + assert.Nil(t, w) +} + +func Test_Pipe_Echo2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + w, err := NewPipeFactory().SpawnWorker(cmd) + if err != nil { + t.Fatal(err) + } + defer func() { + err = w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } + }() + + sw, err := workerImpl.From(w) + if err != nil { + t.Fatal(err) + } + + res, err := sw.Exec(payload.Payload{Body: []byte("hello")}) + + assert.NoError(t, err) + assert.NotNil(t, res) + assert.NotNil(t, res.Body) + assert.Empty(t, res.Context) + + assert.Equal(t, "hello", res.String()) +} + +func Test_Pipe_Broken2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "broken", "pipes") + w, err := NewPipeFactory().SpawnWorker(cmd) + if err != nil { + t.Fatal(err) + } + defer func() { + time.Sleep(time.Second) + err = w.Stop() + assert.Error(t, err) + }() + + sw, err := workerImpl.From(w) + if err != nil { + t.Fatal(err) + } + + res, err := sw.Exec(payload.Payload{Body: []byte("hello")}) + + assert.Error(t, err) + assert.Nil(t, res.Body) + assert.Nil(t, res.Context) +} + +func Benchmark_Pipe_SpawnWorker_Stop2(b *testing.B) { + f := NewPipeFactory() + for n := 0; n < b.N; n++ { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + w, _ := f.SpawnWorker(cmd) + go func() { + if w.Wait() != nil { + b.Fail() + } + }() + + err := w.Stop() + if err != nil { + b.Errorf("error stopping the worker: error %v", err) + } + } +} + +func Benchmark_Pipe_Worker_ExecEcho2(b *testing.B) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + + w, _ := NewPipeFactory().SpawnWorker(cmd) + sw, err := workerImpl.From(w) + if err != nil { + b.Fatal(err) + } + b.ReportAllocs() + b.ResetTimer() + go func() { + err := w.Wait() + if err != nil { + b.Errorf("error waiting the worker: error %v", err) + } + }() + defer func() { + err := w.Stop() + if err != nil { + b.Errorf("error stopping the worker: error %v", err) + } + }() + + for n := 0; n < b.N; n++ { + if _, err := sw.Exec(payload.Payload{Body: []byte("hello")}); err != nil { + b.Fail() + } + } +} + +func Benchmark_Pipe_Worker_ExecEcho4(b *testing.B) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + w, err := NewPipeFactory().SpawnWorker(cmd) + if err != nil { + b.Fatal(err) + } + + defer func() { + err = w.Stop() + if err != nil { + b.Errorf("error stopping the Process: error %v", err) + } + }() + + sw, err := workerImpl.From(w) + if err != nil { + b.Fatal(err) + } + + for n := 0; n < b.N; n++ { + if _, err := sw.Exec(payload.Payload{Body: []byte("hello")}); err != nil { + b.Fail() + } + } +} + +func Benchmark_Pipe_Worker_ExecEchoWithoutContext2(b *testing.B) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + w, err := NewPipeFactory().SpawnWorker(cmd) + if err != nil { + b.Fatal(err) + } + + defer func() { + err = w.Stop() + if err != nil { + b.Errorf("error stopping the Process: error %v", err) + } + }() + + sw, err := workerImpl.From(w) + if err != nil { + b.Fatal(err) + } + + for n := 0; n < b.N; n++ { + if _, err := sw.Exec(payload.Payload{Body: []byte("hello")}); err != nil { + b.Fail() + } + } +} + +func Test_Echo2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + + w, err := NewPipeFactory().SpawnWorker(cmd) + if err != nil { + t.Fatal(err) + } + + syncWorker, err := workerImpl.From(w) + if err != nil { + t.Fatal(err) + } + go func() { + assert.NoError(t, syncWorker.Wait()) + }() + defer func() { + err := syncWorker.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } + }() + + res, err := syncWorker.Exec(payload.Payload{Body: []byte("hello")}) + + assert.Nil(t, err) + assert.NotNil(t, res) + assert.NotNil(t, res.Body) + assert.Empty(t, res.Context) + + assert.Equal(t, "hello", res.String()) +} + +func Test_BadPayload2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + + w, _ := NewPipeFactory().SpawnWorker(cmd) + + syncWorker, err := workerImpl.From(w) + if err != nil { + t.Fatal(err) + } + + go func() { + assert.NoError(t, syncWorker.Wait()) + }() + defer func() { + err := syncWorker.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } + }() + + res, err := syncWorker.Exec(payload.Payload{}) + + assert.Error(t, err) + assert.Nil(t, res.Body) + assert.Nil(t, res.Context) + + assert.Contains(t, err.Error(), "payload can not be empty") +} + +func Test_String2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + + w, _ := NewPipeFactory().SpawnWorker(cmd) + go func() { + assert.NoError(t, w.Wait()) + }() + defer func() { + err := w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } + }() + + assert.Contains(t, w.String(), "php ../../tests/client.php echo pipes") + assert.Contains(t, w.String(), "ready") + assert.Contains(t, w.String(), "numExecs: 0") +} + +func Test_Echo_Slow2(t *testing.T) { + cmd := exec.Command("php", "../../tests/slow-client.php", "echo", "pipes", "10", "10") + + w, _ := NewPipeFactory().SpawnWorker(cmd) + go func() { + assert.NoError(t, w.Wait()) + }() + defer func() { + err := w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } + }() + + syncWorker, err := workerImpl.From(w) + if err != nil { + t.Fatal(err) + } + + res, err := syncWorker.Exec(payload.Payload{Body: []byte("hello")}) + + assert.Nil(t, err) + assert.NotNil(t, res) + assert.NotNil(t, res.Body) + assert.Empty(t, res.Context) + + assert.Equal(t, "hello", res.String()) +} + +func Test_Broken2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "broken", "pipes") + data := "" + mu := &sync.Mutex{} + listener := func(event interface{}) { + if wev, ok := event.(events.WorkerEvent); ok { + mu.Lock() + data = string(wev.Payload.([]byte)) + mu.Unlock() + } + } + + w, err := NewPipeFactory().SpawnWorker(cmd, listener) + if err != nil { + t.Fatal(err) + } + + syncWorker, err := workerImpl.From(w) + if err != nil { + t.Fatal(err) + } + + res, err := syncWorker.Exec(payload.Payload{Body: []byte("hello")}) + assert.NotNil(t, err) + assert.Nil(t, res.Body) + assert.Nil(t, res.Context) + + time.Sleep(time.Second * 3) + mu.Lock() + if strings.ContainsAny(data, "undefined_function()") == false { + t.Fail() + } + mu.Unlock() + assert.Error(t, w.Stop()) +} + +func Test_Error2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "error", "pipes") + + w, _ := NewPipeFactory().SpawnWorker(cmd) + go func() { + assert.NoError(t, w.Wait()) + }() + + defer func() { + err := w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } + }() + + syncWorker, err := workerImpl.From(w) + if err != nil { + t.Fatal(err) + } + + res, err := syncWorker.Exec(payload.Payload{Body: []byte("hello")}) + assert.NotNil(t, err) + assert.Nil(t, res.Body) + assert.Nil(t, res.Context) + + if errors.Is(errors.SoftJob, err) == false { + t.Fatal("error should be of type errors.ErrSoftJob") + } + assert.Contains(t, err.Error(), "hello") +} + +func Test_NumExecs2(t *testing.T) { + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + + w, _ := NewPipeFactory().SpawnWorker(cmd) + go func() { + assert.NoError(t, w.Wait()) + }() + defer func() { + err := w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } + }() + + syncWorker, err := workerImpl.From(w) + if err != nil { + t.Fatal(err) + } + + _, err = syncWorker.Exec(payload.Payload{Body: []byte("hello")}) + if err != nil { + t.Errorf("fail to execute payload: error %v", err) + } + assert.Equal(t, int64(1), w.State().NumExecs()) + + _, err = syncWorker.Exec(payload.Payload{Body: []byte("hello")}) + if err != nil { + t.Errorf("fail to execute payload: error %v", err) + } + assert.Equal(t, int64(2), w.State().NumExecs()) + + _, err = syncWorker.Exec(payload.Payload{Body: []byte("hello")}) + if err != nil { + t.Errorf("fail to execute payload: error %v", err) + } + assert.Equal(t, int64(3), w.State().NumExecs()) +} diff --git a/pkg/socket/socket_factory_spawn_test.go b/pkg/socket/socket_factory_spawn_test.go new file mode 100644 index 00000000..2f21e408 --- /dev/null +++ b/pkg/socket/socket_factory_spawn_test.go @@ -0,0 +1,507 @@ +package socket + +import ( + "net" + "os/exec" + "sync" + "syscall" + "testing" + "time" + + "github.com/spiral/roadrunner/v2/pkg/payload" + "github.com/spiral/roadrunner/v2/pkg/worker" + "github.com/stretchr/testify/assert" +) + +func Test_Tcp_Start2(t *testing.T) { + ls, err := net.Listen("tcp", "localhost:9007") + if assert.NoError(t, err) { + defer func() { + err := ls.Close() + if err != nil { + t.Errorf("error closing the listener: error %v", err) + } + }() + } else { + t.Skip("socket is busy") + } + + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") + + w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) + assert.NoError(t, err) + assert.NotNil(t, w) + + go func() { + assert.NoError(t, w.Wait()) + }() + + err = w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } +} + +func Test_Tcp_StartCloseFactory2(t *testing.T) { + ls, err := net.Listen("tcp", "localhost:9007") + if assert.NoError(t, err) { + } else { + t.Skip("socket is busy") + } + + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") + + f := NewSocketServer(ls, time.Minute) + defer func() { + err := ls.Close() + if err != nil { + t.Errorf("error closing the listener: error %v", err) + } + }() + + w, err := f.SpawnWorker(cmd) + assert.NoError(t, err) + assert.NotNil(t, w) + + err = w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } +} + +func Test_Tcp_StartError2(t *testing.T) { + ls, err := net.Listen("tcp", "localhost:9007") + if assert.NoError(t, err) { + defer func() { + err := ls.Close() + if err != nil { + t.Errorf("error closing the listener: error %v", err) + } + }() + } else { + t.Skip("socket is busy") + } + + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") + err = cmd.Start() + if err != nil { + t.Errorf("error executing the command: error %v", err) + } + + w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) + assert.Error(t, err) + assert.Nil(t, w) +} + +func Test_Tcp_Failboot2(t *testing.T) { + ls, err := net.Listen("tcp", "localhost:9007") + if assert.NoError(t, err) { + defer func() { + err3 := ls.Close() + if err3 != nil { + t.Errorf("error closing the listener: error %v", err3) + } + }() + } else { + t.Skip("socket is busy") + } + + cmd := exec.Command("php", "../../tests/failboot.php") + + w, err2 := NewSocketServer(ls, time.Second*5).SpawnWorker(cmd) + assert.Nil(t, w) + assert.Error(t, err2) + assert.Contains(t, err2.Error(), "failboot") +} + +func Test_Tcp_Invalid2(t *testing.T) { + ls, err := net.Listen("tcp", "localhost:9007") + if assert.NoError(t, err) { + defer func() { + err := ls.Close() + if err != nil { + t.Errorf("error closing the listener: error %v", err) + } + }() + } else { + t.Skip("socket is busy") + } + + cmd := exec.Command("php", "../../tests/invalid.php") + + w, err := NewSocketServer(ls, time.Second*1).SpawnWorker(cmd) + assert.Error(t, err) + assert.Nil(t, w) +} + +func Test_Tcp_Broken2(t *testing.T) { + ls, err := net.Listen("tcp", "localhost:9007") + if assert.NoError(t, err) { + defer func() { + err := ls.Close() + if err != nil { + t.Errorf("error closing the listener: error %v", err) + } + }() + } else { + t.Skip("socket is busy") + } + + cmd := exec.Command("php", "../../tests/client.php", "broken", "tcp") + + w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) + if err != nil { + t.Fatal(err) + } + wg := sync.WaitGroup{} + wg.Add(1) + go func() { + defer wg.Done() + err := w.Wait() + assert.Error(t, err) + assert.Contains(t, err.Error(), "undefined_function()") + }() + + defer func() { + time.Sleep(time.Second) + err2 := w.Stop() + // write tcp 127.0.0.1:9007->127.0.0.1:34204: use of closed network connection + assert.Error(t, err2) + }() + + sw, err := worker.From(w) + if err != nil { + t.Fatal(err) + } + + res, err := sw.Exec(payload.Payload{Body: []byte("hello")}) + assert.Error(t, err) + assert.Nil(t, res.Body) + assert.Nil(t, res.Context) + wg.Wait() +} + +func Test_Tcp_Echo2(t *testing.T) { + ls, err := net.Listen("tcp", "localhost:9007") + if assert.NoError(t, err) { + defer func() { + err := ls.Close() + if err != nil { + t.Errorf("error closing the listener: error %v", err) + } + }() + } else { + t.Skip("socket is busy") + } + + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") + + w, _ := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) + go func() { + assert.NoError(t, w.Wait()) + }() + defer func() { + err = w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } + }() + + sw, err := worker.From(w) + if err != nil { + t.Fatal(err) + } + + res, err := sw.Exec(payload.Payload{Body: []byte("hello")}) + + assert.NoError(t, err) + assert.NotNil(t, res) + assert.NotNil(t, res.Body) + assert.Empty(t, res.Context) + + assert.Equal(t, "hello", res.String()) +} + +func Test_Unix_Start2(t *testing.T) { + ls, err := net.Listen("unix", "sock.unix") + assert.NoError(t, err) + defer func() { + err := ls.Close() + assert.NoError(t, err) + }() + + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") + + w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) + assert.NoError(t, err) + assert.NotNil(t, w) + + go func() { + assert.NoError(t, w.Wait()) + }() + + err = w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } +} + +func Test_Unix_Failboot2(t *testing.T) { + ls, err := net.Listen("unix", "sock.unix") + assert.NoError(t, err) + defer func() { + err := ls.Close() + assert.NoError(t, err) + }() + + cmd := exec.Command("php", "../../tests/failboot.php") + + w, err := NewSocketServer(ls, time.Second*5).SpawnWorker(cmd) + assert.Nil(t, w) + assert.Error(t, err) + assert.Contains(t, err.Error(), "failboot") +} + +func Test_Unix_Timeout2(t *testing.T) { + ls, err := net.Listen("unix", "sock.unix") + assert.NoError(t, err) + defer func() { + err := ls.Close() + assert.NoError(t, err) + }() + + cmd := exec.Command("php", "../../tests/slow-client.php", "echo", "unix", "200", "0") + + w, err := NewSocketServer(ls, time.Millisecond*100).SpawnWorker(cmd) + assert.Nil(t, w) + assert.Error(t, err) + assert.Contains(t, err.Error(), "relay timeout") +} + +func Test_Unix_Invalid2(t *testing.T) { + ls, err := net.Listen("unix", "sock.unix") + assert.NoError(t, err) + defer func() { + err := ls.Close() + assert.NoError(t, err) + }() + + cmd := exec.Command("php", "../../tests/invalid.php") + + w, err := NewSocketServer(ls, time.Second*10).SpawnWorker(cmd) + assert.Error(t, err) + assert.Nil(t, w) +} + +func Test_Unix_Broken2(t *testing.T) { + ls, err := net.Listen("unix", "sock.unix") + assert.NoError(t, err) + defer func() { + err := ls.Close() + assert.NoError(t, err) + }() + + cmd := exec.Command("php", "../../tests/client.php", "broken", "unix") + + w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) + if err != nil { + t.Fatal(err) + } + wg := &sync.WaitGroup{} + wg.Add(1) + go func() { + defer wg.Done() + err := w.Wait() + assert.Error(t, err) + assert.Contains(t, err.Error(), "undefined_function()") + }() + + defer func() { + time.Sleep(time.Second) + err = w.Stop() + assert.Error(t, err) + }() + + sw, err := worker.From(w) + if err != nil { + t.Fatal(err) + } + + res, err := sw.Exec(payload.Payload{Body: []byte("hello")}) + + assert.Error(t, err) + assert.Nil(t, res.Context) + assert.Nil(t, res.Body) + wg.Wait() +} + +func Test_Unix_Echo2(t *testing.T) { + ls, err := net.Listen("unix", "sock.unix") + assert.NoError(t, err) + defer func() { + err := ls.Close() + assert.NoError(t, err) + }() + + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") + + w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) + if err != nil { + t.Fatal(err) + } + go func() { + assert.NoError(t, w.Wait()) + }() + defer func() { + err = w.Stop() + if err != nil { + t.Errorf("error stopping the Process: error %v", err) + } + }() + + sw, err := worker.From(w) + if err != nil { + t.Fatal(err) + } + + res, err := sw.Exec(payload.Payload{Body: []byte("hello")}) + + assert.NoError(t, err) + assert.NotNil(t, res) + assert.NotNil(t, res.Body) + assert.Empty(t, res.Context) + + assert.Equal(t, "hello", res.String()) +} + +func Benchmark_Tcp_SpawnWorker_Stop2(b *testing.B) { + ls, err := net.Listen("unix", "sock.unix") + assert.NoError(b, err) + defer func() { + err := ls.Close() + assert.NoError(b, err) + }() + + f := NewSocketServer(ls, time.Minute) + for n := 0; n < b.N; n++ { + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") + + w, err := f.SpawnWorker(cmd) + if err != nil { + b.Fatal(err) + } + go func() { + assert.NoError(b, w.Wait()) + }() + + err = w.Stop() + if err != nil { + b.Errorf("error stopping the Process: error %v", err) + } + } +} + +func Benchmark_Tcp_Worker_ExecEcho2(b *testing.B) { + ls, err := net.Listen("unix", "sock.unix") + assert.NoError(b, err) + defer func() { + err := ls.Close() + assert.NoError(b, err) + }() + + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") + + w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) + if err != nil { + b.Fatal(err) + } + defer func() { + err = w.Stop() + if err != nil { + b.Errorf("error stopping the Process: error %v", err) + } + }() + + sw, err := worker.From(w) + if err != nil { + b.Fatal(err) + } + + for n := 0; n < b.N; n++ { + if _, err := sw.Exec(payload.Payload{Body: []byte("hello")}); err != nil { + b.Fail() + } + } +} + +func Benchmark_Unix_SpawnWorker_Stop2(b *testing.B) { + defer func() { + _ = syscall.Unlink("sock.unix") + }() + ls, err := net.Listen("unix", "sock.unix") + if err == nil { + defer func() { + err := ls.Close() + if err != nil { + b.Errorf("error closing the listener: error %v", err) + } + }() + } else { + b.Skip("socket is busy") + } + + f := NewSocketServer(ls, time.Minute) + for n := 0; n < b.N; n++ { + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") + + w, err := f.SpawnWorker(cmd) + if err != nil { + b.Fatal(err) + } + err = w.Stop() + if err != nil { + b.Errorf("error stopping the Process: error %v", err) + } + } +} + +func Benchmark_Unix_Worker_ExecEcho2(b *testing.B) { + defer func() { + _ = syscall.Unlink("sock.unix") + }() + ls, err := net.Listen("unix", "sock.unix") + if err == nil { + defer func() { + err := ls.Close() + if err != nil { + b.Errorf("error closing the listener: error %v", err) + } + }() + } else { + b.Skip("socket is busy") + } + + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") + + w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) + if err != nil { + b.Fatal(err) + } + defer func() { + err = w.Stop() + if err != nil { + b.Errorf("error stopping the Process: error %v", err) + } + }() + + sw, err := worker.From(w) + if err != nil { + b.Fatal(err) + } + + for n := 0; n < b.N; n++ { + if _, err := sw.Exec(payload.Payload{Body: []byte("hello")}); err != nil { + b.Fail() + } + } +} diff --git a/pkg/worker_watcher/stack.go b/pkg/worker_watcher/stack.go index 55f1f52a..788750dc 100644 --- a/pkg/worker_watcher/stack.go +++ b/pkg/worker_watcher/stack.go @@ -10,17 +10,19 @@ import ( ) type Stack struct { - workers []worker.BaseProcess - mutex sync.RWMutex - destroy bool - actualNumOfWorkers int64 + workers []worker.BaseProcess + mutex sync.RWMutex + destroy bool + actualNumOfWorkers uint64 + initialNumOfWorkers uint64 } -func NewWorkersStack() *Stack { +func NewWorkersStack(initialNumOfWorkers uint64) *Stack { w := runtime.NumCPU() return &Stack{ - workers: make([]worker.BaseProcess, 0, w), - actualNumOfWorkers: 0, + workers: make([]worker.BaseProcess, 0, w), + actualNumOfWorkers: 0, + initialNumOfWorkers: initialNumOfWorkers, } } @@ -113,7 +115,7 @@ func (stack *Stack) Destroy(ctx context.Context) { case <-tt.C: stack.mutex.Lock() // that might be one of the workers is working - if len(stack.workers) != int(stack.actualNumOfWorkers) { + if stack.initialNumOfWorkers != stack.actualNumOfWorkers { stack.mutex.Unlock() continue } diff --git a/pkg/worker_watcher/stack_test.go b/pkg/worker_watcher/stack_test.go new file mode 100644 index 00000000..86af2043 --- /dev/null +++ b/pkg/worker_watcher/stack_test.go @@ -0,0 +1,129 @@ +package worker_watcher //nolint:golint,stylecheck +import ( + "context" + "os/exec" + "testing" + "time" + + "github.com/spiral/roadrunner/v2/interfaces/worker" + workerImpl "github.com/spiral/roadrunner/v2/pkg/worker" + "github.com/stretchr/testify/assert" +) + +func TestNewWorkersStack(t *testing.T) { + stack := NewWorkersStack(0) + assert.Equal(t, uint64(0), stack.actualNumOfWorkers) + assert.Equal(t, []worker.BaseProcess{}, stack.workers) +} + +func TestStack_Push(t *testing.T) { + stack := NewWorkersStack(1) + + w, err := workerImpl.InitBaseWorker(&exec.Cmd{}) + assert.NoError(t, err) + + stack.Push(w) + assert.Equal(t, uint64(1), stack.actualNumOfWorkers) +} + +func TestStack_Pop(t *testing.T) { + stack := NewWorkersStack(1) + cmd := exec.Command("php", "../tests/client.php", "echo", "pipes") + + w, err := workerImpl.InitBaseWorker(cmd) + assert.NoError(t, err) + + stack.Push(w) + assert.Equal(t, uint64(1), stack.actualNumOfWorkers) + + _, _ = stack.Pop() + assert.Equal(t, uint64(0), stack.actualNumOfWorkers) +} + +func TestStack_FindAndRemoveByPid(t *testing.T) { + stack := NewWorkersStack(1) + cmd := exec.Command("php", "../tests/client.php", "echo", "pipes") + w, err := workerImpl.InitBaseWorker(cmd) + assert.NoError(t, err) + + assert.NoError(t, w.Start()) + + stack.Push(w) + assert.Equal(t, uint64(1), stack.actualNumOfWorkers) + + stack.FindAndRemoveByPid(w.Pid()) + assert.Equal(t, uint64(0), stack.actualNumOfWorkers) +} + +func TestStack_IsEmpty(t *testing.T) { + stack := NewWorkersStack(1) + cmd := exec.Command("php", "../tests/client.php", "echo", "pipes") + + w, err := workerImpl.InitBaseWorker(cmd) + assert.NoError(t, err) + + stack.Push(w) + assert.Equal(t, uint64(1), stack.actualNumOfWorkers) + + assert.Equal(t, false, stack.IsEmpty()) +} + +func TestStack_Workers(t *testing.T) { + stack := NewWorkersStack(1) + cmd := exec.Command("php", "../tests/client.php", "echo", "pipes") + w, err := workerImpl.InitBaseWorker(cmd) + assert.NoError(t, err) + assert.NoError(t, w.Start()) + + stack.Push(w) + + wrks := stack.Workers() + assert.Equal(t, 1, len(wrks)) + assert.Equal(t, w.Pid(), wrks[0].Pid()) +} + +func TestStack_Reset(t *testing.T) { + stack := NewWorkersStack(1) + cmd := exec.Command("php", "../tests/client.php", "echo", "pipes") + w, err := workerImpl.InitBaseWorker(cmd) + assert.NoError(t, err) + assert.NoError(t, w.Start()) + + stack.Push(w) + assert.Equal(t, uint64(1), stack.actualNumOfWorkers) + stack.Reset() + assert.Equal(t, uint64(0), stack.actualNumOfWorkers) +} + +func TestStack_Destroy(t *testing.T) { + stack := NewWorkersStack(1) + cmd := exec.Command("php", "../tests/client.php", "echo", "pipes") + w, err := workerImpl.InitBaseWorker(cmd) + assert.NoError(t, err) + assert.NoError(t, w.Start()) + + stack.Push(w) + stack.Destroy(context.Background()) + assert.Equal(t, uint64(0), stack.actualNumOfWorkers) +} + +func TestStack_DestroyWithWait(t *testing.T) { + stack := NewWorkersStack(2) + cmd := exec.Command("php", "../tests/client.php", "echo", "pipes") + w, err := workerImpl.InitBaseWorker(cmd) + assert.NoError(t, err) + assert.NoError(t, w.Start()) + + stack.Push(w) + stack.Push(w) + assert.Equal(t, uint64(2), stack.actualNumOfWorkers) + + go func() { + wrk, _ := stack.Pop() + time.Sleep(time.Second * 3) + stack.Push(wrk) + }() + time.Sleep(time.Second) + stack.Destroy(context.Background()) + assert.Equal(t, uint64(0), stack.actualNumOfWorkers) +} diff --git a/pkg/worker_watcher/worker_watcher.go b/pkg/worker_watcher/worker_watcher.go index 0c086d5f..bf1f2435 100755 --- a/pkg/worker_watcher/worker_watcher.go +++ b/pkg/worker_watcher/worker_watcher.go @@ -13,23 +13,19 @@ import ( // workerCreateFunc can be nil, but in that case, dead stack will not be replaced func NewWorkerWatcher(allocator worker.Allocator, numWorkers int64, events events.Handler) worker.Watcher { ww := &workerWatcher{ - stack: NewWorkersStack(), - allocator: allocator, - initialNumWorkers: numWorkers, - actualNumWorkers: numWorkers, - events: events, + stack: NewWorkersStack(uint64(numWorkers)), + allocator: allocator, + events: events, } return ww } type workerWatcher struct { - mutex sync.RWMutex - stack *Stack - allocator worker.Allocator - initialNumWorkers int64 - actualNumWorkers int64 - events events.Handler + mutex sync.RWMutex + stack *Stack + allocator worker.Allocator + events events.Handler } func (ww *workerWatcher) AddToWatch(workers []worker.BaseProcess) error { diff --git a/plugins/kv/boltdb/plugin_unit_test.go b/plugins/kv/boltdb/plugin_unit_test.go index 2459e493..fa12db8c 100644 --- a/plugins/kv/boltdb/plugin_unit_test.go +++ b/plugins/kv/boltdb/plugin_unit_test.go @@ -164,7 +164,7 @@ func TestConcurrentReadWriteTransactions(t *testing.T) { // concurrently set the keys go func(s kv.Storage) { defer wg.Done() - for i := 0; i <= 1000; i++ { + for i := 0; i <= 100; i++ { m.Lock() // set is writable transaction // it should stop readable @@ -184,7 +184,7 @@ func TestConcurrentReadWriteTransactions(t *testing.T) { // should be no errors go func(s kv.Storage) { defer wg.Done() - for i := 0; i <= 1000; i++ { + for i := 0; i <= 100; i++ { m.RLock() v, err = s.Has("key") assert.NoError(t, err) @@ -197,7 +197,7 @@ func TestConcurrentReadWriteTransactions(t *testing.T) { // should be no errors go func(s kv.Storage) { defer wg.Done() - for i := 0; i <= 1000; i++ { + for i := 0; i <= 100; i++ { m.Lock() err = s.Delete("key" + strconv.Itoa(i)) assert.NoError(t, err) @@ -453,7 +453,7 @@ func TestStorage_MExpire_TTL(t *testing.T) { } assert.NoError(t, s.MExpire(i1, i2)) - time.Sleep(time.Second * 6) + time.Sleep(time.Second * 7) // ensure that storage is clean v, err = s.Has("key", "key2") diff --git a/plugins/kv/memcached/plugin.go b/plugins/kv/memcached/plugin.go index f5111c04..05159b33 100644 --- a/plugins/kv/memcached/plugin.go +++ b/plugins/kv/memcached/plugin.go @@ -68,7 +68,7 @@ func (s *Plugin) Name() string { } // Has checks the key for existence -func (s Plugin) Has(keys ...string) (map[string]bool, error) { +func (s *Plugin) Has(keys ...string) (map[string]bool, error) { const op = errors.Op("memcached Has") if keys == nil { return nil, errors.E(op, errors.NoKeys) @@ -93,7 +93,7 @@ func (s Plugin) Has(keys ...string) (map[string]bool, error) { // Get gets the item for the given key. ErrCacheMiss is returned for a // memcache cache miss. The key must be at most 250 bytes in length. -func (s Plugin) Get(key string) ([]byte, error) { +func (s *Plugin) Get(key string) ([]byte, error) { const op = errors.Op("memcached Get") // to get cases like " " keyTrimmed := strings.TrimSpace(key) @@ -115,7 +115,7 @@ func (s Plugin) Get(key string) ([]byte, error) { // return map with key -- string // and map value as value -- []byte -func (s Plugin) MGet(keys ...string) (map[string]interface{}, error) { +func (s *Plugin) MGet(keys ...string) (map[string]interface{}, error) { const op = errors.Op("memcached MGet") if keys == nil { return nil, errors.E(op, errors.NoKeys) @@ -150,7 +150,7 @@ func (s Plugin) MGet(keys ...string) (map[string]interface{}, error) { // Expiration is the cache expiration time, in seconds: either a relative // time from now (up to 1 month), or an absolute Unix epoch time. // Zero means the Item has no expiration time. -func (s Plugin) Set(items ...kv.Item) error { +func (s *Plugin) Set(items ...kv.Item) error { const op = errors.Op("memcached Set") if items == nil { return errors.E(op, errors.NoKeys) @@ -191,7 +191,7 @@ func (s Plugin) Set(items ...kv.Item) error { // Expiration is the cache expiration time, in seconds: either a relative // time from now (up to 1 month), or an absolute Unix epoch time. // Zero means the Item has no expiration time. -func (s Plugin) MExpire(items ...kv.Item) error { +func (s *Plugin) MExpire(items ...kv.Item) error { const op = errors.Op("memcached MExpire") for i := range items { if items[i].TTL == "" || strings.TrimSpace(items[i].Key) == "" { @@ -218,12 +218,12 @@ func (s Plugin) MExpire(items ...kv.Item) error { } // return time in seconds (int32) for a given keys -func (s Plugin) TTL(keys ...string) (map[string]interface{}, error) { +func (s *Plugin) TTL(keys ...string) (map[string]interface{}, error) { const op = errors.Op("memcached HTTLas") return nil, errors.E(op, errors.Str("not valid request for memcached, see https://github.com/memcached/memcached/issues/239")) } -func (s Plugin) Delete(keys ...string) error { +func (s *Plugin) Delete(keys ...string) error { const op = errors.Op("memcached Has") if keys == nil { return errors.E(op, errors.NoKeys) @@ -247,6 +247,6 @@ func (s Plugin) Delete(keys ...string) error { return nil } -func (s Plugin) Close() error { +func (s *Plugin) Close() error { return nil } diff --git a/plugins/kv/memcached/plugin_unit_test.go b/plugins/kv/memcached/plugin_unit_test.go index 3d37748b..31423627 100644 --- a/plugins/kv/memcached/plugin_unit_test.go +++ b/plugins/kv/memcached/plugin_unit_test.go @@ -245,7 +245,7 @@ func TestStorage_MExpire_TTL(t *testing.T) { } assert.NoError(t, s.MExpire(i1, i2)) - time.Sleep(time.Second * 6) + time.Sleep(time.Second * 7) // ensure that storage is clean v, err = s.Has("key", "key2") @@ -341,7 +341,7 @@ func TestStorage_SetExpire_TTL(t *testing.T) { TTL: nowPlusFive, })) - time.Sleep(time.Second * 6) + time.Sleep(time.Second * 7) // ensure that storage is clean v, err = s.Has("key", "key2") @@ -387,7 +387,7 @@ func TestConcurrentReadWriteTransactions(t *testing.T) { // concurrently set the keys go func(s kv.Storage) { defer wg.Done() - for i := 0; i <= 1000; i++ { + for i := 0; i <= 100; i++ { m.Lock() // set is writable transaction // it should stop readable @@ -407,7 +407,7 @@ func TestConcurrentReadWriteTransactions(t *testing.T) { // should be no errors go func(s kv.Storage) { defer wg.Done() - for i := 0; i <= 1000; i++ { + for i := 0; i <= 100; i++ { m.RLock() v, err = s.Has("key") assert.NoError(t, err) @@ -420,7 +420,7 @@ func TestConcurrentReadWriteTransactions(t *testing.T) { // should be no errors go func(s kv.Storage) { defer wg.Done() - for i := 0; i <= 1000; i++ { + for i := 0; i <= 100; i++ { m.Lock() err = s.Delete("key" + strconv.Itoa(i)) assert.NoError(t, err) diff --git a/plugins/kv/memory/plugin_unit_test.go b/plugins/kv/memory/plugin_unit_test.go index d3b24860..6daa0795 100644 --- a/plugins/kv/memory/plugin_unit_test.go +++ b/plugins/kv/memory/plugin_unit_test.go @@ -266,7 +266,7 @@ func TestStorage_MExpire_TTL(t *testing.T) { } assert.NoError(t, s.MExpire(i1, i2)) - time.Sleep(time.Second * 6) + time.Sleep(time.Second * 7) // ensure that storage is clean v, err = s.Has("key", "key2") @@ -428,7 +428,7 @@ func TestConcurrentReadWriteTransactions(t *testing.T) { // concurrently set the keys go func(s kv.Storage) { defer wg.Done() - for i := 0; i <= 1000; i++ { + for i := 0; i <= 100; i++ { m.Lock() // set is writable transaction // it should stop readable @@ -448,7 +448,7 @@ func TestConcurrentReadWriteTransactions(t *testing.T) { // should be no errors go func(s kv.Storage) { defer wg.Done() - for i := 0; i <= 1000; i++ { + for i := 0; i <= 100; i++ { m.RLock() v, err = s.Has("key") assert.NoError(t, err) @@ -461,7 +461,7 @@ func TestConcurrentReadWriteTransactions(t *testing.T) { // should be no errors go func(s kv.Storage) { defer wg.Done() - for i := 0; i <= 1000; i++ { + for i := 0; i <= 100; i++ { m.Lock() err = s.Delete("key" + strconv.Itoa(i)) assert.NoError(t, err) diff --git a/plugins/server/config.go b/plugins/server/config.go index 93b19226..92e6780a 100644 --- a/plugins/server/config.go +++ b/plugins/server/config.go @@ -23,7 +23,7 @@ type Config struct { Relay string `mapstructure:"relay"` // RelayTimeout defines for how long socket factory will be waiting for worker connection. This config section // must not change on re-configuration. Defaults to 60s. - RelayTimeout time.Duration `mapstructure:"relayTimeout"` + RelayTimeout time.Duration `mapstructure:"relay_timeout"` } `mapstructure:"server"` RPC *struct { diff --git a/tests/plugins/checker/configs/.rr-checker-init.yaml b/tests/plugins/checker/configs/.rr-checker-init.yaml index 1273529a..36130382 100755 --- a/tests/plugins/checker/configs/.rr-checker-init.yaml +++ b/tests/plugins/checker/configs/.rr-checker-init.yaml @@ -9,7 +9,7 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" status: address: "127.0.0.1:34333" @@ -19,13 +19,13 @@ logs: http: debug: true address: 127.0.0.1:11933 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s
\ No newline at end of file + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s
\ No newline at end of file diff --git a/tests/plugins/gzip/configs/.rr-http-middlewareNotExist.yaml b/tests/plugins/gzip/configs/.rr-http-middlewareNotExist.yaml index a2d12706..b900ff30 100644 --- a/tests/plugins/gzip/configs/.rr-http-middlewareNotExist.yaml +++ b/tests/plugins/gzip/configs/.rr-http-middlewareNotExist.yaml @@ -5,21 +5,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:18103 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "gzip", "foo" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/gzip/configs/.rr-http-withGzip.yaml b/tests/plugins/gzip/configs/.rr-http-withGzip.yaml index aff3efdb..3ab918fb 100644 --- a/tests/plugins/gzip/configs/.rr-http-withGzip.yaml +++ b/tests/plugins/gzip/configs/.rr-http-withGzip.yaml @@ -5,21 +5,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:18953 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "gzip" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/headers/configs/.rr-cors-headers.yaml b/tests/plugins/headers/configs/.rr-cors-headers.yaml index 9d4e8b36..2e16ee66 100644 --- a/tests/plugins/headers/configs/.rr-cors-headers.yaml +++ b/tests/plugins/headers/configs/.rr-cors-headers.yaml @@ -5,16 +5,16 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:22855 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "headers" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] # Additional HTTP headers and CORS control. headers: cors: @@ -29,10 +29,10 @@ http: response: "output": "output-header" pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/headers/configs/.rr-headers-init.yaml b/tests/plugins/headers/configs/.rr-headers-init.yaml index 8d63a187..55b5b5a8 100644 --- a/tests/plugins/headers/configs/.rr-headers-init.yaml +++ b/tests/plugins/headers/configs/.rr-headers-init.yaml @@ -5,16 +5,16 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:33453 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "headers" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] # Additional HTTP headers and CORS control. headers: cors: @@ -29,10 +29,10 @@ http: response: "X-Powered-By": "RoadRunner" pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/headers/configs/.rr-req-headers.yaml b/tests/plugins/headers/configs/.rr-req-headers.yaml index f8ab9bec..fc38a74b 100644 --- a/tests/plugins/headers/configs/.rr-req-headers.yaml +++ b/tests/plugins/headers/configs/.rr-req-headers.yaml @@ -5,16 +5,16 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:22655 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "headers" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] # Additional HTTP headers and CORS control. headers: request: @@ -22,10 +22,10 @@ http: response: "output": "output-header" pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/headers/configs/.rr-res-headers.yaml b/tests/plugins/headers/configs/.rr-res-headers.yaml index 36ab4eb3..be9cfead 100644 --- a/tests/plugins/headers/configs/.rr-res-headers.yaml +++ b/tests/plugins/headers/configs/.rr-res-headers.yaml @@ -5,16 +5,16 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:22455 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "headers" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] # Additional HTTP headers and CORS control. headers: request: @@ -22,10 +22,10 @@ http: response: "output": "output-header" pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/http/configs/.rr-broken-pipes.yaml b/tests/plugins/http/configs/.rr-broken-pipes.yaml index 8006cb5f..bfcbf592 100644 --- a/tests/plugins/http/configs/.rr-broken-pipes.yaml +++ b/tests/plugins/http/configs/.rr-broken-pipes.yaml @@ -9,21 +9,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:12384 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/http/configs/.rr-env.yaml b/tests/plugins/http/configs/.rr-env.yaml index 1cce5dab..219bad19 100644 --- a/tests/plugins/http/configs/.rr-env.yaml +++ b/tests/plugins/http/configs/.rr-env.yaml @@ -9,24 +9,24 @@ server: env: "env_key": "ENV_VALUE" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:12084 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] env: "RR_HTTP": "true" "env_key": "ENV_VALUE" uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/http/configs/.rr-fcgi-reqUri.yaml b/tests/plugins/http/configs/.rr-fcgi-reqUri.yaml index 725ae724..99002777 100644 --- a/tests/plugins/http/configs/.rr-fcgi-reqUri.yaml +++ b/tests/plugins/http/configs/.rr-fcgi-reqUri.yaml @@ -5,21 +5,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: :8082 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 1 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 1 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s ssl: port: 8890 diff --git a/tests/plugins/http/configs/.rr-fcgi.yaml b/tests/plugins/http/configs/.rr-fcgi.yaml index ba119a88..110b68f4 100644 --- a/tests/plugins/http/configs/.rr-fcgi.yaml +++ b/tests/plugins/http/configs/.rr-fcgi.yaml @@ -5,21 +5,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: :8081 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 1 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 1 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s ssl: port: 8889 diff --git a/tests/plugins/http/configs/.rr-h2c.yaml b/tests/plugins/http/configs/.rr-h2c.yaml index 287b7929..c2703182 100644 --- a/tests/plugins/http/configs/.rr-h2c.yaml +++ b/tests/plugins/http/configs/.rr-h2c.yaml @@ -5,21 +5,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: :8083 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 1 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 1 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s http2: enabled: true h2c: true diff --git a/tests/plugins/http/configs/.rr-http.yaml b/tests/plugins/http/configs/.rr-http.yaml index 93f131f8..30d31819 100644 --- a/tests/plugins/http/configs/.rr-http.yaml +++ b/tests/plugins/http/configs/.rr-http.yaml @@ -9,21 +9,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:18903 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "pluginMiddleware", "pluginMiddleware2" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/http/configs/.rr-init.yaml b/tests/plugins/http/configs/.rr-init.yaml index 79303eab..b541e6de 100644 --- a/tests/plugins/http/configs/.rr-init.yaml +++ b/tests/plugins/http/configs/.rr-init.yaml @@ -9,21 +9,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:15395 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s ssl: port: 8892 diff --git a/tests/plugins/http/configs/.rr-resetter.yaml b/tests/plugins/http/configs/.rr-resetter.yaml index e2edafc6..88c54858 100644 --- a/tests/plugins/http/configs/.rr-resetter.yaml +++ b/tests/plugins/http/configs/.rr-resetter.yaml @@ -9,21 +9,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:10084 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/http/configs/.rr-ssl-push.yaml b/tests/plugins/http/configs/.rr-ssl-push.yaml index 81699a21..ae9fbc02 100644 --- a/tests/plugins/http/configs/.rr-ssl-push.yaml +++ b/tests/plugins/http/configs/.rr-ssl-push.yaml @@ -5,21 +5,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: :8086 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 1 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 1 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s ssl: port: 8894 diff --git a/tests/plugins/http/configs/.rr-ssl-redirect.yaml b/tests/plugins/http/configs/.rr-ssl-redirect.yaml index fe6c5a86..d052e649 100644 --- a/tests/plugins/http/configs/.rr-ssl-redirect.yaml +++ b/tests/plugins/http/configs/.rr-ssl-redirect.yaml @@ -5,21 +5,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: :8087 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 1 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 1 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s ssl: port: 8895 diff --git a/tests/plugins/http/configs/.rr-ssl.yaml b/tests/plugins/http/configs/.rr-ssl.yaml index 3255383a..182ac7ef 100644 --- a/tests/plugins/http/configs/.rr-ssl.yaml +++ b/tests/plugins/http/configs/.rr-ssl.yaml @@ -5,21 +5,21 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: :8085 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "" ] uploads: forbid: [ ".php", ".exe", ".bat" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] pool: - numWorkers: 1 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 1 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s ssl: port: 8893 diff --git a/tests/plugins/informer/.rr-informer.yaml b/tests/plugins/informer/.rr-informer.yaml index e50ca9c9..e5853b21 100644 --- a/tests/plugins/informer/.rr-informer.yaml +++ b/tests/plugins/informer/.rr-informer.yaml @@ -6,7 +6,7 @@ server: "RR_CONFIG": "/some/place/on/the/C134" "RR_CONFIG2": "C138" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" rpc: listen: tcp://127.0.0.1:6001 diff --git a/tests/plugins/kv/boltdb/configs/.rr-init.yaml b/tests/plugins/kv/boltdb/configs/.rr-init.yaml index 4629a24b..8cfa20e9 100644 --- a/tests/plugins/kv/boltdb/configs/.rr-init.yaml +++ b/tests/plugins/kv/boltdb/configs/.rr-init.yaml @@ -9,7 +9,7 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" logs: mode: development @@ -17,11 +17,11 @@ logs: http: address: 127.0.0.1:44933 - maxRequestSize: 1024 + max_request_size: 1024 middleware: ["gzip", "headers"] uploads: forbid: [".php", ".exe", ".bat"] - trustedSubnets: + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", @@ -32,10 +32,10 @@ http: "fe80::/10", ] pool: - numWorkers: 6 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 6 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s # boltdb simple driver boltdb: diff --git a/tests/plugins/kv/memcached/configs/.rr-init.yaml b/tests/plugins/kv/memcached/configs/.rr-init.yaml index 759fc3ba..66ed75cf 100644 --- a/tests/plugins/kv/memcached/configs/.rr-init.yaml +++ b/tests/plugins/kv/memcached/configs/.rr-init.yaml @@ -9,7 +9,7 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" logs: mode: development @@ -17,11 +17,11 @@ logs: http: address: 127.0.0.1:44933 - maxRequestSize: 1024 + max_request_size: 1024 middleware: ["gzip", "headers"] uploads: forbid: [".php", ".exe", ".bat"] - trustedSubnets: + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", @@ -32,10 +32,10 @@ http: "fe80::/10", ] pool: - numWorkers: 6 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 6 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s # boltdb simple driver memcached: diff --git a/tests/plugins/kv/memory/configs/.rr-init.yaml b/tests/plugins/kv/memory/configs/.rr-init.yaml index dedc6cd2..e352fad2 100644 --- a/tests/plugins/kv/memory/configs/.rr-init.yaml +++ b/tests/plugins/kv/memory/configs/.rr-init.yaml @@ -9,7 +9,7 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" logs: mode: development @@ -17,11 +17,11 @@ logs: http: address: 127.0.0.1:44933 - maxRequestSize: 1024 + max_request_size: 1024 middleware: ["gzip", "headers"] uploads: forbid: [".php", ".exe", ".bat"] - trustedSubnets: + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", @@ -32,10 +32,10 @@ http: "fe80::/10", ] pool: - numWorkers: 6 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 6 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s # in memory KV driver memory: diff --git a/tests/plugins/reload/configs/.rr-reload-2.yaml b/tests/plugins/reload/configs/.rr-reload-2.yaml index ab32b2d1..882ab628 100644 --- a/tests/plugins/reload/configs/.rr-reload-2.yaml +++ b/tests/plugins/reload/configs/.rr-reload-2.yaml @@ -5,11 +5,11 @@ server: env: RR_HTTP: 'true' relay: pipes - relayTimeout: 20s + relay_timeout: 20s http: debug: true address: '127.0.0.1:27388' - maxRequestSize: 1024 + max_request_size: 1024 middleware: - '' uploads: @@ -17,7 +17,7 @@ http: - .php - .exe - .bat - trustedSubnets: + trusted_subnets: - 10.0.0.0/8 - 127.0.0.0/8 - 172.16.0.0/12 @@ -26,10 +26,10 @@ http: - 'fc00::/7' - 'fe80::/10' pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/reload/configs/.rr-reload-3.yaml b/tests/plugins/reload/configs/.rr-reload-3.yaml index 881d9b88..4f964609 100644 --- a/tests/plugins/reload/configs/.rr-reload-3.yaml +++ b/tests/plugins/reload/configs/.rr-reload-3.yaml @@ -5,11 +5,11 @@ server: env: RR_HTTP: 'true' relay: pipes - relayTimeout: 20s + relay_timeout: 20s http: debug: true address: '127.0.0.1:37388' - maxRequestSize: 1024 + max_request_size: 1024 middleware: - '' uploads: @@ -17,7 +17,7 @@ http: - .php - .exe - .bat - trustedSubnets: + trusted_subnets: - 10.0.0.0/8 - 127.0.0.0/8 - 172.16.0.0/12 @@ -26,10 +26,10 @@ http: - 'fc00::/7' - 'fe80::/10' pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/reload/configs/.rr-reload-4.yaml b/tests/plugins/reload/configs/.rr-reload-4.yaml index d47df558..76966e49 100644 --- a/tests/plugins/reload/configs/.rr-reload-4.yaml +++ b/tests/plugins/reload/configs/.rr-reload-4.yaml @@ -5,11 +5,11 @@ server: env: RR_HTTP: 'true' relay: pipes - relayTimeout: 20s + relay_timeout: 20s http: debug: true address: '127.0.0.1:22766' - maxRequestSize: 1024 + max_request_size: 1024 middleware: - '' uploads: @@ -17,7 +17,7 @@ http: - .php - .exe - .bat - trustedSubnets: + trusted_subnets: - 10.0.0.0/8 - 127.0.0.0/8 - 172.16.0.0/12 @@ -26,10 +26,10 @@ http: - 'fc00::/7' - 'fe80::/10' pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/reload/configs/.rr-reload.yaml b/tests/plugins/reload/configs/.rr-reload.yaml index 794c41f2..5dfb1171 100644 --- a/tests/plugins/reload/configs/.rr-reload.yaml +++ b/tests/plugins/reload/configs/.rr-reload.yaml @@ -5,11 +5,11 @@ server: env: RR_HTTP: 'true' relay: pipes - relayTimeout: 20s + relay_timeout: 20s http: debug: true address: '127.0.0.1:22388' - maxRequestSize: 1024 + max_request_size: 1024 middleware: - '' uploads: @@ -17,7 +17,7 @@ http: - .php - .exe - .bat - trustedSubnets: + trusted_subnets: - 10.0.0.0/8 - 127.0.0.0/8 - 172.16.0.0/12 @@ -26,10 +26,10 @@ http: - 'fc00::/7' - 'fe80::/10' pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error diff --git a/tests/plugins/resetter/.rr-resetter.yaml b/tests/plugins/resetter/.rr-resetter.yaml index e50ca9c9..e5853b21 100644 --- a/tests/plugins/resetter/.rr-resetter.yaml +++ b/tests/plugins/resetter/.rr-resetter.yaml @@ -6,7 +6,7 @@ server: "RR_CONFIG": "/some/place/on/the/C134" "RR_CONFIG2": "C138" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" rpc: listen: tcp://127.0.0.1:6001 diff --git a/tests/plugins/server/configs/.rr-no-app-section.yaml b/tests/plugins/server/configs/.rr-no-app-section.yaml index 4888d249..e44eeb56 100644 --- a/tests/plugins/server/configs/.rr-no-app-section.yaml +++ b/tests/plugins/server/configs/.rr-no-app-section.yaml @@ -6,7 +6,7 @@ server: "RR_CONFIG": "/some/place/on/the/C134" "RR_CONFIG2": "C138" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/server/configs/.rr-sockets.yaml b/tests/plugins/server/configs/.rr-sockets.yaml index 6b5b6bf5..0bc2d0f9 100644 --- a/tests/plugins/server/configs/.rr-sockets.yaml +++ b/tests/plugins/server/configs/.rr-sockets.yaml @@ -6,7 +6,7 @@ server: "RR_CONFIG": "/some/place/on/the/C134" "RR_CONFIG2": "C138" relay: "unix://unix.sock" - relayTimeout: "20s" + relay_timeout: "20s" logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/server/configs/.rr-tcp.yaml b/tests/plugins/server/configs/.rr-tcp.yaml index ee1d450a..f4580460 100644 --- a/tests/plugins/server/configs/.rr-tcp.yaml +++ b/tests/plugins/server/configs/.rr-tcp.yaml @@ -6,7 +6,7 @@ server: "RR_CONFIG": "/some/place/on/the/C134" "RR_CONFIG2": "C138" relay: "tcp://localhost:9999" - relayTimeout: "20s" + relay_timeout: "20s" logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/server/configs/.rr-wrong-command.yaml b/tests/plugins/server/configs/.rr-wrong-command.yaml index e66349dd..c97d8b7e 100644 --- a/tests/plugins/server/configs/.rr-wrong-command.yaml +++ b/tests/plugins/server/configs/.rr-wrong-command.yaml @@ -6,7 +6,7 @@ server: "RR_CONFIG": "/some/place/on/the/C134" "RR_CONFIG2": "C138" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/server/configs/.rr-wrong-relay.yaml b/tests/plugins/server/configs/.rr-wrong-relay.yaml index 6f532c3f..9722a487 100644 --- a/tests/plugins/server/configs/.rr-wrong-relay.yaml +++ b/tests/plugins/server/configs/.rr-wrong-relay.yaml @@ -6,7 +6,7 @@ server: "RR_CONFIG": "/some/place/on/the/C134" "RR_CONFIG2": "C138" relay: "pupes" - relayTimeout: "20s" + relay_timeout: "20s" logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/server/configs/.rr.yaml b/tests/plugins/server/configs/.rr.yaml index 4888d249..e44eeb56 100644 --- a/tests/plugins/server/configs/.rr.yaml +++ b/tests/plugins/server/configs/.rr.yaml @@ -6,7 +6,7 @@ server: "RR_CONFIG": "/some/place/on/the/C134" "RR_CONFIG2": "C138" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/static/configs/.rr-http-static-disabled.yaml b/tests/plugins/static/configs/.rr-http-static-disabled.yaml index d8ee15e0..e31baffc 100644 --- a/tests/plugins/static/configs/.rr-http-static-disabled.yaml +++ b/tests/plugins/static/configs/.rr-http-static-disabled.yaml @@ -5,14 +5,14 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:21234 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "gzip", "static" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] uploads: forbid: [ ".php", ".exe", ".bat" ] static: @@ -24,10 +24,10 @@ http: response: "X-Powered-By": "RoadRunner" pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/static/configs/.rr-http-static-files-disable.yaml b/tests/plugins/static/configs/.rr-http-static-files-disable.yaml index 563d95cf..deb408db 100644 --- a/tests/plugins/static/configs/.rr-http-static-files-disable.yaml +++ b/tests/plugins/static/configs/.rr-http-static-files-disable.yaml @@ -5,14 +5,14 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:45877 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "gzip", "static" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] uploads: forbid: [ ".php", ".exe", ".bat" ] static: @@ -24,10 +24,10 @@ http: response: "X-Powered-By": "RoadRunner" pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/static/configs/.rr-http-static-files.yaml b/tests/plugins/static/configs/.rr-http-static-files.yaml index 8961c6f4..deb1f253 100644 --- a/tests/plugins/static/configs/.rr-http-static-files.yaml +++ b/tests/plugins/static/configs/.rr-http-static-files.yaml @@ -5,14 +5,14 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: debug: true address: 127.0.0.1:34653 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "gzip", "static" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] uploads: forbid: [ ".php", ".exe", ".bat" ] static: @@ -25,10 +25,10 @@ http: response: "X-Powered-By": "RoadRunner" pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error
\ No newline at end of file diff --git a/tests/plugins/static/configs/.rr-http-static.yaml b/tests/plugins/static/configs/.rr-http-static.yaml index 0a1f5df4..e5af9043 100644 --- a/tests/plugins/static/configs/.rr-http-static.yaml +++ b/tests/plugins/static/configs/.rr-http-static.yaml @@ -5,13 +5,13 @@ server: env: "RR_HTTP": "true" relay: "pipes" - relayTimeout: "20s" + relay_timeout: "20s" http: address: 127.0.0.1:21603 - maxRequestSize: 1024 + max_request_size: 1024 middleware: [ "gzip", "static" ] - trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] uploads: forbid: [ ".php", ".exe", ".bat" ] static: @@ -22,10 +22,10 @@ http: response: "output": "output-header" pool: - numWorkers: 2 - maxJobs: 0 - allocateTimeout: 60s - destroyTimeout: 60s + num_workers: 2 + max_jobs: 0 + allocate_timeout: 60s + destroy_timeout: 60s logs: mode: development level: error
\ No newline at end of file |