Skip to content

Commit

Permalink
r/aws_codegurureviewer_repository_association: Cosmetics.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Mar 12, 2023
1 parent 9ffc493 commit 52a897c
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions internal/service/codegurureviewer/repository_association_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestAccCodeGuruReviewerRepositoryAssociation_basic(t *testing.T) {
PreCheck: func() {
acctest.PreCheck(t)
acctest.PreCheckPartitionHasService(t, codegurureviewer.EndpointsID)
testAccPreCheck(t)
testAccPreCheck(ctx, t)
},
ErrorCheck: acctest.ErrorCheck(t, codegurureviewer.EndpointsID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
Expand Down Expand Up @@ -67,7 +67,7 @@ func TestAccCodeGuruReviewerRepositoryAssociation_KMSKey(t *testing.T) {
PreCheck: func() {
acctest.PreCheck(t)
acctest.PreCheckPartitionHasService(t, codegurureviewer.EndpointsID)
testAccPreCheck(t)
testAccPreCheck(ctx, t)
},
ErrorCheck: acctest.ErrorCheck(t, codegurureviewer.EndpointsID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestAccCodeGuruReviewerRepositoryAssociation_S3Repository(t *testing.T) {
PreCheck: func() {
acctest.PreCheck(t)
acctest.PreCheckPartitionHasService(t, codegurureviewer.EndpointsID)
testAccPreCheck(t)
testAccPreCheck(ctx, t)
},
ErrorCheck: acctest.ErrorCheck(t, codegurureviewer.EndpointsID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestAccCodeGuruReviewerRepositoryAssociation_tags(t *testing.T) {
PreCheck: func() {
acctest.PreCheck(t)
acctest.PreCheckPartitionHasService(t, codegurureviewer.EndpointsID)
testAccPreCheck(t)
testAccPreCheck(ctx, t)
},
ErrorCheck: acctest.ErrorCheck(t, codegurureviewer.EndpointsID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
Expand Down Expand Up @@ -182,7 +182,7 @@ func TestAccCodeGuruReviewerRepositoryAssociation_disappears(t *testing.T) {
PreCheck: func() {
acctest.PreCheck(t)
acctest.PreCheckPartitionHasService(t, codegurureviewer.EndpointsID)
testAccPreCheck(t)
testAccPreCheck(ctx, t)
},
ErrorCheck: acctest.ErrorCheck(t, codegurureviewer.EndpointsID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
Expand Down Expand Up @@ -253,9 +253,8 @@ func testAccCheckRepositoryAssociationExists(ctx context.Context, name string, r
}
}

func testAccPreCheck(t *testing.T) {
func testAccPreCheck(ctx context.Context, t *testing.T) {
conn := acctest.Provider.Meta().(*conns.AWSClient).CodeGuruReviewerConn()
ctx := context.Background()

input := &codegurureviewer.ListRepositoryAssociationsInput{}
_, err := conn.ListRepositoryAssociationsWithContext(ctx, input)
Expand Down Expand Up @@ -330,7 +329,11 @@ resource "aws_codegurureviewer_repository_association" "test" {
}

func testAccRepositoryAssociationConfig_s3_repository(rName string) string {
return acctest.ConfigCompose(testAccRepositoryAssociation_s3_repository(rName), `
return fmt.Sprintf(`
resource "aws_s3_bucket" "test" {
bucket = %[1]q
}
resource "aws_codegurureviewer_repository_association" "test" {
repository {
s3_bucket {
Expand All @@ -339,7 +342,7 @@ resource "aws_codegurureviewer_repository_association" "test" {
}
}
}
`)
`, rName)
}

func testAccRepositoryAssociation_codecommit_repository(rName string) string {
Expand All @@ -356,15 +359,6 @@ resource "aws_codecommit_repository" "test" {
`, rName)
}

func testAccRepositoryAssociation_s3_repository(rName string) string {
return fmt.Sprintf(`
resource "aws_s3_bucket" "test" {
bucket = %[1]q
}
`, rName)
}

func testAccRepositoryAssociation_kms_key() string {
return `
resource "aws_kms_key" "test" {
Expand Down

0 comments on commit 52a897c

Please sign in to comment.