Skip to content

CBG-5284 fix hiding SDK exceptions in couchbaseserver.py - #521

Open
torcolvin wants to merge 2 commits into
mainfrom
CBG-5284-fix-exception
Open

CBG-5284 fix hiding SDK exceptions in couchbaseserver.py#521
torcolvin wants to merge 2 commits into
mainfrom
CBG-5284-fix-exception

Conversation

@torcolvin

Copy link
Copy Markdown
Collaborator

CBG-5284 fix hiding SDK exceptions in couchbaseserver.py

  • Remove _try_n_times with a single get_bucket function that uses tenacity retry function
  • always use raise -> from syntax so we don't drop the exception messages

This isn't the cause of the test failure, but we were hiding the real failure in raise CblTestError(f"Unable to properly create {bucket}.{scope}.{name} in Couchbase Server"). Upcoming PR for the real fix.

- Remove _try_n_times with a single get_bucket function that uses
  tenacity retry function
- always use raise -> from syntax so we don't drop the exception messages

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

upsert_document_xattr still bypasses the new get_bucket() retry path, reintroducing inconsistent behavior for transient bucket-availability failures.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the Couchbase Server client utilities in the TDK (client/src/cbltest) to avoid masking underlying Couchbase SDK exceptions and to standardize retry behavior by leaning on tenacity and exception chaining (raise … from e).

Changes:

  • Removed the legacy _try_n_times helper and migrated bucket/collection readiness polling to tenacity-based retries.
  • Updated several error paths to use exception chaining (from e) so the original SDK exception context is preserved.
  • Refactored bucket readiness waiting in create_bucket() to use retry_assert() with explicit readiness assertions.
File summaries
File Description
client/src/cbltest/utils.py Removes _try_n_times in favor of existing tenacity-based retry helpers.
client/src/cbltest/api/couchbaseserver.py Introduces get_bucket() with tenacity retry, adds collection readiness probing via retry, and switches multiple error raises to raise … from e.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread client/src/cbltest/api/couchbaseserver.py
Addresses PR review: upsert_document_xattr and delete_document_xattr
opened the bucket directly, bypassing the retry policy the other
document operations use.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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