Skip to content

Commit dee33a0

Browse files
committed
test: cover max_active_runs version requirement
Signed-off-by: sduvvuri1603 <[email protected]>
1 parent 268a628 commit dee33a0

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

backend/test/compiler/argo_ginkgo_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ var _ = Describe("Verify Spec Compilation to Workflow >", Label(POSITIVE, Workfl
118118
It(fmt.Sprintf("When I compile %s pipeline spec, then the compiled yaml should be %s", pipelineSpecFileName, compiledWorkflowFileName), func() {
119119
testutil.CheckIfSkipping(pipelineSpecFileName)
120120
pipelineSpecs, platformSpec := workflowutils.LoadPipelineSpecsFromIR(pipelineSpecFilePath, param.compilerOptions.CacheDisabled, nil)
121+
param.compilerOptions.PipelineVersionID = testutil.EnsurePipelineVersionID()
121122
compiledWorkflow := workflowutils.GetCompiledArgoWorkflow(pipelineSpecs, platformSpec, &param.compilerOptions)
122123
if *createMissingGoldenFiles || *updateGoldenFiles {
123124
var configuredWorkflow *v1alpha1.Workflow
@@ -141,3 +142,13 @@ var _ = Describe("Verify Spec Compilation to Workflow >", Label(POSITIVE, Workfl
141142
})
142143
}
143144
})
145+
146+
var _ = Describe("Compiler validation >", Label(NEGATIVE, WorkflowCompiler), func() {
147+
It("fails when max_active_runs is set without a pipeline version ID", func() {
148+
pipelineSpecFilePath := filepath.Join(pipelineFilesRootDir, pipelineDirectory, "essential", "pipeline_with_max_active_runs.yaml")
149+
pipelineSpecs, platformSpec := workflowutils.LoadPipelineSpecsFromIR(pipelineSpecFilePath, false, nil)
150+
_, err := argocompiler.Compile(pipelineSpecs, platformSpec, &argocompiler.Options{})
151+
Expect(err).To(HaveOccurred())
152+
Expect(err.Error()).To(ContainSubstring("maxActiveRuns requires a pipeline version ID to enforce concurrency limits"))
153+
})
154+
})

backend/test/testutil/test_utils.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ func ParsePointersToString(s *string) string {
4848
}
4949
}
5050

51+
// EnsurePipelineVersionID generates a deterministic placeholder pipeline version ID for tests.
52+
func EnsurePipelineVersionID() string {
53+
return "test-version-id"
54+
}
55+
5156
// GetRandomString - Get a random string of length x
5257
func GetRandomString(length int) string {
5358
charset := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"

test_data/compiled-workflows/pipeline_with_max_active_runs.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ spec:
3333
labels:
3434
pipelines.kubeflow.org/v2_component: "true"
3535
serviceAccountName: pipeline-runner
36+
synchronization:
37+
semaphores:
38+
- configMapKeyRef:
39+
key: test-version-id
40+
name: kfp-argo-workflow-semaphores
3641
templates:
3742
- container:
3843
args:

0 commit comments

Comments
 (0)