Skip to content

Improve test quality: migrate tracker_id_integration_test.go to testify assertions - #51178

Merged
pelikhan merged 6 commits into
mainfrom
copilot/testify-expert-improve-test-quality-again
Aug 7, 2026
Merged

Improve test quality: migrate tracker_id_integration_test.go to testify assertions#51178
pelikhan merged 6 commits into
mainfrom
copilot/testify-expert-improve-test-quality-again

Conversation

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

pkg/workflow/tracker_id_integration_test.go relied entirely on raw t.Fatalf/t.Errorf, lacked coverage for invalid tracker-id values despite documented validation constraints (min 8 chars, alphanumeric + hyphens/underscores), and used manual os.Remove cleanup that could be skipped on early test failures.

  • Testify migration: replaced t.Fatalf/t.Errorf with require.NoError/require.Error for compile-step assertions and assert.Contains/assert.NotContains for content checks, so a subtest can surface multiple independent failures instead of stopping at the first one.
  • New test cases: added subtests for too-short tracker-id, tracker-id with spaces, tracker-id with invalid characters (all expected to fail compilation), and a tracker-id combined with multiple safe-outputs (create-issue + create-pull-request) in the same workflow.
  • Cleanup hardening: each subtest now creates its own tmpDir via testutil.TempDir, which registers t.Cleanup internally, removing the need for manual os.Remove calls at the end of the subtest and ensuring cleanup runs on early failures or panics. This also removes the shared-filename risk across subtests, making them safe for future t.Parallel().
  • Shared helper: extracted assertScriptUsesRequire(t, contentStr) for the repeated "env var set + script loaded via require()" assertion pattern, intended to be reusable across sibling *_integration_test.go files.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.1 AIC · ⊞ 8.5K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve test quality for integration test in tracker_id Improve test quality: migrate tracker_id_integration_test.go to testify assertions Aug 7, 2026
Copilot AI requested a review from pelikhan August 7, 2026 20:11
@pelikhan
pelikhan marked this pull request as ready for review August 7, 2026 20:15
Copilot AI balanced review requested due to automatic review settings August 7, 2026 20:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves tracker ID integration tests with Testify, broader validation coverage, and safer temporary-file cleanup.

Changes:

  • Migrates assertions to Testify.
  • Adds invalid and multi-output tracker ID cases.
  • Uses per-subtest temporary directories and extracts a shared assertion helper.
Show a summary per file
File Description
pkg/workflow/tracker_id_integration_test.go Expands and refactors tracker ID integration tests.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Balanced

// mode, not inline).
func assertScriptUsesRequire(t *testing.T, contentStr string) {
t.Helper()
assert.Contains(t, contentStr, "GH_AW_TRACKER_ID", "expected GH_AW_TRACKER_ID environment variable to be set")
if tt.shouldCompile {
require.NoError(t, err, "expected compilation to succeed")
} else {
require.Error(t, err, "expected compilation to fail")
@pelikhan

pelikhan commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

@copilot lint go

@pelikhan

pelikhan commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Copilot AI and others added 2 commits August 7, 2026 21:08
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix https://github.com/github/gh-aw/actions/runs/31215110611/job/92987222216?pr=51178

Fixed in 77a723c. The referenced custom lint checks now pass.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🎯 Excellent work on the test quality improvements! This PR tackles exactly what the testify-expert review flagged in #51152 — migrating the tracker_id_integration_test.go file from raw t.Fatalf/t.Errorf to structured testify assertions, plus adding crucial edge-case coverage for invalid tracker-id values.

What stands out:

  • ✅ Comprehensive testify migration with proper use of require.NoError/require.Error for fatal assertions and assert.Contains/assert.NotContains for flexible checks
  • ✅ New subtests for validation boundaries (too-short, spaces, invalid characters)
  • ✅ Smart cleanup hardening via t.Cleanup registered per-subtest, removing the manual os.Remove risk
  • ✅ Extracted assertScriptUsesRequire helper for reusable patterns across sibling integration tests
  • ✅ Well-documented PR body with clear rationale for each change

This PR is ready for review and merge. The changes directly improve maintainability and test signal quality, and align perfectly with the project's test-driven agentic workflow.

Generated by ✅ Contribution Check · auto · 78.4 AIC · ⊞ 8.7K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage nudge for this PR.

Please refresh the branch, address any remaining review feedback, run the pr-finisher skill, and push follow-up fixes.

  • no recorded failed checks in compact candidate data

Run: https://github.com/github/gh-aw/actions/runs/31218745745

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.1 AIC · ⊞ 8.5K ·
Comment /souschef to run again

@pelikhan
pelikhan merged commit 475927d into main Aug 7, 2026
1 of 3 checks passed
@pelikhan
pelikhan deleted the copilot/testify-expert-improve-test-quality-again branch August 7, 2026 21:20
Copilot stopped work on behalf of gh-aw-bot due to an error August 7, 2026 21:20
Copilot AI requested a review from gh-aw-bot August 7, 2026 21:20
Copilot AI added a commit that referenced this pull request Aug 7, 2026
…fy assertions (#51178)

* Initial plan

* Improve test quality: migrate tracker_id_integration_test.go to testify

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Fix engine definition custom lint findings

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Use consistent engine import empty checks

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.86.1

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/workflow/tracker_id_integration_test.go

4 participants