Skip to content

Commit

Permalink
Update acceptance tests to better verify entries order on the server …
Browse files Browse the repository at this point in the history
…post creation
  • Loading branch information
kklimonda-cl committed Jan 14, 2025
1 parent 378e450 commit c623d12
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions assets/terraform/test/resource_security_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ func TestAccSecurityPolicyOrdering(t *testing.T) {
nameSuffix := acctest.RandStringFromCharSet(6, acctest.CharSetAlphaNum)
prefix := fmt.Sprintf("test-acc-%s", nameSuffix)

rulesInitial := []string{"rule-1", "rule-2", "rule-3"}
rulesReordered := []string{"rule-2", "rule-1", "rule-3"}
rulesInitial := []string{"rule-1", "rule-2", "rule-3", "rule-4", "rule-5"}
rulesReordered := []string{"rule-2", "rule-1", "rule-3", "rule-4", "rule-5"}

prefixed := func(name string) string {
return fmt.Sprintf("%s-%s", prefix, name)
Expand Down Expand Up @@ -481,6 +481,8 @@ func TestAccSecurityPolicyOrdering(t *testing.T) {
stateExpectedRuleName(0, "rule-1"),
stateExpectedRuleName(1, "rule-2"),
stateExpectedRuleName(2, "rule-3"),
stateExpectedRuleName(3, "rule-4"),
stateExpectedRuleName(4, "rule-5"),
ExpectServerSecurityRulesCount(prefix, sdkLocation, len(rulesInitial)),
ExpectServerSecurityRulesOrder(prefix, sdkLocation, rulesInitial),
},
Expand Down Expand Up @@ -508,12 +510,16 @@ func TestAccSecurityPolicyOrdering(t *testing.T) {
planExpectedRuleName(0, "rule-2"),
planExpectedRuleName(1, "rule-1"),
planExpectedRuleName(2, "rule-3"),
planExpectedRuleName(3, "rule-4"),
planExpectedRuleName(4, "rule-5"),
},
},
ConfigStateChecks: []statecheck.StateCheck{
stateExpectedRuleName(0, "rule-2"),
stateExpectedRuleName(1, "rule-1"),
stateExpectedRuleName(2, "rule-3"),
stateExpectedRuleName(3, "rule-4"),
stateExpectedRuleName(4, "rule-5"),
ExpectServerSecurityRulesOrder(prefix, sdkLocation, rulesReordered),
},
},
Expand Down

0 comments on commit c623d12

Please sign in to comment.