Ejemplo n.º 1
0
func (s *AgentTestSuite) TearDownTest(t *C) {

	if s.agentRunning {
		select {
		case s.readyChan <- true: // qan.Stop() immediately
		default:
			t.Fatal("mock service 1 Stop not ready")
		}
		select {
		case s.readyChan <- true: // mm.Stop immediately
		default:
			t.Fatal("mock service 1 Stop not ready")
		}
		s.sendChan <- &proto.Cmd{Cmd: "Stop"} // tell agent to stop itself
		select {
		case <-s.doneChan: // wait for goroutine agent.Run() in test
		case <-time.After(5 * time.Second):
			t.Fatal("Agent didn't respond to Stop cmd")
		}
		s.agentRunning = false
	}

	test.DrainLogChan(s.logChan)
	test.DrainSendChan(s.sendChan)
	test.DrainRecvChan(s.recvChan)
	test.DrainTraceChan(s.traceChan)
	test.DrainTraceChan(s.client.TraceChan)
	test.DrainBoolChan(s.client.ConnectChan())
}
Ejemplo n.º 2
0
func (s *AgentTestSuite) TearDownTest(t *C) {
	s.readyChan <- true // qan.Stop() immediately
	s.readyChan <- true // mm.Stop immediately

	if !s.alreadyStopped {
		s.sendChan <- &proto.Cmd{Cmd: "Stop"} // tell agent to stop itself
		select {
		case <-s.doneChan: // wait for goroutine agent.Run() in test
		case <-time.After(5 * time.Second):
			golog.Panic("Agent didn't respond to Stop cmd")
		}
	}

	test.DrainLogChan(s.logChan)
	test.DrainSendChan(s.sendChan)
	test.DrainRecvChan(s.recvChan)
	test.DrainTraceChan(s.traceChan)
	test.DrainTraceChan(s.client.TraceChan)
	test.DrainBoolChan(s.client.ConnectChan())
}