[AV-128970] Add acceptance tests for query index datasources#625
[AV-128970] Add acceptance tests for query index datasources#625panigrahisubhrajit wants to merge 6 commits into
Conversation
Covers query_indexes datasource (list with scope+collection, bucket-level only, scope-only filter, invalid cluster, invalid bucket, nonexistent scope, missing bucket_name) and query_index_monitor datasource (ready non-deferred index, multiple ready indexes, deferred index warning, nonexistent index warning, invalid cluster, missing/empty indexes set). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add setvalidator.SizeAtLeast(1) to query_index_monitor indexes attribute so an empty set is rejected at plan time. Skip three monitor tests that hang for 60 minutes due to WatchIndexes not failing fast on permanent errors; tracked in AV-132670 and AV-132671. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Droid finished @panigrahisubhrajit's task —— View job |
There was a problem hiding this comment.
Pull request overview
Adds acceptance test coverage for the couchbase-capella_query_indexes and couchbase-capella_query_index_monitor datasources, and adds a SizeAtLeast(1) validator on the monitor datasource's indexes attribute so an empty set is rejected at plan time instead of silently succeeding. Three monitor tests that would hang for 60 minutes due to existing WatchIndexes behavior are skipped pending fixes tracked in AV-132670/AV-132671.
Changes:
- New acceptance test file covering query_indexes (full/bucket-only/scope-only/invalid variants) and query_index_monitor (ready/multi/missing/skipped error cases).
- Adds set validator
SizeAtLeast(1)onindexesin the GSI monitor datasource schema.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/datasources/gsi_monitor_schema.go | Adds validator import and SizeAtLeast(1) on the indexes set attribute. |
| acceptance_tests/query_index_acceptance_test.go | New file with acceptance tests for query indexes and query index monitor datasources, including skipped tests linked to bug tickets. |
| resource.TestCheckResourceAttr(dsReference, "bucket_name", globalBucketName), | ||
| resource.TestCheckResourceAttr(dsReference, "scope_name", globalScopeName), | ||
| resource.TestCheckResourceAttr(dsReference, "collection_name", globalCollectionName), | ||
| resource.TestCheckResourceAttrSet(dsReference, "data.#"), |
There was a problem hiding this comment.
[P2] data.# assertions can pass even when the datasource returns zero rows
resource.TestCheckResourceAttrSet(dsReference, "data.#") will pass when the datasource returns an empty list because data.# is still set (to the string "0"). This can let this test succeed even if the created index is not returned. Add a non-zero count check or assert the created index name appears in data.
There was a problem hiding this comment.
Validated all candidate comments for this PR. Approved one actionable test-correctness issue (data.# can false-pass at "0"), and rejected one speculative flakiness report whose stated state-corruption path is not supported by current provider behavior.
- Return ErrIndexDeferred immediately when index status is Deferred instead of polling 60 minutes (AV-132671) - Fail fast on non-404 API errors; limit consecutive 404 retries to 5 before giving up, preventing 60-minute hang on invalid cluster IDs (AV-132670) - Distinguish timeout (warning) from permanent failure (error) in gsi_monitor - Re-enable Deferred, NonexistentIndex, InvalidCluster acceptance tests with ExpectError now that the datasource returns errors for these cases Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ed pattern maxConsecutive404s=5 caused 31-minute wait (1+2+4+8+16 min) exceeding the 30-minute test timeout on Azure. Reducing to 3 caps the wait at 7 minutes. Update deferred test ExpectError to match the error title rather than the status string, which also handles transient network errors (DNS failure). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The API returns 200 OK with a non-Deferred status for a deferred index, so WatchIndexes polls at 1 req/sec indefinitely and the test always times out at 30 minutes. Skip until the exact status string is known so ErrIndexDeferred can be triggered correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Jira
Description
Adds acceptance tests for
couchbase-capella_query_indexesandcouchbase-capella_query_index_monitordatasources. Fixes three provider bugs found during testing: (1)query_index_monitoraccepted an emptyindexesset and silently succeeded — now rejected at plan time; (2)WatchIndexespolled for 60 minutes on a permanently-invalid cluster ID instead of failing fast — now fails after 5 consecutive 404s (AV-132670); (3)WatchIndexespolled 60 minutes for a deferred index that can never self-resolve — now returns an error immediately when index status isDeferred(AV-132671).Type of Change
Manual Testing Approach
How was this change tested and do you have evidence? (REQUIRED: Select at least 1)
Testing
Testing
Further comments