feat(xtest): add audit cancel event tests#411
feat(xtest): add audit cancel event tests#411dmihalcik-virtru wants to merge 5 commits intoopentdf:mainfrom
Conversation
Summary of ChangesHello @dmihalcik-virtru, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the robustness and reliability of audit log testing by introducing new integration tests for deferred audit event guarantees, particularly focusing on scenarios involving client disconnections. It refines the underlying audit log collection mechanism for improved efficiency and clarity, ensuring that audit events are consistently captured and accurately reflect various operation outcomes. Additionally, it updates related test fixtures and dependencies to support these new testing capabilities. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive test suite for deferred audit event guarantees, particularly focusing on client cancellation scenarios. The changes in audit_logs.py to use threading.Condition for more efficient log waiting are a significant improvement. The new tests in test_audit_cancel.py are well-structured and provide good coverage for this critical feature.
My review includes a few suggestions to improve code quality and test clarity:
- Simplifying some redundant conditional logic in
audit_logs.py. - Aligning test names and docstrings with their implementations in
test_audit_logs_integration.pyto avoid confusion. - Adhering to PEP 8 for import statements.
Overall, this is a solid contribution that enhances the robustness of the audit logging tests.
de3ec12 to
5fac89c
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive integration tests for deferred audit event guarantees, ensuring that audit events are properly logged even when operations are interrupted by client disconnection. The PR builds on parent PR #408 which improved audit log collection infrastructure.
Changes:
- Added
test_audit_cancel.pywith 340 lines of test coverage for deferred/cancel audit event guarantees using a staggered-kill strategy - Enhanced
otdf-local envcommand to fall back to git describe for platform version detection when API is unavailable - Updated documentation in
AGENTS.mdfiles to reflect the new workflow for generating environment variables from otdf-local - Added
local.envto.gitignore - Integrated audit cancel tests into the GitHub Actions workflow
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| xtest/test_audit_cancel.py | New test file implementing staggered-kill strategy to test deferred audit guarantees across cancellation, success, and failure scenarios |
| otdf-local/src/otdf_local/cli.py | Added git describe fallback for platform version detection in the env command |
| AGENTS.md | Updated to recommend generating local.env from otdf-local env command |
| otdf-local/AGENTS.md | Updated environment setup examples to use local.env generation workflow |
| .gitignore | Added xtest/local.env to ignored files |
| .github/workflows/xtest.yml | Added workflow step to run audit cancel tests in CI |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add test coverage for deferred/cancel audit event guarantees with 340-line test file covering cancel audit event scenarios. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: David Mihalcik <dmihalcik@virtru.com>
…tion The platform API doesn't always expose a version field in its .well-known/opentdf-configuration response. Without PLATFORM_VERSION, xtest defaults to 0.9.0 which disables audit_logging feature detection, causing audit cancel tests to be skipped. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Runs audit cancel tests after ABAC tests with the same multi-KAS and audit log environment. Runs without parallel execution to avoid timing flakiness from staggered process kill assertions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5fac89c to
57ee69c
Compare
|



Summary
test_audit_cancel.pywith 340 lines of test coverage for deferred/cancel audit event guaranteesParent PRs
fix/xtest-audit-framework)Test plan
cd xtest && uv run ruff check . && uv run pyrightuv run pytest test_audit_cancel.py --sdks go -v🤖 Generated with Claude Code
Part of stacked PR series decomposing
chore/the-claudiest-day-tmux