-
Notifications
You must be signed in to change notification settings - Fork 4
Minor test cleanups. #624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor test cleanups. #624
Conversation
WalkthroughSmall test and CI adjustments: benchmark now checks the error from closing a temp file; correctness test initializes an SDK logger and reuses that contextual Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-03-10T17:07:23.395ZApplied to files:
📚 Learning: 2026-01-02T17:21:01.723ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (1)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @pkg/sync/expand/expand_correctness_test.go:
- Line 101: The code calls context.WithTimeout(ctx, 5*time.Minute) but ctx is
not defined; replace the undefined parent with a valid context (e.g., use
context.Background() or a test context) so the call becomes ctx, cancel :=
context.WithTimeout(context.Background(), 5*time.Minute) or, if there is an
existing parent context variable in the surrounding test, use that parent name
instead; ensure you still defer cancel() as appropriate.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
pkg/sync/expand/expand_benchmark_test.gopkg/sync/expand/expand_correctness_test.go
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ggreer
Repo: ConductorOne/baton-sdk PR: 616
File: pkg/synccompactor/compactor_test.go:44-52
Timestamp: 2026-01-02T17:21:10.051Z
Learning: In tests that specifically validate cleanup behavior (e.g., tests that check whether temp directories are empty after compaction), cleanup failures should fail the test using require.NoError(t, err) and similar assertions, as the cleanup functionality itself is what's being tested.
📚 Learning: 2026-01-02T17:21:01.723Z
Learnt from: ggreer
Repo: ConductorOne/baton-sdk PR: 616
File: pkg/synccompactor/compactor_test.go:44-52
Timestamp: 2026-01-02T17:21:01.723Z
Learning: In tests that verify cleanup behavior (e.g., ensuring temporary artifacts are removed or directories are empty after an operation), treat cleanup failures as test failures by asserting on the cleanup call (e.g., require.NoError(t, err) or assert.NoError(t, err)). This ensures that the cleanup path is explicitly tested and any cleanup error fails the test, confirming correct behavior of the cleanup code.
Applied to files:
pkg/sync/expand/expand_benchmark_test.gopkg/sync/expand/expand_correctness_test.go
🪛 GitHub Check: go-lint
pkg/sync/expand/expand_correctness_test.go
[failure] 101-101:
undefined: ctx (typecheck)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: go-test (1.25.2, ubuntu-latest)
- GitHub Check: go-test (1.25.2, windows-latest)
🔇 Additional comments (1)
pkg/sync/expand/expand_benchmark_test.go (1)
173-174: LGTM: Proper error handling for file close operation.Capturing and checking the Close() error is good practice and prevents potential silent failures in the benchmark setup.
- Check error in test. - Use t.Context() instead of context.Background(). - Log sync in sync correctness test. - Skip race condition test on Windows since its filesystem is very slow, causing CI to time out.
Summary by CodeRabbit
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.