Improve pkg/workflow/compiler_test.go quality with clearer assertions and missing edge-case coverage#33897
Conversation
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
pkg/workflow/compiler_test.go quality with clearer assertions and missing edge-case coverage
|
Hey Issue with the process:
If this work was meant to address a specific quality gap, consider:
If you're a core team member using this bot, please link the issue this PR addresses or clarify the workflow context. Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "patchdiff.githubusercontent.com"See Network Configuration for more information.
|
There was a problem hiding this comment.
Pull request overview
Improves unit test quality and coverage in pkg/workflow/compiler_test.go by adding clearer assertion messages, replacing manual error reporting with structured testify assertions, and introducing explicit regression tests for template-injection validation fallback behavior and readLockFileFromHEAD across common git states.
Changes:
- Added descriptive context strings to multiple
require.NoError/require.NoErrorfassertions for better CI diagnostics. - Simplified concurrent/performance test failure reporting via
assert.Emptyandrequire.LessOrEqual. - Added new tests covering: malformed-YAML handling in template-injection fallback scanning, and
readLockFileFromHEADbehavior for missing git root / committed-vs-working-tree content / absent file in HEAD.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/compiler_test.go | Improves assertion diagnostics and adds targeted edge-case tests for template-injection fallback and HEAD lockfile reads. |
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
This issue targeted incremental test-quality improvements in
pkg/workflow/compiler_test.go: better assertion diagnostics, less manual error reporting, and explicit edge-case coverage for template-injection validation and HEAD lockfile reads.This PR focuses on those gaps without changing production behavior.
Assertion quality and diagnostics
require.NoError(t, err)calls incompiler_test.go.Manual error reporting → testify assertions
t.Errorffailure reporting in concurrent compilation checks with structured testify assertions for clearer, single-point failures.Template-injection fallback edge case
TestValidateTemplateInjection_IgnoresMalformedYAMLInFallbackto cover theparsedWorkflow == nilpath when YAML reparsing fails.readLockFileFromHEADgit-state coverageTestReadLockFileFromHEAD_GitStateswith subtests for:gitRoot