Skip to content

Commit 3cb3452

Browse files
Copilotlpcox
andcommitted
fix: correct test conditions for preflight step count checks
Fix two categories of incorrectly written tests introduced with the Copilot pre-flight diagnostic step: 1. copilot_engine_test.go: Two "skips preflight" sub-tests checked `len(steps) != 2` but preflight is intentionally skipped, returning only 1 step. Change condition to `!= 1`. 2. engine_agent_import_test.go: Claude and Codex tests expected 2 steps (preflight + execution) like Copilot, but those engines only return 1 execution step. Change to `!= 1` and use `steps[0]`. Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent d7408f0 commit 3cb3452

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

pkg/workflow/copilot_engine_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,7 @@ func TestCopilotPreflightDiagnosticStep(t *testing.T) {
16791679
steps := engine.GetExecutionSteps(workflowData, "/tmp/gh-aw/test.log")
16801680

16811681
// Should have only 1 step: execution (no preflight)
1682-
if len(steps) != 2 {
1682+
if len(steps) != 1 {
16831683
t.Fatalf("Expected 1 step (execution only), got %d", len(steps))
16841684
}
16851685

@@ -1701,7 +1701,7 @@ func TestCopilotPreflightDiagnosticStep(t *testing.T) {
17011701
steps := engine.GetExecutionSteps(workflowData, "/tmp/gh-aw/test.log")
17021702

17031703
// Should have only 1 step: execution (no preflight)
1704-
if len(steps) != 2 {
1704+
if len(steps) != 1 {
17051705
t.Fatalf("Expected 1 step (execution only), got %d", len(steps))
17061706
}
17071707

pkg/workflow/engine_agent_import_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ func TestClaudeEngineWithAgentFromImports(t *testing.T) {
126126

127127
steps := engine.GetExecutionSteps(workflowData, "/tmp/gh-aw/test.log")
128128

129-
if len(steps) != 2 {
130-
t.Fatalf("Expected 2 execution steps (preflight + execution), got %d", len(steps))
129+
if len(steps) != 1 {
130+
t.Fatalf("Expected 1 execution step, got %d", len(steps))
131131
}
132132

133-
stepContent := strings.Join([]string(steps[1]), "\n")
133+
stepContent := strings.Join([]string(steps[0]), "\n")
134134

135135
// Check that custom agent content extraction is present
136136
if !strings.Contains(stepContent, `AGENT_CONTENT="$(awk`) {
@@ -160,11 +160,11 @@ func TestClaudeEngineWithoutAgentFile(t *testing.T) {
160160

161161
steps := engine.GetExecutionSteps(workflowData, "/tmp/gh-aw/test.log")
162162

163-
if len(steps) != 2 {
164-
t.Fatalf("Expected 2 execution steps (preflight + execution), got %d", len(steps))
163+
if len(steps) != 1 {
164+
t.Fatalf("Expected 1 execution step, got %d", len(steps))
165165
}
166166

167-
stepContent := strings.Join([]string(steps[1]), "\n")
167+
stepContent := strings.Join([]string(steps[0]), "\n")
168168

169169
// Should not have agent content extraction
170170
if strings.Contains(stepContent, "AGENT_CONTENT") {
@@ -190,11 +190,11 @@ func TestCodexEngineWithAgentFromImports(t *testing.T) {
190190

191191
steps := engine.GetExecutionSteps(workflowData, "/tmp/gh-aw/test.log")
192192

193-
if len(steps) != 2 {
194-
t.Fatalf("Expected 2 execution steps (preflight + execution), got %d", len(steps))
193+
if len(steps) != 1 {
194+
t.Fatalf("Expected 1 execution step, got %d", len(steps))
195195
}
196196

197-
stepContent := strings.Join([]string(steps[1]), "\n")
197+
stepContent := strings.Join([]string(steps[0]), "\n")
198198

199199
// Check that agent content extraction is present
200200
if !strings.Contains(stepContent, `AGENT_CONTENT="$(awk`) {
@@ -228,11 +228,11 @@ func TestCodexEngineWithoutAgentFile(t *testing.T) {
228228

229229
steps := engine.GetExecutionSteps(workflowData, "/tmp/gh-aw/test.log")
230230

231-
if len(steps) != 2 {
232-
t.Fatalf("Expected 2 execution steps (preflight + execution), got %d", len(steps))
231+
if len(steps) != 1 {
232+
t.Fatalf("Expected 1 execution step, got %d", len(steps))
233233
}
234234

235-
stepContent := strings.Join([]string(steps[1]), "\n")
235+
stepContent := strings.Join([]string(steps[0]), "\n")
236236

237237
// Should not have agent content extraction
238238
if strings.Contains(stepContent, "AGENT_CONTENT") {

0 commit comments

Comments
 (0)