Skip to content

Commit 1ee2602

Browse files
author
arpechenin
committed
- remove redundant regenerate code
Signed-off-by: arpechenin <[email protected]>
1 parent c88c791 commit 1ee2602

File tree

2 files changed

+2
-44
lines changed

2 files changed

+2
-44
lines changed

backend/test/compiler/argo_ginkgo_test.go

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,14 @@
1515
package compiler
1616

1717
import (
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-
4035
var _ = 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-
}

backend/test/compiler/matchers/workflow_matcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func CompareWorkflows(actual *v1alpha1.Workflow, expected *v1alpha1.Workflow) {
129129
gomega.Expect(actual.Spec.Templates[index].HTTP).To(gomega.Equal(template.HTTP), "HTTP is not same")
130130
gomega.Expect(actual.Spec.Templates[index].Memoize).To(gomega.Equal(template.Memoize), "Memoize is not same")
131131
gomega.Expect(actual.Spec.Templates[index].Metadata).To(gomega.Equal(template.Metadata), "Metadata is not same")
132-
// gomega.Expect(actual.Spec.Templates[index].Plugin).To(gomega.Equal(template.Plugin), "Plugin is not same")
132+
gomega.Expect(actual.Spec.Templates[index].Plugin).To(gomega.Equal(template.Plugin), "Plugin is not same")
133133
gomega.Expect(actual.Spec.Templates[index].PriorityClassName).To(gomega.Equal(template.PriorityClassName), "PriorityClassName is not same")
134134
gomega.Expect(actual.Spec.Templates[index].Resource).To(gomega.Equal(template.Resource), "Resource is not same")
135135
gomega.Expect(actual.Spec.Templates[index].Script).To(gomega.Equal(template.Script), "Script is not same")

0 commit comments

Comments
 (0)