diff options
author | Seb <[email protected]> | 2022-07-14 17:36:51 +0200 |
---|---|---|
committer | Seb <[email protected]> | 2022-07-15 13:28:28 +0200 |
commit | c06c5c7d80bfd0f7a2733afbab961d65fdd568ae (patch) | |
tree | 45c16eb614fe8834028957939ac101d1e2e83e03 | |
parent | 1dea986d2525ddaed8d5e064cf49c422291b81ac (diff) |
use channel to avoid triggering race detector
Signed-off-by: Seb <[email protected]>
-rw-r--r-- | roadrunner/roadrunner_test.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/roadrunner/roadrunner_test.go b/roadrunner/roadrunner_test.go index 66c7e380..820c207d 100644 --- a/roadrunner/roadrunner_test.go +++ b/roadrunner/roadrunner_test.go @@ -53,12 +53,12 @@ func TestServeStop(t *testing.T) { rr, err := roadrunner.NewRR(cfgFile, &[]string{}, plugins) assert.Nil(t, err) - var serveError error - stopped := false + errchan := make(chan error, 1) + stopchan := make(chan struct{}, 1) go func() { - serveError = rr.Serve() - stopped = true + errchan <- rr.Serve() + stopchan <- struct{}{} }() assert.Equal(t, rr.CurrentState(), fsm.Initialized) @@ -73,6 +73,6 @@ func TestServeStop(t *testing.T) { err = rr.Stop() assert.Nil(t, err) assert.Equal(t, fsm.Stopped, rr.CurrentState()) - assert.True(t, stopped) - assert.Nil(t, serveError) + assert.Equal(t, struct{}, <-stopped) + assert.Nil(t, <-serveError) } |