test: fix Hydration check in TestHydratorHydratesAutomatically_NewCommit_WithChanges#28878
test: fix Hydration check in TestHydratorHydratesAutomatically_NewCommit_WithChanges#28878kuci-JK wants to merge 1 commit into
Conversation
…wCommit_WithChanges Fix timing issue caused when wait for hydrated status is called too soon causing it to succeed because the app is still hydrated from the prev SHA as the new state has not been processed yet. Sleep before checking the app status to give argo time to process the hydration. Signed-off-by: Jan Kučera <jankucera254@gmail.com>
❗ Preview Environment deployment failed on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
PR Summary by QodoFix e2e hydrator test race by delaying hydrated assertion
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
|
Bundle ReportBundle size has no change ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #28878 +/- ##
=========================================
Coverage ? 65.37%
=========================================
Files ? 426
Lines ? 60143
Branches ? 0
=========================================
Hits ? 39318
Misses ? 17208
Partials ? 3617
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
This PR fixes some e2e tests when run with the local toolchain. (Splitted from #28857)
Fix timing issue caused when wait for hydrated status is called too soon causing it to succeed because the app is still hydrated from the prev SHA as the new state has not been processed yet. Sleep before checking the app status to give argo time to process the hydration.
TestHydratorHydratesAutomatically_NewCommit_WithChangesLog
time="2026-07-20T13:49:53+02:00" level=info msg="../../dist/argocd app create -f /var/folders/_d/65t3r9nx0pgc13mtvytrfyvc0000gn/T/902305250 --plaintext --server localhost:8080 --auth-token ****** --insecure" dir= execID=2a0b7 time="2026-07-20T13:49:53+02:00" level=debug msg="application 'test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp' created\n" duration=507.184125ms execID=2a0b7 time="2026-07-20T13:49:53+02:00" level=info msg="expectation succeeded: no error and output contained ''" time="2026-07-20T13:49:53+02:00" level=info msg="../../dist/argocd app get test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp --refresh --plaintext --server localhost:8080 --auth-token ****** --insecure" dir= execID=5d00a time="2026-07-20T13:49:54+02:00" level=debug msg="Name: argocd-e2e/test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp\nProject: default\nServer: https://kubernetes.default.svc\nNamespace: argocd-e2e--test-hydrator-hydrates-automatically--new-com-wkdvp\nURL: http://localhost:8080/applications/test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp\nSource:\n- Repo: file:///Users/jakucera/tmp/test/testdata.git\n Target: env/test\n Path: guestbook\nSyncWindow: Sync Allowed\nSync Policy: Manual\nSync Status: Unknown (env/tes)\nHealth Status: Healthy\n\nCONDITION MESSAGE LAST TRANSITION\nComparisonError Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = unable to resolve 'env/test' to a commit SHA: revision not found 2026-07-20 13:49:53 +0200 CEST\n\n" duration=132.645ms execID=5d00a time="2026-07-20T13:49:54+02:00" level=info msg="expectation succeeded: no error and output contained ''" time="2026-07-20T13:49:54+02:00" level=info msg="../../dist/argocd app wait --hydrated test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp --timeout 20 --plaintext --server localhost:8080 --auth-token ****** --insecure" dir= execID=52941 time="2026-07-20T13:49:55+02:00" level=debug msg="TIMESTAMP GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE\n\nName: argocd-e2e/test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp\nProject: default\nServer: https://kubernetes.default.svc\nNamespace: argocd-e2e--test-hydrator-hydrates-automatically--new-com-wkdvp\nURL: http://localhost:8080/applications/test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp\nSource:\n- Repo: file:///Users/jakucera/tmp/test/testdata.git\n Target: env/test\n Path: guestbook\nSyncWindow: Sync Allowed\nSync Policy: Manual\nSync Status: Unknown (env/tes)\nHealth Status: Healthy\n\n" duration=1.24729575s execID=52941 time="2026-07-20T13:49:55+02:00" level=info msg="expectation succeeded: no error and output contained ''" time="2026-07-20T13:49:55+02:00" level=info msg="expectation succeeded: hydration phase to be Hydrated, is Hydrated" hydrator_test.go:542: Initial hydration - drySHA: 3b89fa5c6fc5344e8a1eaefe56ae9b8513f8670a, hydratedSHA: 23e052459873dd5144a0c4cff74e7cd9f363938a time="2026-07-20T13:49:56+02:00" level=info msg=patching jsonPatch="[{\"op\": \"replace\", \"path\": \"/spec/revisionHistoryLimit\", \"value\": 10}]" path=guestbook/guestbook-ui-deployment.yaml time="2026-07-20T13:49:56+02:00" level=info msg="converting YAML to JSON" time="2026-07-20T13:49:56+02:00" level=info msg=JSON bytes="{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"labels\":{\"test\":\"true\"},\"name\":\"guestbook-ui\"},\"spec\":{\"replicas\":0,\"revisionHistoryLimit\":3,\"selector\":{\"matchLabels\":{\"app\":\"guestbook-ui\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"guestbook-ui\"}},\"spec\":{\"containers\":[{\"image\":\"quay.io/argoprojlabs/argocd-e2e-container:0.2\",\"imagePullPolicy\":\"IfNotPresent\",\"name\":\"guestbook-ui\",\"ports\":[{\"containerPort\":80}]}]}}}}" time="2026-07-20T13:49:56+02:00" level=info msg="converting JSON back to YAML" time="2026-07-20T13:49:56+02:00" level=info msg="git diff" dir=/Users/jakucera/tmp/test/testdata.git execID=bb276 time="2026-07-20T13:49:56+02:00" level=debug msg="diff --git a/guestbook/guestbook-ui-deployment.yaml b/guestbook/guestbook-ui-deployment.yaml\nindex bf33756..d214ee4 100644\n--- a/guestbook/guestbook-ui-deployment.yaml\n+++ b/guestbook/guestbook-ui-deployment.yaml\n@@ -1,12 +1,12 @@\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n- name: guestbook-ui\n labels:\n test: \"true\"\n+ name: guestbook-ui\n spec:\n replicas: 0\n- revisionHistoryLimit: 3\n+ revisionHistoryLimit: 10\n selector:\n matchLabels:\n app: guestbook-ui\n" duration=48.236792ms execID=bb276 time="2026-07-20T13:49:56+02:00" level=info msg="git commit -am patch" dir=/Users/jakucera/tmp/test/testdata.git execID=6368d time="2026-07-20T13:49:56+02:00" level=debug msg="[master a84828a] patch\n 1 file changed, 2 insertions(+), 2 deletions(-)\n" duration=64.790916ms execID=6368d time="2026-07-20T13:49:56+02:00" level=info msg="../../dist/argocd app get test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp --refresh --plaintext --server localhost:8080 --auth-token ****** --insecure" dir= execID=c869a time="2026-07-20T13:49:56+02:00" level=debug msg="Name: argocd-e2e/test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp\nProject: default\nServer: https://kubernetes.default.svc\nNamespace: argocd-e2e--test-hydrator-hydrates-automatically--new-com-wkdvp\nURL: http://localhost:8080/applications/test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp\nSource:\n- Repo: file:///Users/jakucera/tmp/test/testdata.git\n Target: env/test\n Path: guestbook\nSyncWindow: Sync Allowed\nSync Policy: Manual\nSync Status: OutOfSync from env/test (23e0524)\nHealth Status: Missing\n\nGROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE\n Service argocd-e2e--test-hydrator-hydrates-automatically--new-com-wkdvp guestbook-ui OutOfSync Missing \napps Deployment argocd-e2e--test-hydrator-hydrates-automatically--new-com-wkdvp guestbook-ui OutOfSync Missing \n" duration=197.691666ms execID=c869a time="2026-07-20T13:49:56+02:00" level=info msg="expectation succeeded: no error and output contained ''" time="2026-07-20T13:49:56+02:00" level=info msg="../../dist/argocd app wait --hydrated test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp --timeout 20 --plaintext --server localhost:8080 --auth-token ****** --insecure" dir= execID=6d31c time="2026-07-20T13:49:56+02:00" level=debug msg="\nName: argocd-e2e/test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp\nProject: default\nServer: https://kubernetes.default.svc\nNamespace: argocd-e2e--test-hydrator-hydrates-automatically--new-com-wkdvp\nURL: http://localhost:8080/applications/test-hydrator-hydrates-automatically--new-commit--with-ch-wkdvp\nSource:\n- Repo: file:///Users/jakucera/tmp/test/testdata.git\n Target: env/test\n Path: guestbook\nSyncWindow: Sync Allowed\nSync Policy: Manual\nSync Status: OutOfSync from env/test (23e0524)\nHealth Status: Missing\n\n\nGROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE\n Service argocd-e2e--test-hydrator-hydrates-automatically--new-com-wkdvp guestbook-ui OutOfSync Missing \napps Deployment argocd-e2e--test-hydrator-hydrates-automatically--new-com-wkdvp guestbook-ui OutOfSync Missing \n" duration=82.972833ms execID=6d31c time="2026-07-20T13:49:56+02:00" level=info msg="expectation succeeded: no error and output contained ''" time="2026-07-20T13:49:56+02:00" level=info msg="expectation succeeded: hydration phase to be Hydrated, is Hydrated" hydrator_test.go:556: Error Trace: /Users/jakucera/repository/argo/argo-cd/test/e2e/hydrator_test.go:556 /Users/jakucera/repository/argo/argo-cd/test/e2e/fixture/app/consequences.go:90 /Users/jakucera/repository/argo/argo-cd/test/e2e/hydrator_test.go:555 Error: Should not be: "3b89fa5c6fc5344e8a1eaefe56ae9b8513f8670a" Test: TestHydratorHydratesAutomatically_NewCommit_WithChanges Messages: Dry SHA should change after a new commitChecklist: