Skip to content

Commit

Permalink
test: add functional tests for memoization without outputs (argoproj#…
Browse files Browse the repository at this point in the history
…12215)

Signed-off-by: Alan Clucas <[email protected]>
  • Loading branch information
Joibel authored Nov 17, 2023
1 parent 206c901 commit b51320b
Showing 1 changed file with 125 additions and 4 deletions.
129 changes: 125 additions & 4 deletions test/e2e/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,12 +989,12 @@ func TestFunctionalSuite(t *testing.T) {
suite.Run(t, new(FunctionalSuite))
}

func (s *FunctionalSuite) TestStepLevelMemozie() {
func (s *FunctionalSuite) TestStepLevelMemoize() {
s.Given().
Workflow(`apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: steps-memozie-
generateName: steps-memoize-
spec:
entrypoint: hello-hello-hello
templates:
Expand Down Expand Up @@ -1054,12 +1054,72 @@ spec:

}

func (s *FunctionalSuite) TestDAGLevelMemozie() {
func (s *FunctionalSuite) TestStepLevelMemoizeNoOutput() {
s.Given().
Workflow(`apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: steps-memozie-
generateName: steps-memoize-noout-
spec:
entrypoint: hello-hello-hello
templates:
- name: hello-hello-hello
steps:
- - name: hello1
template: memostep
arguments:
parameters: [{name: message, value: "hello1"}]
- - name: hello2a
template: memostep
arguments:
parameters: [{name: message, value: "hello1"}]
- name: memostep
inputs:
parameters:
- name: message
memoize:
key: "{{inputs.parameters.message}}"
maxAge: "10s"
cache:
configMap:
name: my-config-memo-step-no-out
steps:
- - name: cache
template: whalesay
arguments:
parameters: [{name: message, value: "{{inputs.parameters.message}}"}]
- name: whalesay
inputs:
parameters:
- name: message
container:
image: argoproj/argosay:v2
command: [echo]
args: ["{{inputs.parameters.message}}"]
`).
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeSucceeded).
Then().
ExpectWorkflow(func(t *testing.T, _ *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
memoHit := false
for _, node := range status.Nodes {
if node.MemoizationStatus != nil && node.MemoizationStatus.Hit {
memoHit = true
}
}
assert.True(t, memoHit)

})

}

func (s *FunctionalSuite) TestDAGLevelMemoize() {
s.Given().
Workflow(`apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: dag-memoize-
spec:
entrypoint: hello-hello-hello
templates:
Expand Down Expand Up @@ -1120,6 +1180,67 @@ spec:

}

func (s *FunctionalSuite) TestDAGLevelMemoizeNoOutput() {
s.Given().
Workflow(`apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: dag-memoize-noout-
spec:
entrypoint: hello-hello-hello
templates:
- name: hello-hello-hello
steps:
- - name: hello1
template: memostep
arguments:
parameters: [{name: message, value: "hello1"}]
- - name: hello2a
template: memostep
arguments:
parameters: [{name: message, value: "hello1"}]
- name: memostep
inputs:
parameters:
- name: message
memoize:
key: "{{inputs.parameters.message}}"
maxAge: "10s"
cache:
configMap:
name: my-config-memo-dag
dag:
tasks:
- name: cache
template: whalesay
arguments:
parameters: [{name: message, value: "{{inputs.parameters.message}}"}]
- name: whalesay
inputs:
parameters:
- name: message
container:
image: argoproj/argosay:v2
command: [echo]
args: ["{{inputs.parameters.message}}"]
`).
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeSucceeded).
Then().
ExpectWorkflow(func(t *testing.T, _ *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
memoHit := false
for _, node := range status.Nodes {
if node.MemoizationStatus != nil && node.MemoizationStatus.Hit {
memoHit = true
}
}
assert.True(t, memoHit)

})

}

func (s *FunctionalSuite) TestContainerSetRetryFail() {
s.Given().
Workflow(`
Expand Down

0 comments on commit b51320b

Please sign in to comment.