diff options
author | Valery Piashchynski <[email protected]> | 2020-12-03 13:14:29 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-03 13:14:29 +0300 |
commit | f86e67bcc90560cd907df5abbf5ca7b3fcbe8ca1 (patch) | |
tree | afcc2897a198fe747bc8673cd8bd9b2d6fe709a1 | |
parent | 31e4bb7b236fe0ae59fd42d66af0d718b67a2a4b (diff) |
Correct Test_Broken test, replace channel with wait group
-rw-r--r-- | plugins/checker/plugin.go | 2 | ||||
-rwxr-xr-x | sync_worker_test.go | 17 |
2 files changed, 6 insertions, 13 deletions
diff --git a/plugins/checker/plugin.go b/plugins/checker/plugin.go index 11dce06e..9f4c1fd8 100644 --- a/plugins/checker/plugin.go +++ b/plugins/checker/plugin.go @@ -93,7 +93,7 @@ func (c *Plugin) RPC() interface{} { } type Plugins struct { - Plugins []string `query:"service"` + Plugins []string `query:"plugin"` } const template string = "Service: %s: Status: %d\n" diff --git a/sync_worker_test.go b/sync_worker_test.go index 9786d709..890a2365 100755 --- a/sync_worker_test.go +++ b/sync_worker_test.go @@ -3,8 +3,8 @@ package roadrunner import ( "context" "os/exec" + "sync" "testing" - "time" "github.com/spiral/errors" "github.com/stretchr/testify/assert" @@ -159,20 +159,13 @@ func Test_Broken(t *testing.T) { if err != nil { t.Fatal(err) } - ch := make(chan struct{}) - go func() { - tt := time.NewTimer(time.Second * 10) - select { - case <-tt.C: - tt.Stop() - ch <- struct{}{} - } - }() + wg := &sync.WaitGroup{} + wg.Add(1) w.AddListener(func(event interface{}) { assert.Contains(t, string(event.(WorkerEvent).Payload.([]byte)), "undefined_function()") - ch <- struct{}{} + wg.Done() }) syncWorker, err := NewSyncWorker(w) @@ -185,7 +178,7 @@ func Test_Broken(t *testing.T) { assert.Nil(t, res.Body) assert.Nil(t, res.Context) - <-ch + wg.Wait() assert.Error(t, w.Stop(ctx)) } |