mirror of
https://github.com/google/alertmanager-irc-relay.git
synced 2024-12-25 20:32:44 +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)
|
||||
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
|
||||
// session is not up
|
||||
@ -567,15 +567,6 @@ func TestStopRunningWhenHalfConnected(t *testing.T) {
|
||||
}
|
||||
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)
|
||||
|
||||
testStep.Wait()
|
||||
@ -583,8 +574,6 @@ func TestStopRunningWhenHalfConnected(t *testing.T) {
|
||||
cancel()
|
||||
stopWg.Wait()
|
||||
|
||||
holdQuitWait.Wait()
|
||||
|
||||
// Client has left, cleanup the server side before stopping
|
||||
server.Client.Close()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user