Browse Source

remove racy assertions

b/scada-retry-disconnect
Nick Ethier 2 years ago
parent
commit
63243bb545
  1. 5
      agent/hcp/scada/watchdog_test.go

5
agent/hcp/scada/watchdog_test.go

@ -76,6 +76,7 @@ func Test_watchdogProvider(t *testing.T) {
t.Run(name, func(t *testing.T) {
t.Parallel()
tc := _tc
ms := time.Duration(len(tc.states)+1) * testInterval
provider := NewMockProvider(t)
wd := &watchdogProvider{
Provider: provider,
@ -98,12 +99,8 @@ func Test_watchdogProvider(t *testing.T) {
provider.EXPECT().Start().Return(nil).Times(tc.expectedStartCalls)
provider.EXPECT().Stop().Return(nil).Once()
require.False(t, wd.running)
require.NoError(t, wd.Start())
require.True(t, wd.running)
ms := time.Duration(len(tc.states)+1) * testInterval
<-time.After(ms)
require.False(t, wd.running)
require.ErrorIs(t, wd.Stop(), libscada.ErrProviderNotStarted)
})
}

Loading…
Cancel
Save