-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Support memoization on plugin node. Fixes #8553 #8554
Changes from all commits
569a177
6cd0f63
564bfda
2ef5e60
8b7aef3
70c6a9d
ed6e857
04e7993
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import ( | |
"context" | ||
"strings" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
@@ -333,3 +334,80 @@ func TestNonHTTPTemplateScenario(t *testing.T) { | |
assert.NoError(t, err) | ||
}) | ||
} | ||
|
||
func TestReconcileTaskSetWithMemoization(t *testing.T) { | ||
wf := wfv1.MustUnmarshalWorkflow(`apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example's length makes it too hard to understand what is the example is relevant to the test, and what is just copied and pasted. Can you please simplify. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
metadata: | ||
name: http-template-1 | ||
namespace: default | ||
spec: | ||
entrypoint: main | ||
templates: | ||
- name: main | ||
http: | ||
url: "http://localhost" | ||
memoize: | ||
key: cache-demo-1 | ||
maxAge: "10s" | ||
cache: | ||
configMap: | ||
name: cache-demo-1 | ||
status: | ||
nodes: | ||
http-template-fqgsf-2338098285: | ||
boundaryID: http-template-fqgsf | ||
displayName: main | ||
id: http-template-fqgsf-2338098285 | ||
name: http-template-fqgsf[0].main | ||
memoizationStatus: | ||
hit: false | ||
key: cache-demo-1 | ||
cacheName: cache-demo-1 | ||
outputs: | ||
parameters: | ||
- name: result | ||
value: | | ||
{ demo } | ||
phase: Succeeded | ||
templateName: http | ||
type: HTTP | ||
phase: Running | ||
`) | ||
ctx := context.Background() | ||
var ts wfv1.WorkflowTaskSet | ||
wfv1.MustUnmarshal(`apiVersion: argoproj.io/v1alpha1 | ||
kind: WorkflowTaskSet | ||
metadata: | ||
name: http-template-1 | ||
namespace: default | ||
spec: | ||
tasks: | ||
http-template-fqgsf-2338098285: | ||
http: | ||
url: http://localhost | ||
name: http | ||
status: | ||
nodes: | ||
http-template-fqgsf-2338098285: | ||
outputs: | ||
parameters: | ||
- name: result | ||
value: | | ||
{ demo } | ||
phase: Succeeded | ||
`, &ts) | ||
t.Run("MemoizeOnTaskSetSucceeded", func(t *testing.T) { | ||
cancel, controller := newController(wf, ts) | ||
defer cancel() | ||
_, err := controller.wfclientset.ArgoprojV1alpha1().WorkflowTaskSets("default").Create(ctx, &ts, v1.CreateOptions{}) | ||
assert.NoError(t, err) | ||
woc := newWorkflowOperationCtx(wf, controller) | ||
time.Sleep(1 * time.Second) | ||
err = woc.reconcileTaskSet(ctx) | ||
assert.NoError(t, err) | ||
memo, err := controller.kubeclientset.CoreV1().ConfigMaps("default").Get(ctx, "cache-demo-1", v1.GetOptions{}) | ||
assert.NoError(t, err) | ||
assert.NotEmpty(t, memo.Data["cache-demo-1"]) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done