Skip to content

Fix false failures in nsxt_policy_project acceptance tests without TF_ACC - #2283

Open
ksamoray wants to merge 1 commit into
vmware:masterfrom
ksamoray:fix/policy-project-acc-test-precheck-guard
Open

Fix false failures in nsxt_policy_project acceptance tests without TF_ACC#2283
ksamoray wants to merge 1 commit into
vmware:masterfrom
ksamoray:fix/policy-project-acc-test-precheck-guard

Conversation

@ksamoray

Copy link
Copy Markdown
Contributor

Summary

  • getExpectedSiteInfoCount (used by several nsxt_policy_project acceptance tests) opened a real NSX policy connector to determine NSX version before resource.ParallelTest ran its own TF_ACC skip check. Without TF_ACC set (or without network access to an NSX manager), this caused the test to be reported FAILED instead of SKIPPED.
  • Added an explicit TF_ACC guard (using resource.EnvTfAcc, the same constant the SDK uses internally) so the function short-circuits and returns "0" when acceptance tests are not enabled, matching the SDK's own skip behavior.

Test plan

  • go build ./...
  • golangci-lint run ./nsxt/ - 0 issues
  • go test ./... - all tests now pass; TestAccResourceNsxtPolicyProject_900basic/910basic/920basic/420basic now correctly SKIP instead of FAIL when TF_ACC is unset

🤖 Generated with Claude Code

Without this, tests calling it fail instead of skipping when TF_ACC
is unset, since it opens a real NSX connector before resource.Test's
own TF_ACC skip check runs.
@ksamoray
ksamoray requested a review from a team August 25, 2026 11:30
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.

1 participant