MCPcopy Create free account
hub / github.com/github/gh-aw / TestCompileWorkflowWithRefresh

Function TestCompileWorkflowWithRefresh

pkg/cli/update_command_test.go:726–770  ·  view source on GitHub ↗

TestCompileWorkflowWithRefresh tests that compileWorkflowWithRefresh properly passes refreshStopTime

(t *testing.T)

Source from the content-addressed store, hash-verified

724
725// TestCompileWorkflowWithRefresh tests that compileWorkflowWithRefresh properly passes refreshStopTime
726func TestCompileWorkflowWithRefresh(t *testing.T) {
727
728 // Create a temporary directory for test files
729 tmpDir := testutil.TempDir(t, "test-*")
730
731 // Create a simple workflow file
732 workflowFile := filepath.Join(tmpDir, "test-workflow.md")
733 workflowContent := `---
734on:
735 workflow_dispatch:
736 stop-after: "+48h"
737permissions:
738 contents: read
739engine: copilot
740---
741
742# Test Workflow
743
744This is a test workflow.
745`
746 err := os.WriteFile(workflowFile, []byte(workflowContent), 0644)
747 if err != nil {
748 t.Fatalf("Failed to create test workflow file: %v", err)
749 }
750
751 // Test with refreshStopTime=false (should preserve existing stop time if lock exists)
752 t.Run("compileWorkflowWithRefresh false", func(t *testing.T) {
753 err := compileWorkflowWithRefresh(context.Background(), workflowFile, false, false, "", false)
754 if err != nil {
755 t.Logf("Compilation failed (expected in test environment): %v", err)
756 // In a test environment without full setup, compilation may fail,
757 // but we're testing that the function exists and accepts the parameter
758 }
759 })
760
761 // Test with refreshStopTime=true (should regenerate stop time)
762 t.Run("compileWorkflowWithRefresh true", func(t *testing.T) {
763 err := compileWorkflowWithRefresh(context.Background(), workflowFile, false, false, "", true)
764 if err != nil {
765 t.Logf("Compilation failed (expected in test environment): %v", err)
766 // In a test environment without full setup, compilation may fail,
767 // but we're testing that the function exists and accepts the parameter
768 }
769 })
770}
771
772// TestUpdateWorkflow_OverrideMode tests the default override mode behavior
773func TestUpdateWorkflow_DefaultMergeMode(t *testing.T) {

Callers

nothing calls this directly

Calls 4

TempDirFunction · 0.92
BackgroundMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected