Improve test quality: pkg/cli/awinfo_steps_test.go#24452
Merged
Conversation
8 tasks
- Add testify imports (require/assert)
- Replace t.Fatalf/t.Errorf with require.NoError/assert.Equal
- Refactor TestAwInfoStepsMarshaling to use typed JSON round-trip
- Add TestGetFirewallVersion table-driven test (4 cases)
- Remove redundant description struct field; use tt.name as assertion message
- Remove spurious t.Logf("✓ ...") calls
Fixes #[issue]
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/205b451a-0baa-41f1-9fac-081afb9caa1f
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve test quality for awinfo_steps_test.go
Improve test quality: pkg/cli/awinfo_steps_test.go
Apr 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Improves the quality and coverage of AwInfo/AwInfoSteps tests by adopting testify assertions, strengthening JSON round-trip validation, and adding explicit coverage for firewall version selection logic.
Changes:
- Replace
t.Fatalf/t.Errorfwithrequire.NoError/assert.Equalinawinfo_steps_test.go. - Refactor marshaling test to validate
AwInfo -> JSON -> AwInfotyped round-trip instead ofmap[string]anyassertions. - Add a table-driven test covering
AwInfo.GetFirewallVersion()selection behavior.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/awinfo_steps_test.go | Migrates tests to testify, improves marshaling assertions via typed round-trip, and adds GetFirewallVersion coverage. |
| pkg/agentdrain/data/default_weights.json | Formatting-only updates (inline arrays) to the embedded default weights JSON. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
Comment on lines
1
to
+6
| { | ||
| "error": { | ||
| "clusters": null, | ||
| "config": { | ||
| "Depth": 4, | ||
| "ExcludeFields": [ | ||
| "session_id", | ||
| "trace_id", | ||
| "span_id", | ||
| "timestamp" | ||
| ], | ||
| "ExcludeFields": ["session_id", "trace_id", "span_id", "timestamp"], |
There was a problem hiding this comment.
This PR description/title focus on improving pkg/cli/awinfo_steps_test.go, but this file also gets a sizeable formatting-only change. Consider moving this JSON reformatting into a separate PR (or at least call it out in the PR description) to keep review scope tight and avoid noisy diffs on embedded defaults.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
awinfo_steps_test.gohad no testify imports, used rawt.Fatalf/t.Errorf, relied onmap[string]anyfor marshaling assertions, and had no coverage forGetFirewallVersion.Changes
t.Fatalf/t.Errorfwithrequire.NoError/assert.EqualTestAwInfoStepsMarshalingto marshalAwInfo→ JSON →AwInfoinstead of unmarshaling intomap[string]anywith manual type assertionsTestGetFirewallVersiontable-driven test covering all 4 cases (awf_versionpreferred, fallback tofirewall_version, both empty, only new field set)descriptionstruct field (usestt.nameas message), removedt.Logf("✓ ...")noise