diff options
author | Valery Piashchynski <[email protected]> | 2021-09-16 17:35:58 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-09-16 17:35:58 +0300 |
commit | 44d0b505031e8f042783792883021f21fcba5f72 (patch) | |
tree | 610127f4d154504b9d8277b29de5abd4a0f9caca | |
parent | 97af4564de9a782045d1e789530e17cd595e6c10 (diff) |
Fix testsv2.5.0-alpha.1
Signed-off-by: Valery Piashchynski <[email protected]>
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | pool/static_pool_test.go | 44 | ||||
-rw-r--r-- | pool/supervisor_test.go | 18 | ||||
-rw-r--r-- | transport/pipe/pipe_factory_spawn_test.go | 44 | ||||
-rwxr-xr-x | transport/pipe/pipe_factory_test.go | 44 | ||||
-rw-r--r-- | transport/socket/socket_factory_spawn_test.go | 34 | ||||
-rwxr-xr-x | transport/socket/socket_factory_test.go | 36 |
7 files changed, 110 insertions, 114 deletions
@@ -5,7 +5,6 @@ SHELL = /bin/sh test_coverage: - docker-compose -f tests/env/docker-compose.yaml up -d --remove-orphans rm -rf coverage-ci mkdir ./coverage-ci go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipe.out -covermode=atomic ./transport/pipe @@ -17,10 +16,8 @@ test_coverage: go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/worker_stack.out -covermode=atomic ./worker_watcher echo 'mode: atomic' > ./coverage-ci/summary.txt tail -q -n +2 ./coverage-ci/*.out >> ./coverage-ci/summary.txt - docker-compose -f tests/env/docker-compose.yaml down test: ## Run application tests - docker-compose -f tests/env/docker-compose.yaml up -d go test -v -race -tags=debug ./transport/pipe go test -v -race -tags=debug ./transport/socket go test -v -race -tags=debug ./pool @@ -28,4 +25,3 @@ test: ## Run application tests go test -v -race -tags=debug ./worker_watcher go test -v -race -tags=debug ./bst go test -v -race -tags=debug ./priority_queue - docker-compose -f tests/env/docker-compose.yaml down diff --git a/pool/static_pool_test.go b/pool/static_pool_test.go index 29b0fc56..9861f0d8 100755 --- a/pool/static_pool_test.go +++ b/pool/static_pool_test.go @@ -30,7 +30,7 @@ func Test_NewPool(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "echo", "pipes") }, pipe.NewPipeFactory(), cfg, ) @@ -44,7 +44,7 @@ func Test_NewPool(t *testing.T) { func Test_StaticPool_Invalid(t *testing.T) { p, err := Initialize( context.Background(), - func() *exec.Cmd { return exec.Command("php", "../../tests/invalid.php") }, + func() *exec.Cmd { return exec.Command("php", "../tests/invalid.php") }, pipe.NewPipeFactory(), cfg, ) @@ -56,7 +56,7 @@ func Test_StaticPool_Invalid(t *testing.T) { func Test_ConfigNoErrorInitDefaults(t *testing.T) { p, err := Initialize( context.Background(), - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "echo", "pipes") }, pipe.NewPipeFactory(), &Config{ AllocateTimeout: time.Second, @@ -72,7 +72,7 @@ func Test_StaticPool_Echo(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "echo", "pipes") }, pipe.NewPipeFactory(), cfg, ) @@ -96,7 +96,7 @@ func Test_StaticPool_Echo_NilContext(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "echo", "pipes") }, pipe.NewPipeFactory(), cfg, ) @@ -120,7 +120,7 @@ func Test_StaticPool_Echo_Context(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "head", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "head", "pipes") }, pipe.NewPipeFactory(), cfg, ) @@ -144,7 +144,7 @@ func Test_StaticPool_JobError(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "error", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "error", "pipes") }, pipe.NewPipeFactory(), cfg, ) @@ -183,7 +183,7 @@ func Test_StaticPool_Broken_Replace(t *testing.T) { p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "broken", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "broken", "pipes") }, pipe.NewPipeFactory(), cfg, AddListeners(listener), @@ -221,7 +221,7 @@ func Test_StaticPool_Broken_FromOutside(t *testing.T) { p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "echo", "pipes") }, pipe.NewPipeFactory(), cfg2, AddListeners(listener), @@ -261,7 +261,7 @@ func Test_StaticPool_Broken_FromOutside(t *testing.T) { func Test_StaticPool_AllocateTimeout(t *testing.T) { p, err := Initialize( context.Background(), - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "delay", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "delay", "pipes") }, pipe.NewPipeFactory(), &Config{ NumWorkers: 1, @@ -280,7 +280,7 @@ func Test_StaticPool_Replace_Worker(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "pid", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "pid", "pipes") }, pipe.NewPipeFactory(), &Config{ NumWorkers: 1, @@ -319,7 +319,7 @@ func Test_StaticPool_Debug_Worker(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "pid", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "pid", "pipes") }, pipe.NewPipeFactory(), &Config{ Debug: true, @@ -361,7 +361,7 @@ func Test_StaticPool_Stop_Worker(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "stop", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "stop", "pipes") }, pipe.NewPipeFactory(), &Config{ NumWorkers: 1, @@ -402,7 +402,7 @@ func Test_Static_Pool_Destroy_And_Close(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "delay", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "delay", "pipes") }, pipe.NewPipeFactory(), &Config{ NumWorkers: 1, @@ -424,7 +424,7 @@ func Test_Static_Pool_Destroy_And_Close_While_Wait(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "delay", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "delay", "pipes") }, pipe.NewPipeFactory(), &Config{ NumWorkers: 1, @@ -454,7 +454,7 @@ func Test_Static_Pool_Handle_Dead(t *testing.T) { ctx := context.Background() p, err := Initialize( context.Background(), - func() *exec.Cmd { return exec.Command("php", "../../tests/slow-destroy.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/slow-destroy.php", "echo", "pipes") }, pipe.NewPipeFactory(), &Config{ NumWorkers: 5, @@ -479,7 +479,7 @@ func Test_Static_Pool_Handle_Dead(t *testing.T) { func Test_Static_Pool_Slow_Destroy(t *testing.T) { p, err := Initialize( context.Background(), - func() *exec.Cmd { return exec.Command("php", "../../tests/slow-destroy.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/slow-destroy.php", "echo", "pipes") }, pipe.NewPipeFactory(), &Config{ NumWorkers: 5, @@ -509,7 +509,7 @@ func Test_StaticPool_NoFreeWorkers(t *testing.T) { p, err := Initialize( ctx, // sleep for the 3 seconds - func() *exec.Cmd { return exec.Command("php", "../../tests/sleep.php", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/sleep.php", "pipes") }, pipe.NewPipeFactory(), &Config{ Debug: false, @@ -541,7 +541,7 @@ func Test_StaticPool_NoFreeWorkers(t *testing.T) { func Test_Static_Pool_WrongCommand1(t *testing.T) { p, err := Initialize( context.Background(), - func() *exec.Cmd { return exec.Command("phg", "../../tests/slow-destroy.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("phg", "../tests/slow-destroy.php", "echo", "pipes") }, pipe.NewPipeFactory(), &Config{ NumWorkers: 5, @@ -593,7 +593,7 @@ func Benchmark_Pool_Echo(b *testing.B) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "echo", "pipes") }, pipe.NewPipeFactory(), cfg, ) @@ -625,7 +625,7 @@ func Benchmark_Pool_Echo_Batched(b *testing.B) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "echo", "pipes") }, pipe.NewPipeFactory(), &Config{ NumWorkers: uint64(runtime.NumCPU()), @@ -667,7 +667,7 @@ func Benchmark_Pool_Echo_Replaced(b *testing.B) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/client.php", "echo", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "echo", "pipes") }, pipe.NewPipeFactory(), &Config{ NumWorkers: 1, diff --git a/pool/supervisor_test.go b/pool/supervisor_test.go index e76c7ec4..032e220b 100644 --- a/pool/supervisor_test.go +++ b/pool/supervisor_test.go @@ -32,7 +32,7 @@ func TestSupervisedPool_Exec(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/memleak.php", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/memleak.php", "pipes") }, pipe.NewPipeFactory(), cfgSupervised, ) @@ -66,7 +66,7 @@ func TestSupervisedPool_ExecWithDebugMode(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/supervised.php") }, + func() *exec.Cmd { return exec.Command("php", "../tests/supervised.php") }, pipe.NewPipeFactory(), cfgSupervised, ) @@ -104,7 +104,7 @@ func TestSupervisedPool_ExecTTL_TimedOut(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/sleep.php", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/sleep.php", "pipes") }, pipe.NewPipeFactory(), cfgExecTTL, ) @@ -139,7 +139,7 @@ func TestSupervisedPool_ExecTTL_WorkerRestarted(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/sleep-ttl.php") }, + func() *exec.Cmd { return exec.Command("php", "../tests/sleep-ttl.php") }, pipe.NewPipeFactory(), cfgExecTTL, ) @@ -196,7 +196,7 @@ func TestSupervisedPool_Idle(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/idle.php", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/idle.php", "pipes") }, pipe.NewPipeFactory(), cfgExecTTL, ) @@ -243,7 +243,7 @@ func TestSupervisedPool_IdleTTL_StateAfterTimeout(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/exec_ttl.php", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/exec_ttl.php", "pipes") }, pipe.NewPipeFactory(), cfgExecTTL, ) @@ -286,7 +286,7 @@ func TestSupervisedPool_ExecTTL_OK(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/exec_ttl.php", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/exec_ttl.php", "pipes") }, pipe.NewPipeFactory(), cfgExecTTL, ) @@ -341,7 +341,7 @@ func TestSupervisedPool_MaxMemoryReached(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/memleak.php", "pipes") }, + func() *exec.Cmd { return exec.Command("php", "../tests/memleak.php", "pipes") }, pipe.NewPipeFactory(), cfgExecTTL, AddListeners(listener), @@ -377,7 +377,7 @@ func TestSupervisedPool_AllocateFailedOK(t *testing.T) { ctx := context.Background() p, err := Initialize( ctx, - func() *exec.Cmd { return exec.Command("php", "../../tests/allocate-failed.php") }, + func() *exec.Cmd { return exec.Command("php", "../tests/allocate-failed.php") }, pipe.NewPipeFactory(), cfgExecTTL, ) diff --git a/transport/pipe/pipe_factory_spawn_test.go b/transport/pipe/pipe_factory_spawn_test.go index 20708d45..45b7aef8 100644 --- a/transport/pipe/pipe_factory_spawn_test.go +++ b/transport/pipe/pipe_factory_spawn_test.go @@ -15,7 +15,7 @@ import ( ) func Test_GetState2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorker(cmd) go func() { @@ -31,7 +31,7 @@ func Test_GetState2(t *testing.T) { } func Test_Kill2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorker(cmd) wg := &sync.WaitGroup{} @@ -54,7 +54,7 @@ func Test_Kill2(t *testing.T) { } func Test_Pipe_Start2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorker(cmd) assert.NoError(t, err) @@ -68,7 +68,7 @@ func Test_Pipe_Start2(t *testing.T) { } func Test_Pipe_StartError2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") err := cmd.Start() if err != nil { t.Errorf("error running the command: error %v", err) @@ -80,7 +80,7 @@ func Test_Pipe_StartError2(t *testing.T) { } func Test_Pipe_PipeError3(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + 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) @@ -92,7 +92,7 @@ func Test_Pipe_PipeError3(t *testing.T) { } func Test_Pipe_PipeError4(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + 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) @@ -104,7 +104,7 @@ func Test_Pipe_PipeError4(t *testing.T) { } func Test_Pipe_Failboot2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/failboot.php") + cmd := exec.Command("php", "../../tests/failboot.php") finish := make(chan struct{}, 10) listener := func(event interface{}) { if ev, ok := event.(events.WorkerEvent); ok { @@ -123,14 +123,14 @@ func Test_Pipe_Failboot2(t *testing.T) { } func Test_Pipe_Invalid2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/invalid.php") + 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") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorker(cmd) if err != nil { t.Fatal(err) @@ -155,7 +155,7 @@ func Test_Pipe_Echo2(t *testing.T) { } func Test_Pipe_Broken2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "broken", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "broken", "pipes") w, err := NewPipeFactory().SpawnWorker(cmd) if err != nil { t.Fatal(err) @@ -177,7 +177,7 @@ func Test_Pipe_Broken2(t *testing.T) { 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") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, _ := f.SpawnWorker(cmd) go func() { if w.Wait() != nil { @@ -193,7 +193,7 @@ func Benchmark_Pipe_SpawnWorker_Stop2(b *testing.B) { } func Benchmark_Pipe_Worker_ExecEcho2(b *testing.B) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, _ := NewPipeFactory().SpawnWorker(cmd) sw := worker.From(w) @@ -221,7 +221,7 @@ func Benchmark_Pipe_Worker_ExecEcho2(b *testing.B) { } func Benchmark_Pipe_Worker_ExecEcho4(b *testing.B) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorker(cmd) if err != nil { b.Fatal(err) @@ -244,7 +244,7 @@ func Benchmark_Pipe_Worker_ExecEcho4(b *testing.B) { } func Benchmark_Pipe_Worker_ExecEchoWithoutContext2(b *testing.B) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorker(cmd) if err != nil { b.Fatal(err) @@ -267,7 +267,7 @@ func Benchmark_Pipe_Worker_ExecEchoWithoutContext2(b *testing.B) { } func Test_Echo2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorker(cmd) if err != nil { @@ -297,7 +297,7 @@ func Test_Echo2(t *testing.T) { } func Test_BadPayload2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, _ := NewPipeFactory().SpawnWorker(cmd) @@ -322,7 +322,7 @@ func Test_BadPayload2(t *testing.T) { } func Test_String2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, _ := NewPipeFactory().SpawnWorker(cmd) go func() { @@ -335,13 +335,13 @@ func Test_String2(t *testing.T) { } }() - assert.Contains(t, w.String(), "php ../../../tests/client.php echo pipes") + 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") + cmd := exec.Command("php", "../../tests/slow-client.php", "echo", "pipes", "10", "10") w, _ := NewPipeFactory().SpawnWorker(cmd) go func() { @@ -367,7 +367,7 @@ func Test_Echo_Slow2(t *testing.T) { } func Test_Broken2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "broken", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "broken", "pipes") data := "" mu := &sync.Mutex{} listener := func(event interface{}) { @@ -399,7 +399,7 @@ func Test_Broken2(t *testing.T) { } func Test_Error2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "error", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "error", "pipes") w, _ := NewPipeFactory().SpawnWorker(cmd) go func() { @@ -426,7 +426,7 @@ func Test_Error2(t *testing.T) { } func Test_NumExecs2(t *testing.T) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, _ := NewPipeFactory().SpawnWorker(cmd) go func() { diff --git a/transport/pipe/pipe_factory_test.go b/transport/pipe/pipe_factory_test.go index c999eadd..f8198610 100755 --- a/transport/pipe/pipe_factory_test.go +++ b/transport/pipe/pipe_factory_test.go @@ -18,7 +18,7 @@ import ( func Test_GetState(t *testing.T) { t.Parallel() ctx := context.Background() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) go func() { @@ -39,7 +39,7 @@ func Test_GetState(t *testing.T) { func Test_Kill(t *testing.T) { t.Parallel() ctx := context.Background() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) wg := &sync.WaitGroup{} @@ -64,7 +64,7 @@ func Test_Kill(t *testing.T) { func Test_Pipe_Start(t *testing.T) { t.Parallel() ctx := context.Background() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) assert.NoError(t, err) @@ -79,7 +79,7 @@ func Test_Pipe_Start(t *testing.T) { func Test_Pipe_StartError(t *testing.T) { t.Parallel() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") err := cmd.Start() if err != nil { t.Errorf("error running the command: error %v", err) @@ -93,7 +93,7 @@ func Test_Pipe_StartError(t *testing.T) { func Test_Pipe_PipeError(t *testing.T) { t.Parallel() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + 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) @@ -107,7 +107,7 @@ func Test_Pipe_PipeError(t *testing.T) { func Test_Pipe_PipeError2(t *testing.T) { t.Parallel() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") // error cause _, err := cmd.StdinPipe() if err != nil { @@ -122,7 +122,7 @@ func Test_Pipe_PipeError2(t *testing.T) { func Test_Pipe_Failboot(t *testing.T) { t.Parallel() - cmd := exec.Command("php", "../../../tests/failboot.php") + cmd := exec.Command("php", "../../tests/failboot.php") ctx := context.Background() finish := make(chan struct{}, 10) @@ -145,7 +145,7 @@ func Test_Pipe_Failboot(t *testing.T) { func Test_Pipe_Invalid(t *testing.T) { t.Parallel() - cmd := exec.Command("php", "../../../tests/invalid.php") + cmd := exec.Command("php", "../../tests/invalid.php") ctx := context.Background() w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) assert.Error(t, err) @@ -154,7 +154,7 @@ func Test_Pipe_Invalid(t *testing.T) { func Test_Pipe_Echo(t *testing.T) { t.Parallel() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") ctx := context.Background() w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) if err != nil { @@ -181,7 +181,7 @@ func Test_Pipe_Echo(t *testing.T) { func Test_Pipe_Broken(t *testing.T) { t.Parallel() - cmd := exec.Command("php", "../../../tests/client.php", "broken", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "broken", "pipes") ctx := context.Background() w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) if err != nil { @@ -204,7 +204,7 @@ func Test_Pipe_Broken(t *testing.T) { func Benchmark_Pipe_SpawnWorker_Stop(b *testing.B) { f := NewPipeFactory() for n := 0; n < b.N; n++ { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, _ := f.SpawnWorkerWithTimeout(context.Background(), cmd) go func() { if w.Wait() != nil { @@ -220,7 +220,7 @@ func Benchmark_Pipe_SpawnWorker_Stop(b *testing.B) { } func Benchmark_Pipe_Worker_ExecEcho(b *testing.B) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, _ := NewPipeFactory().SpawnWorkerWithTimeout(context.Background(), cmd) sw := worker.From(w) @@ -248,7 +248,7 @@ func Benchmark_Pipe_Worker_ExecEcho(b *testing.B) { } func Benchmark_Pipe_Worker_ExecEcho3(b *testing.B) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") ctx := context.Background() w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) if err != nil { @@ -272,7 +272,7 @@ func Benchmark_Pipe_Worker_ExecEcho3(b *testing.B) { } func Benchmark_Pipe_Worker_ExecEchoWithoutContext(b *testing.B) { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") ctx := context.Background() w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) if err != nil { @@ -298,7 +298,7 @@ func Benchmark_Pipe_Worker_ExecEchoWithoutContext(b *testing.B) { func Test_Echo(t *testing.T) { t.Parallel() ctx := context.Background() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) if err != nil { @@ -329,7 +329,7 @@ func Test_Echo(t *testing.T) { func Test_BadPayload(t *testing.T) { t.Parallel() ctx := context.Background() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, _ := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) @@ -356,7 +356,7 @@ func Test_BadPayload(t *testing.T) { func Test_String(t *testing.T) { t.Parallel() ctx := context.Background() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, _ := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) go func() { @@ -369,7 +369,7 @@ func Test_String(t *testing.T) { } }() - assert.Contains(t, w.String(), "php ../../../tests/client.php echo pipes") + assert.Contains(t, w.String(), "php ../../tests/client.php echo pipes") assert.Contains(t, w.String(), "ready") assert.Contains(t, w.String(), "numExecs: 0") } @@ -377,7 +377,7 @@ func Test_String(t *testing.T) { func Test_Echo_Slow(t *testing.T) { t.Parallel() ctx := context.Background() - cmd := exec.Command("php", "../../../tests/slow-client.php", "echo", "pipes", "10", "10") + cmd := exec.Command("php", "../../tests/slow-client.php", "echo", "pipes", "10", "10") w, _ := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) go func() { @@ -405,7 +405,7 @@ func Test_Echo_Slow(t *testing.T) { func Test_Broken(t *testing.T) { t.Parallel() ctx := context.Background() - cmd := exec.Command("php", "../../../tests/client.php", "broken", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "broken", "pipes") data := "" mu := &sync.Mutex{} listener := func(event interface{}) { @@ -439,7 +439,7 @@ func Test_Broken(t *testing.T) { func Test_Error(t *testing.T) { t.Parallel() ctx := context.Background() - cmd := exec.Command("php", "../../../tests/client.php", "error", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "error", "pipes") w, _ := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) go func() { @@ -468,7 +468,7 @@ func Test_Error(t *testing.T) { func Test_NumExecs(t *testing.T) { t.Parallel() ctx := context.Background() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") w, _ := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) go func() { diff --git a/transport/socket/socket_factory_spawn_test.go b/transport/socket/socket_factory_spawn_test.go index aa5b811c..363a3510 100644 --- a/transport/socket/socket_factory_spawn_test.go +++ b/transport/socket/socket_factory_spawn_test.go @@ -28,7 +28,7 @@ func Test_Tcp_Start2(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) assert.NoError(t, err) @@ -51,7 +51,7 @@ func Test_Tcp_StartCloseFactory2(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") f := NewSocketServer(ls, time.Minute) defer func() { @@ -84,7 +84,7 @@ func Test_Tcp_StartError2(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") err = cmd.Start() if err != nil { t.Errorf("error executing the command: error %v", err) @@ -108,7 +108,7 @@ func Test_Tcp_Failboot2(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/failboot.php") + cmd := exec.Command("php", "../../tests/failboot.php") finish := make(chan struct{}, 10) listener := func(event interface{}) { @@ -140,7 +140,7 @@ func Test_Tcp_Invalid2(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/invalid.php") + cmd := exec.Command("php", "../../tests/invalid.php") w, err := NewSocketServer(ls, time.Second*1).SpawnWorker(cmd) assert.Error(t, err) @@ -160,7 +160,7 @@ func Test_Tcp_Broken2(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "broken", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "broken", "tcp") finish := make(chan struct{}, 10) listener := func(event interface{}) { @@ -214,7 +214,7 @@ func Test_Tcp_Echo2(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") w, _ := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) go func() { @@ -247,7 +247,7 @@ func Test_Unix_Start2(t *testing.T) { assert.NoError(t, err) }() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "unix") + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) assert.NoError(t, err) @@ -271,7 +271,7 @@ func Test_Unix_Failboot2(t *testing.T) { assert.NoError(t, err) }() - cmd := exec.Command("php", "../../../tests/failboot.php") + cmd := exec.Command("php", "../../tests/failboot.php") finish := make(chan struct{}, 10) listener := func(event interface{}) { @@ -298,7 +298,7 @@ func Test_Unix_Timeout2(t *testing.T) { assert.NoError(t, err) }() - cmd := exec.Command("php", "../../../tests/slow-client.php", "echo", "unix", "200", "0") + 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) @@ -314,7 +314,7 @@ func Test_Unix_Invalid2(t *testing.T) { assert.NoError(t, err) }() - cmd := exec.Command("php", "../../../tests/invalid.php") + cmd := exec.Command("php", "../../tests/invalid.php") w, err := NewSocketServer(ls, time.Second*10).SpawnWorker(cmd) assert.Error(t, err) @@ -329,7 +329,7 @@ func Test_Unix_Broken2(t *testing.T) { assert.NoError(t, errC) }() - cmd := exec.Command("php", "../../../tests/client.php", "broken", "unix") + cmd := exec.Command("php", "../../tests/client.php", "broken", "unix") finish := make(chan struct{}, 10) listener := func(event interface{}) { @@ -378,7 +378,7 @@ func Test_Unix_Echo2(t *testing.T) { assert.NoError(t, err) }() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "unix") + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) if err != nil { @@ -416,7 +416,7 @@ func Benchmark_Tcp_SpawnWorker_Stop2(b *testing.B) { f := NewSocketServer(ls, time.Minute) for n := 0; n < b.N; n++ { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") w, err := f.SpawnWorker(cmd) if err != nil { @@ -441,7 +441,7 @@ func Benchmark_Tcp_Worker_ExecEcho2(b *testing.B) { assert.NoError(b, err) }() - cmd := exec.Command("php", "../../../tests/client.php", "echo", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) if err != nil { @@ -481,7 +481,7 @@ func Benchmark_Unix_SpawnWorker_Stop2(b *testing.B) { f := NewSocketServer(ls, time.Minute) for n := 0; n < b.N; n++ { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "unix") + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") w, err := f.SpawnWorker(cmd) if err != nil { @@ -510,7 +510,7 @@ func Benchmark_Unix_Worker_ExecEcho2(b *testing.B) { b.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "unix") + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") w, err := NewSocketServer(ls, time.Minute).SpawnWorker(cmd) if err != nil { diff --git a/transport/socket/socket_factory_test.go b/transport/socket/socket_factory_test.go index 36abecf9..879dba8e 100755 --- a/transport/socket/socket_factory_test.go +++ b/transport/socket/socket_factory_test.go @@ -31,7 +31,7 @@ func Test_Tcp_Start(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) assert.NoError(t, err) @@ -56,7 +56,7 @@ func Test_Tcp_StartCloseFactory(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") f := NewSocketServer(ls, time.Minute) defer func() { @@ -93,7 +93,7 @@ func Test_Tcp_StartError(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") + cmd := exec.Command("php", "../../tests/client.php", "echo", "pipes") err = cmd.Start() if err != nil { t.Errorf("error executing the command: error %v", err) @@ -122,7 +122,7 @@ func Test_Tcp_Failboot(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/failboot.php") + cmd := exec.Command("php", "../../tests/failboot.php") finish := make(chan struct{}, 10) listener := func(event interface{}) { @@ -156,7 +156,7 @@ func Test_Tcp_Timeout(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/slow-client.php", "echo", "tcp", "200", "0") + cmd := exec.Command("php", "../../tests/slow-client.php", "echo", "tcp", "200", "0") w, err := NewSocketServer(ls, time.Millisecond*1).SpawnWorkerWithTimeout(ctx, cmd) assert.Nil(t, w) @@ -179,7 +179,7 @@ func Test_Tcp_Invalid(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/invalid.php") + cmd := exec.Command("php", "../../tests/invalid.php") w, err := NewSocketServer(ls, time.Second*1).SpawnWorkerWithTimeout(ctx, cmd) assert.Error(t, err) @@ -201,7 +201,7 @@ func Test_Tcp_Broken(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "broken", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "broken", "tcp") finish := make(chan struct{}, 10) listener := func(event interface{}) { @@ -257,7 +257,7 @@ func Test_Tcp_Echo(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") w, _ := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) go func() { @@ -296,7 +296,7 @@ func Test_Unix_Start(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "unix") + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) assert.NoError(t, err) @@ -326,7 +326,7 @@ func Test_Unix_Failboot(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/failboot.php") + cmd := exec.Command("php", "../../tests/failboot.php") finish := make(chan struct{}, 10) listener := func(event interface{}) { @@ -359,7 +359,7 @@ func Test_Unix_Timeout(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/slow-client.php", "echo", "unix", "200", "0") + cmd := exec.Command("php", "../../tests/slow-client.php", "echo", "unix", "200", "0") w, err := NewSocketServer(ls, time.Millisecond*100).SpawnWorkerWithTimeout(ctx, cmd) assert.Nil(t, w) @@ -381,7 +381,7 @@ func Test_Unix_Invalid(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/invalid.php") + cmd := exec.Command("php", "../../tests/invalid.php") w, err := NewSocketServer(ls, time.Second*10).SpawnWorkerWithTimeout(ctx, cmd) assert.Error(t, err) @@ -402,7 +402,7 @@ func Test_Unix_Broken(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "broken", "unix") + cmd := exec.Command("php", "../../tests/client.php", "broken", "unix") block := make(chan struct{}, 10) listener := func(event interface{}) { @@ -459,7 +459,7 @@ func Test_Unix_Echo(t *testing.T) { t.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "unix") + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) if err != nil { @@ -503,7 +503,7 @@ func Benchmark_Tcp_SpawnWorker_Stop(b *testing.B) { f := NewSocketServer(ls, time.Minute) for n := 0; n < b.N; n++ { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") w, err := f.SpawnWorkerWithTimeout(ctx, cmd) if err != nil { @@ -534,7 +534,7 @@ func Benchmark_Tcp_Worker_ExecEcho(b *testing.B) { b.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "tcp") + cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) if err != nil { @@ -572,7 +572,7 @@ func Benchmark_Unix_SpawnWorker_Stop(b *testing.B) { f := NewSocketServer(ls, time.Minute) for n := 0; n < b.N; n++ { - cmd := exec.Command("php", "../../../tests/client.php", "echo", "unix") + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") w, err := f.SpawnWorkerWithTimeout(ctx, cmd) if err != nil { @@ -599,7 +599,7 @@ func Benchmark_Unix_Worker_ExecEcho(b *testing.B) { b.Skip("socket is busy") } - cmd := exec.Command("php", "../../../tests/client.php", "echo", "unix") + cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) if err != nil { |