simplify half connected test

Signed-off-by: Luca Bigliardi <shammash@google.com>
This commit is contained in:
Luca Bigliardi 2021-03-27 16:45:00 +01:00
parent 2990b5a309
commit 882cecd6a6

View File

@ -555,7 +555,7 @@ func TestStopRunningWhenHalfConnected(t *testing.T) {
config := makeTestIRCConfig(port) config := makeTestIRCConfig(port)
notifier, _, ctx, cancel, stopWg := makeTestNotifier(t, config) notifier, _, ctx, cancel, stopWg := makeTestNotifier(t, config)
var testStep, holdQuitWait sync.WaitGroup var testStep sync.WaitGroup
// Send a StopRunning request while the client is connected but the // Send a StopRunning request while the client is connected but the
// session is not up // session is not up
@ -567,15 +567,6 @@ func TestStopRunningWhenHalfConnected(t *testing.T) {
} }
server.SetHandler("USER", holdUser) server.SetHandler("USER", holdUser)
// Ignore quit, but wait for it to have deterministic test commands
holdQuitWait.Add(1)
holdQuit := func(conn *bufio.ReadWriter, line *irc.Line) error {
log.Printf("=Server= Ignoring quit")
holdQuitWait.Done()
return nil
}
server.SetHandler("QUIT", holdQuit)
go notifier.Run(ctx, stopWg) go notifier.Run(ctx, stopWg)
testStep.Wait() testStep.Wait()
@ -583,8 +574,6 @@ func TestStopRunningWhenHalfConnected(t *testing.T) {
cancel() cancel()
stopWg.Wait() stopWg.Wait()
holdQuitWait.Wait()
// Client has left, cleanup the server side before stopping // Client has left, cleanup the server side before stopping
server.Client.Close() server.Client.Close()