Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
thepalbi committed Jun 10, 2024
1 parent 426f723 commit 0003b61
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion pkg/clients/account/v1/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func NewClient(logger logging.Logger, stsClient stsiface.STSAPI, iamClient iamif
return &client{
logger: logger,
stsClient: stsClient,
iamClient: iamClient,
}
}

Expand All @@ -39,7 +40,7 @@ func (c client) GetAccount(ctx context.Context) (string, error) {
}

func (c client) GetAccountAlias(ctx context.Context) (string, error) {
acctAliasOut, err := c.iamClient.ListAccountAliases(&iam.ListAccountAliasesInput{})
acctAliasOut, err := c.iamClient.ListAccountAliasesWithContext(ctx, &iam.ListAccountAliasesInput{})
if err != nil {
return "", err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/clients/v1/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func TestClear(t *testing.T) {
"us-east-1": &cachedClients{
cloudwatch: createCloudWatchClient(logging.NewNopLogger(), mock.Session, &region, role, false),
tagging: createTaggingClient(logging.NewNopLogger(), mock.Session, &region, role, false),
account: createAccountClient(logging.NewNopLogger(), nil),
account: createAccountClient(logging.NewNopLogger(), nil, nil),
onlyStatic: true,
},
},
Expand Down Expand Up @@ -634,7 +634,7 @@ func TestRefresh(t *testing.T) {
"us-east-1": &cachedClients{
cloudwatch: createCloudWatchClient(logging.NewNopLogger(), mock.Session, &region, role, false),
tagging: createTaggingClient(logging.NewNopLogger(), mock.Session, &region, role, false),
account: createAccountClient(logging.NewNopLogger(), createStsSession(mock.Session, role, "", false, false)),
account: createAccountClient(logging.NewNopLogger(), createStsSession(mock.Session, role, "", false, false), createIamSession(mock.Session, role, false, false)),
},
},
},
Expand Down Expand Up @@ -752,7 +752,7 @@ func testGetAWSClient(
"us-east-1": &cachedClients{
cloudwatch: createCloudWatchClient(logging.NewNopLogger(), mock.Session, &region, role, false),
tagging: createTaggingClient(logging.NewNopLogger(), mock.Session, &region, role, false),
account: createAccountClient(logging.NewNopLogger(), createStsSession(mock.Session, role, "", false, false)),
account: createAccountClient(logging.NewNopLogger(), createStsSession(mock.Session, role, "", false, false), createIamSession(mock.Session, role, false, false)),
},
},
},
Expand All @@ -774,7 +774,7 @@ func testGetAWSClient(
"us-east-1": &cachedClients{
cloudwatch: createCloudWatchClient(logging.NewNopLogger(), mock.Session, &region, role, false),
tagging: createTaggingClient(logging.NewNopLogger(), mock.Session, &region, role, false),
account: createAccountClient(logging.NewNopLogger(), createStsSession(mock.Session, role, "", false, false)),
account: createAccountClient(logging.NewNopLogger(), createStsSession(mock.Session, role, "", false, false), createIamSession(mock.Session, role, false, false)),
},
},
},
Expand Down
4 changes: 4 additions & 0 deletions pkg/clients/v2/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ func (t testClient) GetAccount(_ context.Context) (string, error) {
return "", nil
}

func (t testClient) GetAccountAlias(_ context.Context) (string, error) {
return "", nil
}

func (t testClient) ListMetrics(_ context.Context, _ string, _ *model.MetricConfig, _ bool, _ func(page []*model.Metric)) error {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/promutil/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func BuildMetricName(namespace, metricName, statistic string) string {
}

// BuildAccountInfoMetrics generates info metrics for each discovered AWS account.
func BuildAccountInfoMetrics(tagData []model.TaggedResourceResult, metrics []*PrometheusMetric, logger logging.Logger) []*PrometheusMetric {
func BuildAccountInfoMetrics(tagData []model.TaggedResourceResult, metrics []*PrometheusMetric, _ logging.Logger) []*PrometheusMetric {
type uniqueAcctInfo struct {
AccountID string
AccountAlias string
Expand Down
7 changes: 3 additions & 4 deletions pkg/promutil/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,18 @@ func TestBuildAccountInfoMetrics(t *testing.T) {
metrics []*PrometheusMetric
expectedMetrics []*PrometheusMetric
}
var acct1ScrapeContext = &model.ScrapeContext{
acct1ScrapeContext := &model.ScrapeContext{
Region: "us-east-1",
AccountID: "123456789012",
CustomTags: nil,
AccountAlias: "test-account",
}
var acct2ScrapeContext = &model.ScrapeContext{
acct2ScrapeContext := &model.ScrapeContext{
Region: "us-east-1",
AccountID: "987123",
CustomTags: nil,
}
var tests = map[string]testCase{
tests := map[string]testCase{
"no tagged resources": {},
"single account across resources": {
resources: []model.TaggedResourceResult{
Expand Down Expand Up @@ -351,7 +351,6 @@ func TestBuildAccountInfoMetrics(t *testing.T) {
require.Equal(t, tc.expectedMetrics, metrics)
})
}

}

func TestBuildMetrics(t *testing.T) {
Expand Down

0 comments on commit 0003b61

Please sign in to comment.