diff --git a/internal/pkg/api/handleAck_test.go b/internal/pkg/api/handleAck_test.go index 318c55695..c863973bd 100644 --- a/internal/pkg/api/handleAck_test.go +++ b/internal/pkg/api/handleAck_test.go @@ -602,6 +602,7 @@ func TestInvalidateAPIKeysRemoteOutput(t *testing.T) { bulker.AssertExpectations(t) remoteBulker.AssertExpectations(t) + remoteBulker2.AssertExpectations(t) } func TestAckHandleUpgrade(t *testing.T) { diff --git a/internal/pkg/policy/policy_output_test.go b/internal/pkg/policy/policy_output_test.go index 39f08de02..ba2f52722 100644 --- a/internal/pkg/policy/policy_output_test.go +++ b/internal/pkg/policy/policy_output_test.go @@ -305,10 +305,10 @@ func TestPolicyRemoteESOutputPrepareNoRole(t *testing.T) { Role: nil, } outputBulker := ftesting.NewMockBulk() - bulker.On("CreateAndGetBulker", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(outputBulker, false).Once() + bulker.On("CreateAndGetBulker", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(outputBulker, false).Once() err := po.Prepare(context.Background(), logger, bulker, &model.Agent{}, map[string]map[string]interface{}{}) - require.NotNil(t, err, "expected prepare to error") + require.Error(t, err, "expected prepare to error") bulker.AssertExpectations(t) } @@ -330,7 +330,7 @@ func TestPolicyRemoteESOutputPrepare(t *testing.T) { } outputBulker := ftesting.NewMockBulk() - bulker.On("CreateAndGetBulker", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(outputBulker, false).Once() + bulker.On("CreateAndGetBulker", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(outputBulker, false).Once() policyMap := map[string]map[string]interface{}{ "test output": map[string]interface{}{ @@ -391,7 +391,7 @@ func TestPolicyRemoteESOutputPrepare(t *testing.T) { Return(nil).Once() outputBulker := ftesting.NewMockBulk() - bulker.On("CreateAndGetBulker", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(outputBulker, false).Once() + bulker.On("CreateAndGetBulker", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(outputBulker, false).Once() outputBulker. On("APIKeyRead", mock.Anything, mock.Anything, mock.Anything). @@ -461,7 +461,8 @@ func TestPolicyRemoteESOutputPrepare(t *testing.T) { outputBulker.On("APIKeyCreate", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything). Return(&apiKey, nil).Once() - bulker.On("CreateAndGetBulker", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(outputBulker, false).Once() + bulker.On("CreateAndGetBulker", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(outputBulker, false).Once() + bulker.On("GetRemoteOutputErrorMap").Return(make(map[string]string)) output := Output{ Type: OutputTypeRemoteElasticsearch, diff --git a/internal/pkg/server/remote_es_output_integration_test.go b/internal/pkg/server/remote_es_output_integration_test.go index 2d2a04a67..be25f3ff8 100644 --- a/internal/pkg/server/remote_es_output_integration_test.go +++ b/internal/pkg/server/remote_es_output_integration_test.go @@ -70,7 +70,7 @@ func Checkin(t *testing.T, ctx context.Context, srv *tserver, agentID, key strin defaultOutput, ok := outputs["default"].(map[string]interface{}) require.True(t, ok, "expected default to be map") defaultAPIKey := defaultOutput["api_key"] - require.False(t, remoteAPIKey == defaultAPIKey, "expected remote api key to be different than default") + require.NotEqual(t, remoteAPIKey, defaultAPIKey, "expected remote api key to be different than default") }