Skip to content

Commit

Permalink
remove unused parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kubasobon committed Mar 7, 2024
1 parent d094138 commit d7457e4
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions internal/flavors/benchmark/aws_org_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,28 @@ func TestAWSOrg_Initialize(t *testing.T) {
},
{
name: "account provider uninitialized",
iamProvider: mockIAMProviderWithTags(nil, nil),
iamProvider: mockIAMProviderWithTags(nil),
identityProvider: mockAwsIdentityProvider(nil),
accountProvider: nil,
wantErr: "account provider is uninitialized",
},
{
name: "identity provider error",
iamProvider: mockIAMProviderWithTags(nil, nil),
iamProvider: mockIAMProviderWithTags(nil),
identityProvider: mockAwsIdentityProvider(errors.New("some error")),
accountProvider: mockAccountProvider(errors.New("not this error")),
wantErr: "some error",
},
{
name: "account provider error",
iamProvider: mockIAMProviderWithTags(nil, nil),
iamProvider: mockIAMProviderWithTags(nil),
identityProvider: mockAwsIdentityProvider(nil),
accountProvider: mockAccountProvider(errors.New("some error")),
want: []string{},
},
{
name: "no error",
iamProvider: mockIAMProviderWithTags(nil, nil),
iamProvider: mockIAMProviderWithTags(nil),
identityProvider: mockAwsIdentityProvider(nil),
accountProvider: mockAccountProvider(nil),
want: []string{
Expand Down Expand Up @@ -155,7 +155,7 @@ func Test_getAwsAccounts(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
a := AWSOrg{
IAMProvider: mockIAMProviderWithTags(nil, nil),
IAMProvider: mockIAMProviderWithTags(nil),
IdentityProvider: nil,
AccountProvider: tt.accountProvider,
}
Expand Down Expand Up @@ -202,22 +202,18 @@ func mockAccountProviderWithIdentities(identities []cloud.Identity) *awslib.Mock
return &provider
}

func mockIAMProviderWithTags(err error, tags []types.Tag) iam.RoleGetter {
func mockIAMProviderWithTags(tags []types.Tag) iam.RoleGetter {

Check failure on line 205 in internal/flavors/benchmark/aws_org_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

`mockIAMProviderWithTags` - `tags` always receives `nil` (unparam)
iamProvider := &iam.MockRoleGetter{}
on := iamProvider.EXPECT().GetRole(mock.Anything, mock.AnythingOfType("string"))
if err == nil {
arn := "arn:aws:iam::123456789012/mock-role"
name := "mock-role"
role := &iam.Role{
Role: types.Role{
Arn: &arn,
RoleName: &name,
Tags: tags,
},
}
on.Return(role, nil)
} else {
on.Return(nil, err)
arn := "arn:aws:iam::123456789012/mock-role"
name := "mock-role"
role := &iam.Role{
Role: types.Role{
Arn: &arn,
RoleName: &name,
Tags: tags,
},
}
on.Return(role, nil)
return iamProvider
}

0 comments on commit d7457e4

Please sign in to comment.