mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
try fixing race in tests of ctl socket
there were a few test failures on the github runners. i can't reproduce it locally. but i can see how they are happening: a gorouting running servectlcmd could still be doing cleanup (removing files) while a next ctl command was being run. with this change, we wait for servectlcmd to be done before starting on a next test.
This commit is contained in:
parent
8254e9ce66
commit
ac3596a7d7
1 changed files with 6 additions and 1 deletions
|
@ -56,9 +56,14 @@ func TestCtl(t *testing.T) {
|
|||
cconn, sconn := net.Pipe()
|
||||
clientctl := ctl{conn: cconn, log: pkglog}
|
||||
serverctl := ctl{conn: sconn, log: pkglog}
|
||||
go servectlcmd(ctxbg, &serverctl, func() {})
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
servectlcmd(ctxbg, &serverctl, func() {})
|
||||
close(done)
|
||||
}()
|
||||
fn(&clientctl)
|
||||
cconn.Close()
|
||||
<-done
|
||||
sconn.Close()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue