MCPcopy Index your code
hub / github.com/github/gh-aw / TestCollectWorkflowFiles_NoLockFile

Function TestCollectWorkflowFiles_NoLockFile

pkg/cli/run_push_integration_test.go:19–50  ·  view source on GitHub ↗

TestCollectWorkflowFiles_NoLockFile tests that when a workflow has no lock file, the collectWorkflowFiles function compiles the workflow and creates one. This is an integration test because it invokes the full workflow compilation.

(t *testing.T)

Source from the content-addressed store, hash-verified

17// the collectWorkflowFiles function compiles the workflow and creates one.
18// This is an integration test because it invokes the full workflow compilation.
19func TestCollectWorkflowFiles_NoLockFile(t *testing.T) {
20
21 // Create a temporary directory for testing
22 tmpDir := t.TempDir()
23
24 // Create a simple workflow file without a lock file
25 workflowPath := filepath.Join(tmpDir, "test-workflow.md")
26 workflowContent := `---
27name: Test Workflow
28on: workflow_dispatch
29---
30# Test Workflow
31This is a test workflow without a lock file.
32`
33 err := os.WriteFile(workflowPath, []byte(workflowContent), 0644)
34 require.NoError(t, err)
35
36 // Test collecting files - should now compile the workflow and create lock file
37 files, err := collectWorkflowFiles(context.Background(), workflowPath, false, false)
38 require.NoError(t, err)
39 assert.Len(t, files, 2, "Should collect workflow .md file and auto-generate lock file")
40
41 // Check that both workflow file and lock file are in the result
42 fileSet := make(map[string]bool)
43 for _, file := range files {
44 fileSet[file] = true
45 }
46 assert.True(t, fileSet[workflowPath], "Should include workflow .md file")
47
48 lockFilePath := stringutil.MarkdownToLockFile(workflowPath)
49 assert.True(t, fileSet[lockFilePath], "Should include auto-generated lock .yml file")
50}

Callers

nothing calls this directly

Calls 3

MarkdownToLockFileFunction · 0.92
collectWorkflowFilesFunction · 0.85
BackgroundMethod · 0.80

Tested by

no test coverage detected