Skip to content

Commit d8d09c0

Browse files
committed
Standardize test team and repo names to use testResourcePrefix
Signed-off-by: Timo Sand <[email protected]>
1 parent 34f0c13 commit d8d09c0

98 files changed

Lines changed: 1047 additions & 867 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

github/data_source_github_actions_environment_public_key_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@ import (
1111
func TestAccGithubActionsEnvironmentPublicKeyDataSource(t *testing.T) {
1212
t.Run("queries a repository environment public key without error", func(t *testing.T) {
1313
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
14+
repoName := fmt.Sprintf("%srepo-env-pubkey-%s", testResourcePrefix, randomID)
1415

1516
config := fmt.Sprintf(`
1617
resource "github_repository" "test" {
17-
name = "tf-acc-test-%[1]s"
18+
name = "%[1]s"
1819
auto_init = true
1920
}
2021
2122
resource "github_repository_environment" "test" {
2223
repository = github_repository.test.name
23-
environment = "tf-acc-test-%[1]s"
24+
environment = "tf-acc-test-%[2]s"
2425
}
2526
2627
data "github_actions_environment_public_key" "test" {
2728
repository = github_repository.test.name
2829
environment = github_repository_environment.test.environment
29-
}`, randomID)
30+
}`, repoName, randomID)
3031

3132
check := resource.ComposeTestCheckFunc(
3233
resource.TestCheckResourceAttrSet(

github/data_source_github_actions_environment_secrets_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ import (
1111
func TestAccGithubActionsEnvironmentSecretsDataSource(t *testing.T) {
1212
t.Run("queries actions secrets from an environment", func(t *testing.T) {
1313
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
14+
repoName := fmt.Sprintf("%srepo-env-secrets-%s", testResourcePrefix, randomID)
1415

1516
config := fmt.Sprintf(`
1617
resource "github_repository" "test" {
17-
name = "tf-acc-test-%s"
18+
name = "%s"
1819
auto_init = true
1920
}
2021
@@ -29,7 +30,7 @@ func TestAccGithubActionsEnvironmentSecretsDataSource(t *testing.T) {
2930
repository = github_repository.test.name
3031
plaintext_value = "foo"
3132
}
32-
`, randomID)
33+
`, repoName)
3334

3435
config2 := config + `
3536
data "github_actions_environment_secrets" "test" {
@@ -39,7 +40,7 @@ func TestAccGithubActionsEnvironmentSecretsDataSource(t *testing.T) {
3940
`
4041

4142
check := resource.ComposeTestCheckFunc(
42-
resource.TestCheckResourceAttr("data.github_actions_environment_secrets.test", "name", fmt.Sprintf("tf-acc-test-%s", randomID)),
43+
resource.TestCheckResourceAttr("data.github_actions_environment_secrets.test", "name", repoName),
4344
resource.TestCheckResourceAttr("data.github_actions_environment_secrets.test", "secrets.#", "1"),
4445
resource.TestCheckResourceAttr("data.github_actions_environment_secrets.test", "secrets.0.name", "SECRET_1"),
4546
resource.TestCheckResourceAttrSet("data.github_actions_environment_secrets.test", "secrets.0.created_at"),

github/data_source_github_actions_environment_variables_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import (
1212
func TestAccGithubActionsEnvironmentVariablesDataSource(t *testing.T) {
1313
t.Run("queries actions variables from an environment", func(t *testing.T) {
1414
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
15+
repoName := fmt.Sprintf("%srepo-env-vars-%s", testResourcePrefix, randomID)
1516

1617
config := fmt.Sprintf(`
1718
resource "github_repository" "test" {
18-
name = "tf-acc-test-%s"
19+
name = "%s"
1920
}
2021
2122
resource "github_repository_environment" "test" {
@@ -29,7 +30,7 @@ func TestAccGithubActionsEnvironmentVariablesDataSource(t *testing.T) {
2930
variable_name = "test_variable"
3031
value = "foo"
3132
}
32-
`, randomID)
33+
`, repoName)
3334

3435
config2 := config + `
3536
data "github_actions_environment_variables" "test" {

github/data_source_github_actions_public_key_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@ import (
1010

1111
func TestAccGithubActionsPublicKeyDataSource(t *testing.T) {
1212
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
13+
repoName := fmt.Sprintf("%srepo-actions-pubkey-%s", testResourcePrefix, randomID)
1314

1415
t.Run("queries a repository public key without error", func(t *testing.T) {
1516
config := fmt.Sprintf(`
1617
resource "github_repository" "test" {
17-
name = "tf-acc-test-%[1]s"
18+
name = "%[1]s"
1819
auto_init = true
1920
}
2021
2122
data "github_actions_public_key" "test" {
2223
repository = github_repository.test.name
2324
}
24-
`, randomID)
25+
`, repoName)
2526

2627
check := resource.ComposeTestCheckFunc(
2728
resource.TestCheckResourceAttrSet(

github/data_source_github_actions_registration_token_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,22 @@ import (
1010

1111
func TestAccGithubActionsRegistrationTokenDataSource(t *testing.T) {
1212
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
13+
repoName := fmt.Sprintf("%srepo-actions-regtoken-%s", testResourcePrefix, randomID)
1314

1415
t.Run("get a repository registration token without error", func(t *testing.T) {
1516
config := fmt.Sprintf(`
1617
resource "github_repository" "test" {
17-
name = "tf-acc-test-%[1]s"
18+
name = "%[1]s"
1819
auto_init = true
1920
}
2021
2122
data "github_actions_registration_token" "test" {
2223
repository = github_repository.test.id
2324
}
24-
`, randomID)
25+
`, repoName)
2526

2627
check := resource.ComposeTestCheckFunc(
27-
resource.TestCheckResourceAttr("data.github_actions_registration_token.test", "repository", fmt.Sprintf("tf-acc-test-%s", randomID)),
28+
resource.TestCheckResourceAttr("data.github_actions_registration_token.test", "repository", repoName),
2829
resource.TestCheckResourceAttrSet("data.github_actions_registration_token.test", "token"),
2930
resource.TestCheckResourceAttrSet("data.github_actions_registration_token.test", "expires_at"),
3031
)

github/data_source_github_actions_repository_oidc_subject_claim_customization_template_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import (
1010

1111
func TestAccGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDataSource(t *testing.T) {
1212
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
13+
repoName := fmt.Sprintf("%srepo-oidc-%s", testResourcePrefix, randomID)
1314

1415
t.Run("get an repository oidc subject claim customization template without error", func(t *testing.T) {
1516
config := fmt.Sprintf(`
1617
resource "github_repository" "test" {
17-
name = "tf-acc-test-%s"
18+
name = "%s"
1819
visibility = "private"
1920
}
2021
@@ -23,7 +24,7 @@ func TestAccGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDataSour
2324
use_default = false
2425
include_claim_keys = ["repo", "context", "job_workflow_ref"]
2526
}
26-
`, randomID)
27+
`, repoName)
2728

2829
config2 := config + `
2930
data "github_actions_repository_oidc_subject_claim_customization_template" "test" {
@@ -33,15 +34,15 @@ func TestAccGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDataSour
3334

3435
config3 := fmt.Sprintf(`
3536
resource "github_repository" "test" {
36-
name = "tf-acc-test-%s"
37+
name = "%s"
3738
visibility = "private"
3839
}
3940
4041
resource "github_actions_repository_oidc_subject_claim_customization_template" "test" {
4142
repository = github_repository.test.name
4243
use_default = true
4344
}
44-
`, randomID)
45+
`, repoName)
4546

4647
config4 := config3 + `
4748
data "github_actions_repository_oidc_subject_claim_customization_template" "test" {

github/data_source_github_actions_secrets_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ import (
1111
func TestAccGithubActionsSecretsDataSource(t *testing.T) {
1212
t.Run("queries actions secrets from a repository", func(t *testing.T) {
1313
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
14+
repoName := fmt.Sprintf("%srepo-actions-secrets-%s", testResourcePrefix, randomID)
1415

1516
config := fmt.Sprintf(`
1617
resource "github_repository" "test" {
17-
name = "tf-acc-test-%s"
18+
name = "%s"
1819
auto_init = true
1920
}
2021
@@ -23,7 +24,7 @@ func TestAccGithubActionsSecretsDataSource(t *testing.T) {
2324
repository = github_repository.test.name
2425
plaintext_value = "foo"
2526
}
26-
`, randomID)
27+
`, repoName)
2728

2829
config2 := config + `
2930
data "github_actions_secrets" "test" {
@@ -32,7 +33,7 @@ func TestAccGithubActionsSecretsDataSource(t *testing.T) {
3233
`
3334

3435
check := resource.ComposeTestCheckFunc(
35-
resource.TestCheckResourceAttr("data.github_actions_secrets.test", "name", fmt.Sprintf("tf-acc-test-%s", randomID)),
36+
resource.TestCheckResourceAttr("data.github_actions_secrets.test", "name", repoName),
3637
resource.TestCheckResourceAttr("data.github_actions_secrets.test", "secrets.#", "1"),
3738
resource.TestCheckResourceAttr("data.github_actions_secrets.test", "secrets.0.name", "SECRET_1"),
3839
resource.TestCheckResourceAttrSet("data.github_actions_secrets.test", "secrets.0.created_at"),

github/data_source_github_actions_variables_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ import (
1111
func TestAccGithubActionsVariablesDataSource(t *testing.T) {
1212
t.Run("queries actions variables from a repository", func(t *testing.T) {
1313
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
14+
repoName := fmt.Sprintf("%srepo-actions-vars-%s", testResourcePrefix, randomID)
1415

1516
config := fmt.Sprintf(`
1617
resource "github_repository" "test" {
17-
name = "tf-acc-test-%s"
18+
name = "%s"
1819
auto_init = true
1920
}
2021
@@ -23,7 +24,7 @@ func TestAccGithubActionsVariablesDataSource(t *testing.T) {
2324
repository = github_repository.test.name
2425
value = "foo"
2526
}
26-
`, randomID)
27+
`, repoName)
2728

2829
config2 := config + `
2930
data "github_actions_variables" "test" {
@@ -32,7 +33,7 @@ func TestAccGithubActionsVariablesDataSource(t *testing.T) {
3233
`
3334

3435
check := resource.ComposeTestCheckFunc(
35-
resource.TestCheckResourceAttr("data.github_actions_variables.test", "name", fmt.Sprintf("tf-acc-test-%s", randomID)),
36+
resource.TestCheckResourceAttr("data.github_actions_variables.test", "name", repoName),
3637
resource.TestCheckResourceAttr("data.github_actions_variables.test", "variables.#", "1"),
3738
resource.TestCheckResourceAttr("data.github_actions_variables.test", "variables.0.name", "VARIABLE_1"),
3839
resource.TestCheckResourceAttr("data.github_actions_variables.test", "variables.0.value", "foo"),

github/data_source_github_branch_protection_rules_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ import (
1111
func TestAccGithubBranchProtectionRulesDataSource(t *testing.T) {
1212
t.Run("queries branch protection rules without error", func(t *testing.T) {
1313
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
14+
repoName := fmt.Sprintf("%srepo-bp-rules-%s", testResourcePrefix, randomID)
1415

1516
config := fmt.Sprintf(`
1617
resource "github_repository" "test" {
17-
name = "tf-acc-test-%[1]s"
18+
name = "%[1]s"
1819
auto_init = true
1920
}
2021
2122
data "github_branch_protection_rules" "all" {
2223
repository = github_repository.test.name
2324
}
24-
`, randomID)
25+
`, repoName)
2526

2627
check := resource.ComposeTestCheckFunc(
2728
resource.TestCheckResourceAttr("data.github_branch_protection_rules.all", "rules.#", "0"),
@@ -41,18 +42,19 @@ func TestAccGithubBranchProtectionRulesDataSource(t *testing.T) {
4142

4243
t.Run("queries branch protection", func(t *testing.T) {
4344
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
45+
repoName := fmt.Sprintf("%srepo-bp-rules2-%s", testResourcePrefix, randomID)
4446

4547
config := fmt.Sprintf(`
4648
resource "github_repository" "test" {
47-
name = "tf-acc-test-%[1]s"
49+
name = "%[1]s"
4850
auto_init = true
4951
}
5052
5153
resource "github_branch_protection" "protection" {
5254
repository_id = github_repository.test.name
5355
pattern = "main*"
5456
}
55-
`, randomID)
57+
`, repoName)
5658

5759
config2 := config + `
5860
data "github_branch_protection_rules" "all" {

github/data_source_github_branch_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ import (
1212
func TestAccGithubBranchDataSource(t *testing.T) {
1313
t.Run("queries an existing branch without error", func(t *testing.T) {
1414
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
15+
repoName := fmt.Sprintf("%srepo-branch-%s", testResourcePrefix, randomID)
1516

1617
config := fmt.Sprintf(`
1718
resource "github_repository" "test" {
18-
name = "tf-acc-test-%[1]s"
19+
name = "%[1]s"
1920
auto_init = true
2021
}
2122
2223
data "github_branch" "test" {
2324
repository = github_repository.test.name
2425
branch = "main"
2526
}
26-
`, randomID)
27+
`, repoName)
2728

2829
check := resource.ComposeTestCheckFunc(
2930
resource.TestMatchResourceAttr(
@@ -46,18 +47,19 @@ func TestAccGithubBranchDataSource(t *testing.T) {
4647
// Can't test due to SDK and test framework limitations
4748
// t.Run("queries an invalid branch without error", func(t *testing.T) {
4849
// randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
50+
// repoName := fmt.Sprintf("%sinvalid-branch-%s", testResourcePrefix, randomID)
4951

5052
// config := fmt.Sprintf(`
5153
// resource "github_repository" "test" {
52-
// name = "tf-acc-test-%[1]s"
54+
// name = "%s"
5355
// auto_init = true
5456
// }
5557

5658
// data "github_branch" "test" {
5759
// repository = github_repository.test.name
5860
// branch = "xxxxxx"
5961
// }
60-
// `, randomID)
62+
// `, repoName)
6163

6264
// check := resource.ComposeTestCheckFunc(
6365
// resource.TestCheckResourceAttr(

0 commit comments

Comments
 (0)