mirror of
https://github.com/google/alertmanager-irc-relay.git
synced 2024-11-16 16:19:21 +01:00
simplify half connected test
Signed-off-by: Luca Bigliardi <shammash@google.com>
This commit is contained in:
parent
2990b5a309
commit
882cecd6a6
13
irc_test.go
13
irc_test.go
@ -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()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user