diff options
author | Valery Piashchynski <[email protected]> | 2021-09-13 15:40:57 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-09-13 15:40:57 +0300 |
commit | 5d2cd55ab522d4f1e65a833f91146444465a32ac (patch) | |
tree | a374c8e90383d5e868ffe6b44555a55029c54f79 /pkg | |
parent | fe72d84395970281fe330a2b9423f8c0e4c3b9c8 (diff) | |
parent | b8a4b82f82e2cb9f9efc4a3601a97b4ff07fefc7 (diff) |
[#793]: fix(plugins): incorrect parsing local and global drivers sections
[#793]: fix(plugins): incorrect parsing local and global drivers sections
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/priority_queue/binary_heap_test.go | 26 | ||||
-rwxr-xr-x | pkg/transport/pipe/pipe_factory_test.go | 17 |
2 files changed, 43 insertions, 0 deletions
diff --git a/pkg/priority_queue/binary_heap_test.go b/pkg/priority_queue/binary_heap_test.go index fb5b83de..ab0f9266 100644 --- a/pkg/priority_queue/binary_heap_test.go +++ b/pkg/priority_queue/binary_heap_test.go @@ -61,6 +61,32 @@ func TestBinHeap_Init(t *testing.T) { require.Equal(t, expected, res) } +func TestBinHeap_MaxLen(t *testing.T) { + a := []Item{Test(2), Test(23), Test(33), Test(44), Test(1), Test(2), Test(2), Test(2), Test(4), Test(6), Test(99)} + + bh := NewBinHeap(1) + + go func() { + expected := []Item{Test(2), Test(23), Test(33), Test(44), Test(1), Test(2), Test(2), Test(2), Test(4), Test(6), Test(99)} + + res := make([]Item, 0, 12) + + for i := 0; i < 11; i++ { + item := bh.ExtractMin() + res = append(res, item) + } + require.Equal(t, expected, res) + return + }() + + time.Sleep(time.Second) + for i := 0; i < len(a); i++ { + bh.Insert(a[i]) + } + + time.Sleep(time.Second) +} + func TestNewPriorityQueue(t *testing.T) { insertsPerSec := uint64(0) getPerSec := uint64(0) diff --git a/pkg/transport/pipe/pipe_factory_test.go b/pkg/transport/pipe/pipe_factory_test.go index d243a93f..e396fe57 100755 --- a/pkg/transport/pipe/pipe_factory_test.go +++ b/pkg/transport/pipe/pipe_factory_test.go @@ -16,6 +16,7 @@ import ( ) func Test_GetState(t *testing.T) { + t.Parallel() ctx := context.Background() cmd := exec.Command("php", "../../../tests/client.php", "echo", "pipes") @@ -36,6 +37,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") @@ -60,6 +62,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") @@ -75,6 +78,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") err := cmd.Start() if err != nil { @@ -88,6 +92,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") _, err := cmd.StdinPipe() if err != nil { @@ -101,6 +106,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") // error cause _, err := cmd.StdinPipe() @@ -115,6 +121,7 @@ func Test_Pipe_PipeError2(t *testing.T) { } func Test_Pipe_Failboot(t *testing.T) { + t.Parallel() cmd := exec.Command("php", "../../../tests/failboot.php") ctx := context.Background() @@ -137,6 +144,7 @@ func Test_Pipe_Failboot(t *testing.T) { } func Test_Pipe_Invalid(t *testing.T) { + t.Parallel() cmd := exec.Command("php", "../../../tests/invalid.php") ctx := context.Background() w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) @@ -145,6 +153,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") ctx := context.Background() w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) @@ -171,6 +180,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") ctx := context.Background() w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) @@ -286,6 +296,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") @@ -316,6 +327,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") @@ -342,6 +354,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") @@ -362,6 +375,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") @@ -389,6 +403,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") data := "" @@ -422,6 +437,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") @@ -450,6 +466,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") |