Skip to content

Commit 6209daa

Browse files
committed
Refactor repository property names in organization ruleset tests for consistency
1 parent 24d2bcb commit 6209daa

1 file changed

Lines changed: 11 additions & 24 deletions

File tree

github/resource_github_organization_ruleset_test.go

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ resource "github_organization_ruleset" "test" {
185185
t.Run("create_ruleset_with_repository_property", func(t *testing.T) {
186186
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
187187
rulesetName := fmt.Sprintf("%s-repo-prop-ruleset-%s", testResourcePrefix, randomID)
188-
propName := fmt.Sprintf("e2e_test_team_%s", randomID)
188+
propName := fmt.Sprintf("%s_team_%s", testResourcePrefix, randomID)
189189

190190
config := fmt.Sprintf(`
191191
resource "github_organization_custom_properties" "team" {
@@ -203,7 +203,7 @@ resource "github_organization_ruleset" "test" {
203203
conditions {
204204
repository_property {
205205
include = [{
206-
name = "%[2]s"
206+
name = github_organization_custom_properties.team.property_name
207207
source = "custom"
208208
property_values = ["blue"]
209209
}]
@@ -222,8 +222,6 @@ resource "github_organization_ruleset" "test" {
222222
deletion = true
223223
required_linear_history = true
224224
}
225-
226-
depends_on = [github_organization_custom_properties.team]
227225
}
228226
`, rulesetName, propName)
229227

@@ -251,7 +249,7 @@ resource "github_organization_ruleset" "test" {
251249
t.Run("create_ruleset_with_repository_property_exclude", func(t *testing.T) {
252250
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
253251
rulesetName := fmt.Sprintf("%s-repo-prop-exclude-ruleset-%s", testResourcePrefix, randomID)
254-
propName := fmt.Sprintf("e2e_test_team_%s", randomID)
252+
propName := fmt.Sprintf("%s_team_%s", testResourcePrefix, randomID)
255253

256254
config := fmt.Sprintf(`
257255
resource "github_organization_custom_properties" "team" {
@@ -270,7 +268,7 @@ resource "github_organization_ruleset" "test" {
270268
repository_property {
271269
include = []
272270
exclude = [{
273-
name = "%[2]s"
271+
name = github_organization_custom_properties.team.property_name
274272
source = "custom"
275273
property_values = ["red"]
276274
}]
@@ -285,8 +283,6 @@ resource "github_organization_ruleset" "test" {
285283
rules {
286284
required_linear_history = true
287285
}
288-
289-
depends_on = [github_organization_custom_properties.team]
290286
}
291287
`, rulesetName, propName)
292288

@@ -312,8 +308,8 @@ resource "github_organization_ruleset" "test" {
312308
t.Run("create_ruleset_with_multiple_repository_properties", func(t *testing.T) {
313309
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
314310
rulesetName := fmt.Sprintf("%s-repo-prop-multiple-%s", testResourcePrefix, randomID)
315-
propEnvironmentName := fmt.Sprintf("e2e_test_environment_%s", randomID)
316-
propTierName := fmt.Sprintf("e2e_test_tier_%s", randomID)
311+
propEnvironmentName := fmt.Sprintf("%s_environment_%s", testResourcePrefix, randomID)
312+
propTierName := fmt.Sprintf("%s_tier_%s", testResourcePrefix, randomID)
317313

318314
config := fmt.Sprintf(`
319315
resource "github_organization_custom_properties" "environment" {
@@ -339,12 +335,12 @@ resource "github_organization_ruleset" "test" {
339335
repository_property {
340336
include = [
341337
{
342-
name = "%[2]s"
338+
name = github_organization_custom_properties.environment.property_name
343339
source = "custom"
344340
property_values = ["production"]
345341
},
346342
{
347-
name = "%[3]s"
343+
name = github_organization_custom_properties.tier.property_name
348344
source = "custom"
349345
property_values = ["premium", "enterprise"]
350346
}
@@ -361,11 +357,6 @@ resource "github_organization_ruleset" "test" {
361357
rules {
362358
required_signatures = true
363359
}
364-
365-
depends_on = [
366-
github_organization_custom_properties.environment,
367-
github_organization_custom_properties.tier,
368-
]
369360
}
370361
`, rulesetName, propEnvironmentName, propTierName)
371362

@@ -396,7 +387,7 @@ resource "github_organization_ruleset" "test" {
396387
t.Run("update_repository_property", func(t *testing.T) {
397388
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
398389
rulesetName := fmt.Sprintf("%s-repo-prop-update-%s", testResourcePrefix, randomID)
399-
propName := fmt.Sprintf("e2e_test_team_%s", randomID)
390+
propName := fmt.Sprintf("%s_team_%s", testResourcePrefix, randomID)
400391

401392
config := fmt.Sprintf(`
402393
resource "github_organization_custom_properties" "team" {
@@ -414,7 +405,7 @@ resource "github_organization_ruleset" "test" {
414405
conditions {
415406
repository_property {
416407
include = [{
417-
name = "%[2]s"
408+
name = github_organization_custom_properties.team.property_name
418409
source = "custom"
419410
property_values = ["blue"]
420411
}]
@@ -430,8 +421,6 @@ resource "github_organization_ruleset" "test" {
430421
rules {
431422
creation = true
432423
}
433-
434-
depends_on = [github_organization_custom_properties.team]
435424
}
436425
`, rulesetName, propName)
437426

@@ -451,7 +440,7 @@ resource "github_organization_ruleset" "test" {
451440
conditions {
452441
repository_property {
453442
include = [{
454-
name = "%[2]s"
443+
name = github_organization_custom_properties.team.property_name
455444
source = "custom"
456445
property_values = ["backend", "platform"]
457446
}]
@@ -468,8 +457,6 @@ resource "github_organization_ruleset" "test" {
468457
creation = true
469458
update = true
470459
}
471-
472-
depends_on = [github_organization_custom_properties.team]
473460
}
474461
`, rulesetName, propName)
475462

0 commit comments

Comments
 (0)