Skip to content

Commit 1e423ad

Browse files
committed
test: fix agent policy test to use Set assertion instead of List index
Update TestAccResourceAgentPolicy to use TestCheckTypeSetElemAttr instead of index-based assertion for space_ids. Sets don't guarantee element order, so index-based checks (space_ids.0) are incorrect. This brings the test in line with the Set migration and matches the pattern used in TestAccResourceAgentPolicySpaceReordering.
1 parent 2b13928 commit 1e423ad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/fleet/agent_policy/acc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ func TestAccResourceAgentPolicyWithSpaceIds(t *testing.T) {
297297
resource.TestCheckResourceAttr("elasticstack_fleet_agent_policy.test_policy", "namespace", "default"),
298298
resource.TestCheckResourceAttr("elasticstack_fleet_agent_policy.test_policy", "description", "Test Agent Policy with Space IDs"),
299299
resource.TestCheckResourceAttr("elasticstack_fleet_agent_policy.test_policy", "space_ids.#", "1"),
300-
resource.TestCheckResourceAttr("elasticstack_fleet_agent_policy.test_policy", "space_ids.0", "default"),
300+
resource.TestCheckTypeSetElemAttr("elasticstack_fleet_agent_policy.test_policy", "space_ids.*", "default"),
301301
),
302302
},
303303
},

0 commit comments

Comments
 (0)