Skip to content

fix(ci): use owned resource in posture zone test to prevent flakiness#703

Merged
tembleking merged 1 commit intomasterfrom
fix/flaky-posture-zone-test
Feb 11, 2026
Merged

fix(ci): use owned resource in posture zone test to prevent flakiness#703
tembleking merged 1 commit intomasterfrom
fix/flaky-posture-zone-test

Conversation

@tembleking
Copy link
Copy Markdown
Member

TestAccSecurePostureZone fails intermittently in CI (IBM Secure Acceptance Tests) at Step 3/4 with "plan was not empty" on policy_ids.

The test used data.sysdig_secure_posture_policies.all.policies[0].id to get a policy ID, but the data source returns policies in non-deterministic order from the API. Between apply and refresh, the data source is re-read and policies[0] can resolve to a different policy, causing drift.

This replaces the data source lookup with a test-owned sysdig_secure_posture_policy resource so the ID is stable across reads.

The test used `data.sysdig_secure_posture_policies.all.policies[0].id`
to reference a policy, but the data source returns policies in
non-deterministic order. Between apply and refresh, re-reading the data
source could yield a different policy at index 0, causing "plan was not
empty" failures on `policy_ids`.

Replace the data source lookup with a test-owned
`sysdig_secure_posture_policy` resource so the ID is stable across
reads.
Copilot AI review requested due to automatic review settings February 11, 2026 15:57
@tembleking tembleking requested a review from a team as a code owner February 11, 2026 15:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes flakiness in the TestAccSecurePostureZone acceptance test by replacing non-deterministic policy lookups with a test-owned resource. The test was failing intermittently because it relied on a data source that returned policies in an unpredictable order, causing plan drift between apply and refresh operations.

Changes:

  • Replaced the sysdig_secure_posture_policies data source with a dedicated sysdig_secure_posture_policy resource
  • Updated the zone resource to reference the stable policy ID from the test-owned resource

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sysdig/resource_sysdig_secure_posture_zone_test.go
@tembleking tembleking changed the title fix(test): use owned resource in posture zone test to prevent flakiness fix(ci): use owned resource in posture zone test to prevent flakiness Feb 11, 2026
@tembleking tembleking enabled auto-merge February 11, 2026 15:59
@tembleking tembleking added this pull request to the merge queue Feb 11, 2026
Merged via the queue into master with commit b21bd24 Feb 11, 2026
177 checks passed
@tembleking tembleking deleted the fix/flaky-posture-zone-test branch February 11, 2026 16:29
fcracker79 pushed a commit that referenced this pull request Mar 5, 2026
…#703)

`TestAccSecurePostureZone` fails intermittently in CI (IBM Secure
Acceptance Tests) at Step 3/4 with "plan was not empty" on `policy_ids`.

The test used `data.sysdig_secure_posture_policies.all.policies[0].id`
to get a policy ID, but the data source returns policies in
non-deterministic order from the API. Between apply and refresh, the
data source is re-read and `policies[0]` can resolve to a different
policy, causing drift.

This replaces the data source lookup with a test-owned
`sysdig_secure_posture_policy` resource so the ID is stable across
reads.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants