From d26319cf9df6dc377de9cb94142fec4b8d67256c Mon Sep 17 00:00:00 2001 From: Rebecca Mahany-Horton Date: Thu, 25 Jul 2024 10:47:28 -0400 Subject: [PATCH] Add .Maybe() to some unimportant assertions in runtime tests (#1797) --- pkg/osquery/runtime/runtime_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/osquery/runtime/runtime_test.go b/pkg/osquery/runtime/runtime_test.go index 68cfcc373..25d80f171 100644 --- a/pkg/osquery/runtime/runtime_test.go +++ b/pkg/osquery/runtime/runtime_test.go @@ -338,7 +338,7 @@ func TestWithOsqueryFlags(t *testing.T) { k.On("LatestOsquerydPath", mock.Anything).Return(testOsqueryBinaryDirectory) store, err := storageci.NewStore(t, multislogger.NewNopLogger(), storage.KatcConfigStore.String()) require.NoError(t, err) - k.On("KatcConfigStore").Return(store) + k.On("KatcConfigStore").Return(store).Maybe() // attempt to make this test less flaky runner := New( k, @@ -373,7 +373,7 @@ func TestFlagsChanged(t *testing.T) { k.On("LatestOsquerydPath", mock.Anything).Return(testOsqueryBinaryDirectory) store, err := storageci.NewStore(t, multislogger.NewNopLogger(), storage.KatcConfigStore.String()) require.NoError(t, err) - k.On("KatcConfigStore").Return(store) + k.On("KatcConfigStore").Return(store).Maybe() // attempt to make this test less flaky // Start the runner runner := New( @@ -469,7 +469,7 @@ func TestSimplePath(t *testing.T) { k.On("LatestOsquerydPath", mock.Anything).Return(testOsqueryBinaryDirectory) store, err := storageci.NewStore(t, multislogger.NewNopLogger(), storage.KatcConfigStore.String()) require.NoError(t, err) - k.On("KatcConfigStore").Return(store) + k.On("KatcConfigStore").Return(store).Maybe() // attempt to make this test less flaky runner := New( k, @@ -500,7 +500,7 @@ func TestMultipleShutdowns(t *testing.T) { k.On("LatestOsquerydPath", mock.Anything).Return(testOsqueryBinaryDirectory) store, err := storageci.NewStore(t, multislogger.NewNopLogger(), storage.KatcConfigStore.String()) require.NoError(t, err) - k.On("KatcConfigStore").Return(store) + k.On("KatcConfigStore").Return(store).Maybe() // attempt to make this test less flaky runner := New( k, @@ -530,7 +530,7 @@ func TestOsqueryDies(t *testing.T) { k.On("LatestOsquerydPath", mock.Anything).Return(testOsqueryBinaryDirectory) store, err := storageci.NewStore(t, multislogger.NewNopLogger(), storage.KatcConfigStore.String()) require.NoError(t, err) - k.On("KatcConfigStore").Return(store) + k.On("KatcConfigStore").Return(store).Maybe() // attempt to make this test less flaky runner := New( k,