TestCompileWorkflowWithRefresh tests that compileWorkflowWithRefresh properly passes refreshStopTime
(t *testing.T)
| 724 | |
| 725 | // TestCompileWorkflowWithRefresh tests that compileWorkflowWithRefresh properly passes refreshStopTime |
| 726 | func 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 := `--- |
| 734 | on: |
| 735 | workflow_dispatch: |
| 736 | stop-after: "+48h" |
| 737 | permissions: |
| 738 | contents: read |
| 739 | engine: copilot |
| 740 | --- |
| 741 | |
| 742 | # Test Workflow |
| 743 | |
| 744 | This 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 |
| 773 | func TestUpdateWorkflow_DefaultMergeMode(t *testing.T) { |
nothing calls this directly
no test coverage detected