Skip to content

Improve test quality: pkg/cli/awinfo_steps_test.go#24452

Merged
pelikhan merged 2 commits intomainfrom
copilot/testify-expert-improve-test-quality
Apr 4, 2026
Merged

Improve test quality: pkg/cli/awinfo_steps_test.go#24452
pelikhan merged 2 commits intomainfrom
copilot/testify-expert-improve-test-quality

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

awinfo_steps_test.go had no testify imports, used raw t.Fatalf/t.Errorf, relied on map[string]any for marshaling assertions, and had no coverage for GetFirewallVersion.

Changes

  • Testify adoption: replaced all t.Fatalf/t.Errorf with require.NoError/assert.Equal
  • Typed round-trip: refactored TestAwInfoStepsMarshaling to marshal AwInfo → JSON → AwInfo instead of unmarshaling into map[string]any with manual type assertions
  • New test: added TestGetFirewallVersion table-driven test covering all 4 cases (awf_version preferred, fallback to firewall_version, both empty, only new field set)
  • Cleanup: removed redundant description struct field (uses tt.name as message), removed t.Logf("✓ ...") noise

- 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
Copilot AI requested a review from pelikhan April 4, 2026 07:04
@pelikhan pelikhan marked this pull request as ready for review April 4, 2026 07:09
Copilot AI review requested due to automatic review settings April 4, 2026 07:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.Errorf with require.NoError / assert.Equal in awinfo_steps_test.go.
  • Refactor marshaling test to validate AwInfo -> JSON -> AwInfo typed round-trip instead of map[string]any assertions.
  • 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"],
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit 773b89e into main Apr 4, 2026
67 checks passed
@pelikhan pelikhan deleted the copilot/testify-expert-improve-test-quality branch April 4, 2026 07:14
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.

[testify-expert] Improve Test Quality: pkg/cli/awinfo_steps_test.go

3 participants