+ suite.True(ok)
+ suite.Equal("exit status 1", e.Error())
+}
+
+func (suite *VesmgrTestSuite) TestWaitSubscriptionLoopRespondsSupervisionAndBreaksWhenReceivedSubsNotif() {
+ go func() {
+ time.Sleep(time.Second)
+ ch := make(chan string)
+ suite.vesmgr.chSupervision <- ch
+ suite.Equal("OK", <-ch)
+ suite.vesmgr.chSupervision <- ch
+ suite.Equal("OK", <-ch)
+ suite.vesmgr.chXAppSubscriptions <- subscriptionNotification{true, nil, ""}
+ }()
+
+ suite.vesmgr.waitSubscriptionLoop()
+}
+
+func (suite *VesmgrTestSuite) TestEmptyNotificationChannelReadsAllMsgsFromCh() {
+ go func() {
+ for i := 0; i < 11; i++ {
+ suite.vesmgr.chXAppNotifications <- []byte("hello")
+ }
+ }()
+ time.Sleep(500 * time.Millisecond)
+ <-suite.vesmgr.chXAppNotifications
+ suite.vesmgr.emptyNotificationsChannel()
+ select {
+ case <-suite.vesmgr.chXAppNotifications:
+ suite.Fail("Got unexpected notification")
+ default:
+ // ok
+ }
+}
+
+func (suite *VesmgrTestSuite) TestVespaKilling() {
+ suite.vesmgr.vesagent = makeRunner("sleep", "20")
+ suite.vesmgr.startVesagent()
+ suite.NotNil(suite.vesmgr.killVespa())
+}
+
+func (suite *VesmgrTestSuite) TestVespaKillingAlreadyKilled() {
+ suite.vesmgr.vesagent = makeRunner("sleep", "20")
+ suite.vesmgr.startVesagent()
+ suite.NotNil(suite.vesmgr.killVespa())
+ // Just check that second kill does not block execution
+ suite.NotNil(suite.vesmgr.killVespa())
+}
+
+func TestVesMgrSuite(t *testing.T) {
+ suite.Run(t, new(VesmgrTestSuite))