-
Notifications
You must be signed in to change notification settings - Fork 313
Add e2e test for app-wide-upgrade-strategy #842
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
Merged
chengfang
merged 4 commits into
argoproj-labs:master
from
ishitasequeira:e2e-app-wide-upgrade-strategy
Sep 10, 2024
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9e83e36
Add e2e test for app-wide-upgrade-strategy
ishitasequeira 7a5ce8d
fix the e2e test case
ishitasequeira e8ace6b
update the test case and address comments
ishitasequeira 31d8d66
Merge branch 'master' into e2e-app-wide-upgrade-strategy
ishitasequeira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
test/e2e/suite/005-app-wide-update-strategy/01-assert.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| apiVersion: argoproj.io/v1alpha1 | ||
| kind: Application | ||
| metadata: | ||
| name: image-updater-005-01 | ||
| status: | ||
| health: | ||
| status: Healthy | ||
| sync: | ||
| status: Synced | ||
| --- | ||
| apiVersion: argoproj.io/v1alpha1 | ||
| kind: Application | ||
| metadata: | ||
| name: image-updater-005-02 | ||
| status: | ||
| health: | ||
| status: Healthy | ||
| sync: | ||
| status: Synced |
55 changes: 55 additions & 0 deletions
55
test/e2e/suite/005-app-wide-update-strategy/01-install.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: image-updater-e2e-005-01 | ||
| --- | ||
| apiVersion: argoproj.io/v1alpha1 | ||
| kind: Application | ||
| metadata: | ||
| name: image-updater-005-01 | ||
| annotations: | ||
| argocd-image-updater.argoproj.io/image-list: guestbook=gcr.io/heptio-images/ks-guestbook-demo:~0 | ||
| argocd-image-updater.argoproj.io/guestbook.update-strategy: semver | ||
| finalizers: | ||
| - resources-finalizer.argocd.argoproj.io | ||
| spec: | ||
| project: default | ||
| source: | ||
| repoURL: https://github.com/argoproj/argocd-example-apps.git | ||
| path: kustomize-guestbook | ||
| targetRevision: HEAD | ||
| destination: | ||
| server: https://kubernetes.default.svc | ||
| namespace: image-updater-e2e-005-01 | ||
| syncPolicy: | ||
| automated: {} | ||
| retry: | ||
| limit: 2 | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: image-updater-e2e-005-02 | ||
| --- | ||
| apiVersion: argoproj.io/v1alpha1 | ||
| kind: Application | ||
| metadata: | ||
| name: image-updater-005-02 | ||
| annotations: | ||
| argocd-image-updater.argoproj.io/image-list: guestbook=gcr.io/heptio-images/ks-guestbook-demo:latest | ||
| argocd-image-updater.argoproj.io/guestbook.update-strategy: latest | ||
ishitasequeira marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| finalizers: | ||
| - resources-finalizer.argocd.argoproj.io | ||
| spec: | ||
| project: default | ||
| source: | ||
| repoURL: https://github.com/argoproj/argocd-example-apps.git | ||
| path: kustomize-guestbook | ||
| targetRevision: HEAD | ||
| destination: | ||
| server: https://kubernetes.default.svc | ||
| namespace: image-updater-e2e-005-02 | ||
| syncPolicy: | ||
| automated: {} | ||
| retry: | ||
| limit: 2 | ||
24 changes: 24 additions & 0 deletions
24
test/e2e/suite/005-app-wide-update-strategy/02-assert.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: argoproj.io/v1alpha1 | ||
| kind: Application | ||
| metadata: | ||
| name: image-updater-005-01 | ||
| spec: | ||
| source: | ||
| kustomize: | ||
| images: | ||
| - gcr.io/heptio-images/ks-guestbook-demo:0.2 | ||
| status: | ||
| health: | ||
| status: Healthy | ||
| sync: | ||
| status: Synced | ||
| --- | ||
| apiVersion: argoproj.io/v1alpha1 | ||
| kind: Application | ||
| metadata: | ||
| name: image-updater-005-02 | ||
| status: | ||
| health: | ||
| status: Healthy | ||
| sync: | ||
| status: Synced |
7 changes: 7 additions & 0 deletions
7
test/e2e/suite/005-app-wide-update-strategy/02-run-updater.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| apiVersion: kuttl.dev/v1beta1 | ||
| kind: TestStep | ||
| commands: | ||
| - script: | | ||
| ${SRC_DIR}/dist/argocd-image-updater run --once \ | ||
| --argocd-namespace argocd-image-updater-e2e \ | ||
| --loglevel info |
10 changes: 10 additions & 0 deletions
10
test/e2e/suite/005-app-wide-update-strategy/99-delete.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| apiVersion: kuttl.dev/v1beta1 | ||
| kind: TestStep | ||
| timeout: 120 | ||
| delete: | ||
| - apiVersion: v1 | ||
| kind: Namespace | ||
| name: image-updater-005-01 | ||
| - apiVersion: v1 | ||
| kind: Namespace | ||
| name: image-updater-005-02 | ||
ishitasequeira marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| This test case verifies [app wide update strategy]() with `--match-application-label` command line options | ||
ishitasequeira marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This test case uses image from public container registry and application source from public GitHub repo. | ||
|
|
||
| To run this individual test case, | ||
|
|
||
| * make sure both docker daemon and k8s cluster is running | ||
| * `cd $HOME/go/src/image-updater/test/e2e` | ||
| * `SRC_DIR=$HOME/go/src/image-updater kubectl kuttl test --namespace argocd-image-updater-e2e --timeout 120 --test 005-app-wide-update-strategy` | ||
|
|
||
| Test output: | ||
| ```bash | ||
| === RUN kuttl | ||
| harness.go:464: starting setup | ||
| harness.go:255: running tests using configured kubeconfig. | ||
| harness.go:278: Successful connection to cluster at: https://127.0.0.1:6443 | ||
| harness.go:363: running tests | ||
| harness.go:75: going to run test suite with timeout of 120 seconds for each step | ||
| harness.go:375: testsuite: ./suite has 8 tests | ||
| === RUN kuttl/harness | ||
| === RUN kuttl/harness/005-app-wide-update-strategy | ||
| === PAUSE kuttl/harness/005-app-wide-update-strategy | ||
| === CONT kuttl/harness/005-app-wide-update-strategy | ||
| logger.go:42: 20:21:30 | 005-app-wide-update-strategy | Ignoring README.md as it does not match file name regexp: ^(\d+)-(?:[^\.]+)(?:\.yaml)?$ | ||
| logger.go:42: 20:21:30 | 005-app-wide-update-strategy | Skipping creation of user-supplied namespace: argocd-image-updater-e2e | ||
| logger.go:42: 20:21:30 | 005-app-wide-update-strategy/1-install | starting test step 1-install | ||
| logger.go:42: 20:21:30 | 005-app-wide-update-strategy/1-install | Namespace:/image-updater-e2e-005-01 created | ||
| logger.go:42: 20:21:30 | 005-app-wide-update-strategy/1-install | Application:argocd-image-updater-e2e/image-updater-005-01 created | ||
| logger.go:42: 20:21:30 | 005-app-wide-update-strategy/1-install | Namespace:/image-updater-e2e-005-02 created | ||
| logger.go:42: 20:21:30 | 005-app-wide-update-strategy/1-install | Application:argocd-image-updater-e2e/image-updater-005-02 created | ||
| logger.go:42: 20:21:34 | 005-app-wide-update-strategy/1-install | test step completed 1-install | ||
| logger.go:42: 20:21:34 | 005-app-wide-update-strategy/2-run-updater | starting test step 2-run-updater | ||
| logger.go:42: 20:21:34 | 005-app-wide-update-strategy/2-run-updater | running command: [sh -c ${SRC_DIR}/dist/argocd-image-updater run --once \ | ||
| --argocd-namespace argocd-image-updater-e2e \ | ||
| --loglevel info | ||
| ] | ||
| logger.go:42: 20:21:34 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:34-04:00" level=info msg="argocd-image-updater v99.9.9+43dbd63 starting [loglevel:INFO, interval:once, healthport:off]" | ||
| logger.go:42: 20:21:34 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:34-04:00" level=warning msg="commit message template at /app/config/commit.template does not exist, using default" | ||
| logger.go:42: 20:21:34 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:34-04:00" level=warning msg="Registry configuration at /app/config/registries.conf could not be read: stat /app/config/registries.conf: no such file or directory -- using default configuration" | ||
| logger.go:42: 20:21:34 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:34-04:00" level=info msg="ArgoCD configuration: [apiKind=kubernetes, server=argocd-server.argocd-image-updater-e2e, auth_token=false, insecure=false, grpc_web=false, plaintext=false]" | ||
| logger.go:42: 20:21:34 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:34-04:00" level=info msg="Starting metrics server on TCP port=8081" | ||
| logger.go:42: 20:21:34 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:34-04:00" level=info msg="Warming up image cache" | ||
| logger.go:42: 20:21:35 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:35-04:00" level=info msg="Setting new image to gcr.io/heptio-images/ks-guestbook-demo:0.2" alias=guestbook application=image-updater-005-01 image_name=heptio-images/ks-guestbook-demo image_tag=0.1 registry=gcr.io | ||
| logger.go:42: 20:21:35 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:35-04:00" level=info msg="Successfully updated image 'gcr.io/heptio-images/ks-guestbook-demo:0.1' to 'gcr.io/heptio-images/ks-guestbook-demo:0.2', but pending spec update (dry run=true)" alias=guestbook application=image-updater-005-01 image_name=heptio-images/ks-guestbook-demo image_tag=0.1 registry=gcr.io | ||
| logger.go:42: 20:21:35 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:35-04:00" level=info msg="Dry run - not committing 1 changes to application" application=image-updater-005-01 | ||
| logger.go:42: 20:21:35 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:35-04:00" level=warning msg="\"latest\" strategy has been renamed to \"newest-build\". Please switch to the new convention as support for the old naming convention will be removed in future versions." image_alias=guestbook image_digest= image_name=gcr.io/heptio-images/ks-guestbook-demo image_tag=latest registry_url=gcr.io | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:36-04:00" level=info msg="Finished cache warm-up, pre-loaded 0 meta data entries from 2 registries" | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:36-04:00" level=info msg="Starting image update cycle, considering 2 annotated application(s) for update" | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:36-04:00" level=warning msg="\"latest\" strategy has been renamed to \"newest-build\". Please switch to the new convention as support for the old naming convention will be removed in future versions." image_alias=guestbook image_digest= image_name=gcr.io/heptio-images/ks-guestbook-demo image_tag=latest registry_url=gcr.io | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:36-04:00" level=info msg="Setting new image to gcr.io/heptio-images/ks-guestbook-demo:0.2" alias=guestbook application=image-updater-005-01 image_name=heptio-images/ks-guestbook-demo image_tag=0.1 registry=gcr.io | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:36-04:00" level=info msg="Successfully updated image 'gcr.io/heptio-images/ks-guestbook-demo:0.1' to 'gcr.io/heptio-images/ks-guestbook-demo:0.2', but pending spec update (dry run=false)" alias=guestbook application=image-updater-005-01 image_name=heptio-images/ks-guestbook-demo image_tag=0.1 registry=gcr.io | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:36-04:00" level=info msg="Committing 1 parameter update(s) for application image-updater-005-01" application=image-updater-005-01 | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | W0827 20:21:36.756023 7062 warnings.go:70] unknown field "status.history[0].initiatedBy" | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:36-04:00" level=info msg="Successfully updated the live application spec" application=image-updater-005-01 | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:36-04:00" level=info msg="Processing results: applications=2 images_considered=2 images_skipped=0 images_updated=1 errors=0" | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-08-27T20:21:36-04:00" level=info msg=Finished. | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/2-run-updater | test step completed 2-run-updater | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/99-delete | starting test step 99-delete | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy/99-delete | test step completed 99-delete | ||
| logger.go:42: 20:21:36 | 005-app-wide-update-strategy | skipping kubernetes event logging | ||
| === NAME kuttl | ||
| harness.go:407: run tests finished | ||
| harness.go:515: cleaning up | ||
| harness.go:572: removing temp folder: "" | ||
| --- PASS: kuttl (6.16s) | ||
| --- PASS: kuttl/harness (0.00s) | ||
| --- PASS: kuttl/harness/005-app-wide-update-strategy (6.14s) | ||
| PASS | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.