Skip to content

Commit

Permalink
fix test error and update docs
Browse files Browse the repository at this point in the history
Signed-off-by: 刘达 <liuda1@kingsoft.com>
  • Loading branch information
liuda1 committed Apr 4, 2024
1 parent 6c6afa6 commit 0cf9cc9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This document outlines environment variables that can be used to customize behav
| `ARGO_AGENT_PATCH_RATE` | `time.Duration` | `DEFAULT_REQUEUE_TIME` | Rate that the Argo Agent will patch the workflow task-set. |
| `ARGO_AGENT_CPU_LIMIT` | `resource.Quantity` | `100m` | CPU resource limit for the agent. |
| `ARGO_AGENT_MEMORY_LIMIT` | `resource.Quantity` | `256m` | Memory resource limit for the agent. |
| `ARGO_POD_STATUS_CAPTURE_FINALIZER` | `bool` | `false` | The finalizer blocks the deletion of pods until the controller captures their status. |
| `ARGO_POD_STATUS_CAPTURE_FINALIZER` | `bool` | `false` | The finalizer blocks the deletion of pods until the controller captures their status. |
| `ARGO_POD_STATUS_CAPTURE_TIMEOUT` | `time.Duration` | `10m` | After the timeout time, workflow controller will remove the finalizer anyway to avoid a potential risk of pods increased infinitely. |
| `BUBBLE_ENTRY_TEMPLATE_ERR` | `bool` | `true` | Whether to bubble up template errors to workflow. |
| `CACHE_GC_PERIOD` | `time.Duration` | `0s` | How often to perform memoization cache GC, which is disabled by default and can be enabled by providing a non-zero duration. |
Expand Down
5 changes: 3 additions & 2 deletions workflow/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1265,11 +1265,12 @@ func TestGetPodCleaupCache(t *testing.T) {
pod := &apiv1.Pod{}
pod.SetLabels(map[string]string{common.LabelKeyCompleted: "false"})
pod.SetFinalizers([]string{common.FinalizerPodStatus})
pod.SetResourceVersion("123456")

// pod finalizer enabled, patch label
os.Setenv("ARGO_POD_STATUS_CAPTURE_FINALIZER", "true")
expected := &map[string]interface{}{}
err := json.Unmarshal([]byte(`{"metadata":{"finalizers":[],"labels":{"workflows.argoproj.io/completed":"true"}}}`), expected)
err := json.Unmarshal([]byte(`{"metadata":{"resourceVersion":"123456","finalizers":[],"labels":{"workflows.argoproj.io/completed":"true"}}}`), expected)
assert.Nil(t, err)
patch, err := wfc.getPodCleanupPatch(pod, true)
assert.Nil(t, err)
Expand All @@ -1280,7 +1281,7 @@ func TestGetPodCleaupCache(t *testing.T) {

// pod finalizer enabled, not patch label
expected = &map[string]interface{}{}
err = json.Unmarshal([]byte(`{"metadata":{"finalizers":[]}}`), expected)
err = json.Unmarshal([]byte(`{"metadata":{"resourceVersion":"123456","finalizers":[]}}`), expected)
assert.Nil(t, err)
patch, err = wfc.getPodCleanupPatch(pod, false)
assert.Nil(t, err)
Expand Down

0 comments on commit 0cf9cc9

Please sign in to comment.