Skip to content

Commit

Permalink
update go commons (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Ellison authored Jun 15, 2023
1 parent 06207d0 commit a886fb0
Show file tree
Hide file tree
Showing 64 changed files with 171 additions and 215 deletions.
10 changes: 3 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
<<: *defaults
steps:
- checkout
- run: build-go-binaries --parallel 2 --app-name cloud-nuke --dest-path bin --ld-flags "-X main.VERSION=$CIRCLE_TAG -X 'main.MixPanelClientId=$MIXPANEL_CLIENT_ID'"
- run: build-go-binaries --parallel 2 --app-name cloud-nuke --dest-path bin --ld-flags "-X main.VERSION=$CIRCLE_TAG"
- persist_to_workspace:
root: .
paths: bin
Expand All @@ -41,7 +41,7 @@ jobs:
command: |
# We explicitly list the resource types we want to nuke, as we are not ready to nuke some resource types in
# the AWS account we use at Gruntwork for testing (Phx DevOps) (e.g., S3)
go run -ldflags="-X 'main.VERSION=$CIRCLE_SHA1' -X 'main.MixPanelClientId=$MIXPANEL_CLIENT_ID'" main.go aws \
go run -ldflags="-X 'main.VERSION=$CIRCLE_SHA1'" main.go aws \
--older-than 2h \
--force \
--config ./.circleci/nuke_config.yml \
Expand All @@ -62,7 +62,7 @@ jobs:
export AWS_SECRET_ACCESS_KEY=$SANDBOX_AWS_SECRET_ACCESS_KEY
# We explicitly list the resource types we want to nuke, as we are not ready to nuke some resource types in
# the AWS account we use at Gruntwork for testing (Sandbox) (e.g., S3)
go run -ldflags="-X 'main.VERSION=$CIRCLE_SHA1' -X 'main.MixPanelClientId=$MIXPANEL_CLIENT_ID'" main.go aws \
go run -ldflags="-X 'main.VERSION=$CIRCLE_SHA1'" main.go aws \
--older-than 24h \
--force \
--config ./.circleci/nuke_config.yml \
Expand Down Expand Up @@ -102,7 +102,6 @@ workflows:
context:
- AWS__PHXDEVOPS__circle-ci-test
- GITHUB__PAT__gruntwork-ci
- MIXPANEL__TOKEN__gruntwork
- deploy:
requires:
- build
Expand All @@ -114,7 +113,6 @@ workflows:
context:
- AWS__PHXDEVOPS__circle-ci-test
- GITHUB__PAT__gruntwork-ci
- MIXPANEL__TOKEN__gruntwork
nuke_phxdevops:
when:
and:
Expand All @@ -125,7 +123,6 @@ workflows:
context:
- AWS__PHXDEVOPS__circle-ci-test
- GITHUB__PAT__gruntwork-ci
- MIXPANEL__TOKEN__gruntwork
nuke_sandbox:
when:
and:
Expand All @@ -137,4 +134,3 @@ workflows:
- AWS__PHXDEVOPS__circle-ci-test
- GITHUB__PAT__gruntwork-ci
- AWS__SANDBOX__circle-ci
- MIXPANEL__TOKEN__gruntwork
2 changes: 1 addition & 1 deletion aws/access_analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

func TestListAccessAnalyzers(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

// We hard code the region here to avoid the tests colliding with each other, since we can only have one account
Expand Down
4 changes: 2 additions & 2 deletions aws/acmpca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func createTestACMPCA(t *testing.T, session *session.Session, name string) *stri
}

func TestListACMPCA(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
runOrSkip(t)
t.Parallel()

Expand Down Expand Up @@ -124,7 +124,7 @@ func TestListACMPCA(t *testing.T) {
}

func TestNukeACMPCA(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
runOrSkip(t)
t.Parallel()

Expand Down
4 changes: 2 additions & 2 deletions aws/ami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func createTestAMI(t *testing.T, session *session.Session, name string) (*ec2.Im
}

func TestListAMIs(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down Expand Up @@ -124,7 +124,7 @@ func TestListAMIs(t *testing.T) {
}

func TestNukeAMIs(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down
8 changes: 4 additions & 4 deletions aws/apigateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func createTestAPIGateway(t *testing.T, session *session.Session, name string) (
}

func TestListAPIGateways(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down Expand Up @@ -71,7 +71,7 @@ func TestListAPIGateways(t *testing.T) {
}

func TestTimeFilterExclusionNewlyCreatedAPIGateway(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestTimeFilterExclusionNewlyCreatedAPIGateway(t *testing.T) {
}

func TestNukeAPIGatewayOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -124,7 +124,7 @@ func TestNukeAPIGatewayOne(t *testing.T) {
}

func TestNukeAPIGatewayMoreThanOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down
2 changes: 1 addition & 1 deletion aws/apigatewayv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func createTestAPIGatewayV2(t *testing.T, session *session.Session, name string)
}

func TestListAPIGatewaysV2(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down
6 changes: 3 additions & 3 deletions aws/asg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func createTestAutoScalingGroup(t *testing.T, session *session.Session, name str
}

func TestListAutoScalingGroups(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestListAutoScalingGroups(t *testing.T) {
}

func TestNukeAutoScalingGroups(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestNukeAutoScalingGroups(t *testing.T) {

// Test config file filtering works as expected
func TestShouldIncludeAutoScalingGroup(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
mockAutoScalingGroup := &autoscaling.Group{
AutoScalingGroupName: awsgo.String("cloud-nuke-test"),
CreatedTime: awsgo.Time(time.Now()),
Expand Down
4 changes: 2 additions & 2 deletions aws/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestSplit(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

testCases := []struct {
Expand All @@ -30,7 +30,7 @@ func TestSplit(t *testing.T) {
}

func TestGetTargetRegions(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

actualEnabledRegions, _ := GetEnabledRegions()
Expand Down
6 changes: 3 additions & 3 deletions aws/cloudtrail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

func TestListCloudTrailTrails(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down Expand Up @@ -155,7 +155,7 @@ func createCloudTrailTrail(t *testing.T, region string) *string {
}

func TestNukeCloudTrailOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -178,7 +178,7 @@ func TestNukeCloudTrailOne(t *testing.T) {
}

func TestNukeCloudTrailTrailMoreThanOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down
8 changes: 4 additions & 4 deletions aws/cloudwatch_alarm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestListCloudWatchAlarms(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -37,7 +37,7 @@ func TestListCloudWatchAlarms(t *testing.T) {
}

func TestTimeFilterExclusionNewlyCreatedCloudWatchAlarm(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -63,7 +63,7 @@ func TestTimeFilterExclusionNewlyCreatedCloudWatchAlarm(t *testing.T) {
}

func TestNukeCloudWatchAlarmOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -88,7 +88,7 @@ func TestNukeCloudWatchAlarmOne(t *testing.T) {
}

func TestNukeCloudWatchAlarmsMoreThanOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down
8 changes: 4 additions & 4 deletions aws/cloudwatch_dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestListCloudWatchDashboards(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -36,7 +36,7 @@ func TestListCloudWatchDashboards(t *testing.T) {
}

func TestTimeFilterExclusionNewlyCreatedCloudWatchDashboard(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -62,7 +62,7 @@ func TestTimeFilterExclusionNewlyCreatedCloudWatchDashboard(t *testing.T) {
}

func TestNukeCloudWatchDashboardOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -87,7 +87,7 @@ func TestNukeCloudWatchDashboardOne(t *testing.T) {
}

func TestNukeCloudWatchDashboardsMoreThanOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down
8 changes: 4 additions & 4 deletions aws/cloudwatch_loggroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestListCloudWatchLogGroups(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -37,7 +37,7 @@ func TestListCloudWatchLogGroups(t *testing.T) {
}

func TestTimeFilterExclusionNewlyCreatedCloudWatchLogGroup(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -63,7 +63,7 @@ func TestTimeFilterExclusionNewlyCreatedCloudWatchLogGroup(t *testing.T) {
}

func TestNukeCloudWatchLogGroupOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -88,7 +88,7 @@ func TestNukeCloudWatchLogGroupOne(t *testing.T) {
}

func TestNukeCloudWatchLogGroupMoreThanOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down
4 changes: 2 additions & 2 deletions aws/config_recorder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func TestListConfigRecorders(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -38,7 +38,7 @@ func TestListConfigRecorders(t *testing.T) {
}

func TestNukeConfigRecorderOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down
6 changes: 3 additions & 3 deletions aws/config_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

func TestListConfigServiceRules(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -37,7 +37,7 @@ func TestListConfigServiceRules(t *testing.T) {
}

func TestNukeConfigServiceRuleOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand All @@ -60,7 +60,7 @@ func TestNukeConfigServiceRuleOne(t *testing.T) {
}

func TestNukeConfigServiceRuleMoreThanOne(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()

region, err := getRandomRegion()
Expand Down
6 changes: 3 additions & 3 deletions aws/dynamodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func getTableStatus(TableName string, region string) *string {
}

func TestShouldIncludeTable(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
mockTable := &dynamodb.TableDescription{
TableName: aws.String("cloud-nuke-test"),
CreationDateTime: aws.Time(time.Now()),
Expand Down Expand Up @@ -150,7 +150,7 @@ func TestShouldIncludeTable(t *testing.T) {
}

func TestGetTablesDynamo(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()
region, err := getRandomRegion()
require.NoError(t, err)
Expand All @@ -166,7 +166,7 @@ func TestGetTablesDynamo(t *testing.T) {
}

func TestNukeAllDynamoDBTables(t *testing.T) {
telemetry.InitTelemetry("cloud-nuke", "", "")
telemetry.InitTelemetry("cloud-nuke", "")
t.Parallel()
db := DynamoDB{}

Expand Down
Loading

0 comments on commit a886fb0

Please sign in to comment.