test: satisfy testifylint assertions in agentdrain spec test#27907
test: satisfy testifylint assertions in agentdrain spec test#27907
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/eb8181b1-502b-4c36-bf57-03a2ad8484c4 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates pkg/agentdrain/spec_test.go assertions to satisfy testifylint by using assert.Empty / assert.Len instead of comparing len(...) to numeric literals.
Changes:
- Replaced
assert.Equal(t, 0, len(...))withassert.Empty(...) - Replaced
assert.Equal(t, 1, len(...))withassert.Len(..., 1)
Show a summary per file
| File | Description |
|---|---|
| pkg/agentdrain/spec_test.go | Adjusts assertions in the miner cluster-count spec mismatch test to align with testifylint-preferred patterns. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
🧪 Test Quality Sentinel ReportTest Quality Score: 100/100✅ Excellent test quality
Test Classification Details
What ChangedThis PR replaces two
The behavioral contract being tested is identical — only the assertion style changed. The test continues to verify:
Both assertion messages are preserved and descriptive. Language SupportTests analyzed:
Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators. References: §24806767912
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 100/100. Test quality is excellent — 0% of new tests are implementation tests (threshold: 30%). This PR makes a pure testifylint compliance improvement, replacing assert.Equal(t, N, len(x)) with the idiomatic assert.Empty/assert.Len equivalents. No behavioral coverage was reduced.
Summary
pkg/agentdrain/spec_test.gowith testifylint-preferred formsassert.Equal(t, 0, len(...))toassert.Empty(...)assert.Equal(t, 1, len(...))toassert.Len(..., 1)Why
Validation
make fmtgo test -v -run "TestSpec_PublicAPI_Miner_ClusterCount_SPEC_MISMATCH" ./pkg/agentdrainmake golintmake agent-finish(fails in this environment atmake recompiledue an existing workflow compilation issue:Successfully compiled 196 out of 197 workflow files)parallel_validation(Code Review + CodeQL)