1515package compiler
1616
1717import (
18- "flag"
1918 "fmt"
20- "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
21- matcher "github.com/kubeflow/pipelines/backend/test/compiler/matchers"
2219 "os"
2320 "path/filepath"
24- "sigs.k8s.io/yaml"
2521 "strings"
2622
2723 "github.com/kubeflow/pipelines/backend/src/apiserver/config/proxy"
2824 "github.com/kubeflow/pipelines/backend/src/v2/compiler/argocompiler"
25+ matcher "github.com/kubeflow/pipelines/backend/test/compiler/matchers"
2926 workflowutils "github.com/kubeflow/pipelines/backend/test/compiler/utils"
3027 . "github.com/kubeflow/pipelines/backend/test/constants"
3128 "github.com/kubeflow/pipelines/backend/test/logger"
@@ -35,8 +32,6 @@ import (
3532 . "github.com/onsi/gomega"
3633)
3734
38- var regenerateAllSkipTests = flag .Bool ("regenerate" , false , "Regenerate all compiled workflow and skip tests" )
39-
4035var _ = BeforeEach (func () {
4136 logger .Log ("Initializing proxy config..." )
4237 proxy .InitializeConfigWithEmptyForTests ()
@@ -72,26 +67,10 @@ var _ = Describe("Verify Spec Compilation to Workflow >", Label(POSITIVE, WORKFL
7267 fileNameWithoutExtension := strings .TrimSuffix (pipelineSpecFileName , fileExtension )
7368 compiledWorkflowFileName := fileNameWithoutExtension + ".yaml"
7469 compiledWorkflowFilePath := filepath .Join (argoYAMLDir , compiledWorkflowFileName )
75-
76- if * regenerateAllSkipTests {
77- pipelineSpecs , platformSpec := workflowutils .LoadPipelineSpecsFromIR (
78- pipelineSpecFilePath ,
79- param .compilerOptions .CacheDisabled ,
80- nil ,
81- )
82- regeneratedWf := workflowutils .GetCompiledArgoWorkflow (pipelineSpecs , platformSpec , & param .compilerOptions )
83- err := RegenerateSpec (compiledWorkflowFilePath , * regeneratedWf )
84- if err != nil {
85- Fail (fmt .Sprintf ("Critical error: %v" , err ))
86- }
87- continue
88- }
8970 It (fmt .Sprintf ("When I compile %s pipeline spec, then the compiled yaml should be %s" , pipelineSpecFileName , compiledWorkflowFileName ), func () {
9071 test_utils .CheckIfSkipping (pipelineSpecFileName )
91-
9272 pipelineSpecs , platformSpec := workflowutils .LoadPipelineSpecsFromIR (pipelineSpecFilePath , param .compilerOptions .CacheDisabled , nil )
9373 compiledWorkflow := workflowutils .GetCompiledArgoWorkflow (pipelineSpecs , platformSpec , & param .compilerOptions )
94-
9574 if * createMissingGoldenFiles || * updateGoldenFiles {
9675 configuredWorkflow := workflowutils .ConfigureCacheSettings (compiledWorkflow , true )
9776 _ , err := os .Stat (compiledWorkflowFilePath )
@@ -103,7 +82,6 @@ var _ = Describe("Verify Spec Compilation to Workflow >", Label(POSITIVE, WORKFL
10382 }
10483 }
10584 expectedWorkflow := workflowutils .UnmarshallWorkflowYAML (compiledWorkflowFilePath )
106-
10785 if param .compilerOptions .CacheDisabled {
10886 expectedWorkflow = workflowutils .ConfigureCacheSettings (expectedWorkflow , false )
10987 }
@@ -129,23 +107,3 @@ var _ = Describe("Verify Spec Compilation to Workflow >", Label(POSITIVE, WORKFL
129107 })
130108 }
131109})
132-
133- func RegenerateSpec (path string , wf v1alpha1.Workflow ) error {
134- wfYml , _ := yaml .Marshal (wf )
135- wfYmlStr := string (wfYml )
136- file , err := os .OpenFile (path , os .O_WRONLY | os .O_CREATE | os .O_TRUNC , 0644 )
137- if err != nil {
138- return err
139- }
140- var wfLines []string
141- for _ , line := range strings .Split (wfYmlStr , "\n " ) {
142- if ! strings .Contains (line , "- --cache_disabled" ) {
143- wfLines = append (wfLines , line )
144- }
145- }
146- _ , err = file .WriteString (strings .Join (wfLines , "\n " ))
147- if err != nil {
148- return err
149- }
150- return nil
151- }
0 commit comments