Skip to content

Commit c8bcd8f

Browse files
Add e2e test for app-wide-upgrade-strategy (#842)
Signed-off-by: Ishita Sequeira <ishiseq29@gmail.com>
1 parent 79de6d5 commit c8bcd8f

File tree

6 files changed

+205
-0
lines changed

6 files changed

+205
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: image-updater-005-01
5+
status:
6+
health:
7+
status: Healthy
8+
sync:
9+
status: Synced
10+
---
11+
apiVersion: argoproj.io/v1alpha1
12+
kind: Application
13+
metadata:
14+
name: image-updater-005-02
15+
status:
16+
health:
17+
status: Healthy
18+
sync:
19+
status: Synced
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: image-updater-e2e-005-01
5+
---
6+
apiVersion: argoproj.io/v1alpha1
7+
kind: Application
8+
metadata:
9+
name: image-updater-005-01
10+
annotations:
11+
argocd-image-updater.argoproj.io/image-list: guestbook=gcr.io/heptio-images/ks-guestbook-demo:~0
12+
argocd-image-updater.argoproj.io/guestbook.update-strategy: semver
13+
finalizers:
14+
- resources-finalizer.argocd.argoproj.io
15+
spec:
16+
project: default
17+
source:
18+
repoURL: https://github.com/argoproj/argocd-example-apps.git
19+
path: kustomize-guestbook
20+
targetRevision: HEAD
21+
destination:
22+
server: https://kubernetes.default.svc
23+
namespace: image-updater-e2e-005-01
24+
syncPolicy:
25+
automated: {}
26+
retry:
27+
limit: 2
28+
---
29+
apiVersion: v1
30+
kind: Namespace
31+
metadata:
32+
name: image-updater-e2e-005-02
33+
---
34+
apiVersion: argoproj.io/v1alpha1
35+
kind: Application
36+
metadata:
37+
name: image-updater-005-02
38+
annotations:
39+
argocd-image-updater.argoproj.io/image-list: guestbook=gcr.io/heptio-images/ks-guestbook-demo:latest
40+
argocd-image-updater.argoproj.io/guestbook.update-strategy: latest
41+
finalizers:
42+
- resources-finalizer.argocd.argoproj.io
43+
spec:
44+
project: default
45+
source:
46+
repoURL: https://github.com/argoproj/argocd-example-apps.git
47+
path: kustomize-guestbook
48+
targetRevision: HEAD
49+
destination:
50+
server: https://kubernetes.default.svc
51+
namespace: image-updater-e2e-005-02
52+
syncPolicy:
53+
automated: {}
54+
retry:
55+
limit: 2
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: image-updater-005-01
5+
spec:
6+
source:
7+
kustomize:
8+
images:
9+
- gcr.io/heptio-images/ks-guestbook-demo:0.2
10+
status:
11+
health:
12+
status: Healthy
13+
sync:
14+
status: Synced
15+
---
16+
apiVersion: v1
17+
kind: Pod
18+
metadata:
19+
namespace: image-updater-e2e-005-01
20+
spec:
21+
containers:
22+
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
23+
---
24+
apiVersion: argoproj.io/v1alpha1
25+
kind: Application
26+
metadata:
27+
name: image-updater-005-02
28+
status:
29+
health:
30+
status: Healthy
31+
sync:
32+
status: Synced
33+
---
34+
apiVersion: v1
35+
kind: Pod
36+
metadata:
37+
namespace: image-updater-e2e-005-02
38+
spec:
39+
containers:
40+
- image: gcr.io/heptio-images/ks-guestbook-demo:0.1
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- script: |
5+
${SRC_DIR}/dist/argocd-image-updater run --once \
6+
--argocd-namespace argocd-image-updater-e2e \
7+
--loglevel info
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
timeout: 120
4+
delete:
5+
- apiVersion: argoproj.io/v1alpha1
6+
kind: Application
7+
name: image-updater-005-01
8+
- apiVersion: v1
9+
kind: Namespace
10+
name: image-updater-e2e-005-01
11+
- apiVersion: argoproj.io/v1alpha1
12+
kind: Application
13+
name: image-updater-005-02
14+
- apiVersion: v1
15+
kind: Namespace
16+
name: image-updater-e2e-005-02
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
This test case verifies [app wide update strategy](https://argocd-image-updater.readthedocs.io/en/stable/configuration/images/#update-strategies)
2+
3+
This test case uses image from public container registry and application source from public GitHub repo.
4+
5+
To run this individual test case,
6+
7+
* make sure both docker daemon and k8s cluster is running
8+
* `cd $HOME/go/src/image-updater/test/e2e`
9+
* `SRC_DIR=$HOME/go/src/image-updater kubectl kuttl test --namespace argocd-image-updater-e2e --timeout 120 --test 005-app-wide-update-strategy`
10+
11+
Test output:
12+
```bash
13+
=== RUN kuttl
14+
harness.go:464: starting setup
15+
harness.go:255: running tests using configured kubeconfig.
16+
harness.go:278: Successful connection to cluster at: https://127.0.0.1:6443
17+
harness.go:363: running tests
18+
harness.go:75: going to run test suite with timeout of 120 seconds for each step
19+
harness.go:375: testsuite: ./suite has 7 tests
20+
=== RUN kuttl/harness
21+
=== RUN kuttl/harness/005-app-wide-update-strategy
22+
=== PAUSE kuttl/harness/005-app-wide-update-strategy
23+
=== CONT kuttl/harness/005-app-wide-update-strategy
24+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy | Ignoring README.md as it does not match file name regexp: ^(\d+)-(?:[^\.]+)(?:\.yaml)?$
25+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy | Skipping creation of user-supplied namespace: argocd-image-updater-e2e
26+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/1-install | starting test step 1-install
27+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/1-install | Namespace:/image-updater-e2e-005-01 updated
28+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/1-install | Application:argocd-image-updater-e2e/image-updater-005-01 updated
29+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/1-install | Namespace:/image-updater-e2e-005-02 updated
30+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/1-install | Application:argocd-image-updater-e2e/image-updater-005-02 updated
31+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/1-install | test step completed 1-install
32+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | starting test step 2-run-updater
33+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | running command: [sh -c ${SRC_DIR}/dist/argocd-image-updater run --once \
34+
--argocd-namespace argocd-image-updater-e2e \
35+
--loglevel info
36+
]
37+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=info msg="argocd-image-updater v99.9.9+6c9e2ee starting [loglevel:INFO, interval:once, healthport:off]"
38+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=warning msg="commit message template at /app/config/commit.template does not exist, using default"
39+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-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"
40+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-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]"
41+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=info msg="Starting metrics server on TCP port=8081"
42+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=info msg="Warming up image cache"
43+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=warning msg="Unknown sort option skip -- using semver" image_alias=guestbook image_digest= image_name=gcr.io/heptio-images/ks-guestbook-demo image_tag=0.1 registry_url=gcr.io
44+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=info msg="Setting new image to gcr.io/heptio-images/ks-guestbook-demo:0.1" alias=guestbook application=image-updater-005-02 image_name=heptio-images/ks-guestbook-demo image_tag=0.2 registry=gcr.io
45+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=info msg="Successfully updated image 'gcr.io/heptio-images/ks-guestbook-demo:0.2' to 'gcr.io/heptio-images/ks-guestbook-demo:0.1', but pending spec update (dry run=true)" alias=guestbook application=image-updater-005-02 image_name=heptio-images/ks-guestbook-demo image_tag=0.2 registry=gcr.io
46+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=info msg="Dry run - not committing 1 changes to application" application=image-updater-005-02
47+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=info msg="Finished cache warm-up, pre-loaded 0 meta data entries from 2 registries"
48+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=info msg="Starting image update cycle, considering 2 annotated application(s) for update"
49+
logger.go:42: 17:59:36 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:36-04:00" level=warning msg="Unknown sort option skip -- using semver" image_alias=guestbook image_digest= image_name=gcr.io/heptio-images/ks-guestbook-demo image_tag=0.1 registry_url=gcr.io
50+
logger.go:42: 17:59:37 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:37-04:00" level=info msg="Setting new image to gcr.io/heptio-images/ks-guestbook-demo:0.1" alias=guestbook application=image-updater-005-02 image_name=heptio-images/ks-guestbook-demo image_tag=0.2 registry=gcr.io
51+
logger.go:42: 17:59:37 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:37-04:00" level=info msg="Successfully updated image 'gcr.io/heptio-images/ks-guestbook-demo:0.2' to 'gcr.io/heptio-images/ks-guestbook-demo:0.1', but pending spec update (dry run=false)" alias=guestbook application=image-updater-005-02 image_name=heptio-images/ks-guestbook-demo image_tag=0.2 registry=gcr.io
52+
logger.go:42: 17:59:37 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:37-04:00" level=info msg="Committing 1 parameter update(s) for application image-updater-005-02" application=image-updater-005-02
53+
logger.go:42: 17:59:37 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:37-04:00" level=info msg="Successfully updated the live application spec" application=image-updater-005-02
54+
logger.go:42: 17:59:37 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:37-04:00" level=info msg="Processing results: applications=2 images_considered=2 images_skipped=0 images_updated=1 errors=0"
55+
logger.go:42: 17:59:37 | 005-app-wide-update-strategy/2-run-updater | time="2024-09-09T17:59:37-04:00" level=info msg=Finished.
56+
logger.go:42: 17:59:38 | 005-app-wide-update-strategy/2-run-updater | test step completed 2-run-updater
57+
logger.go:42: 17:59:38 | 005-app-wide-update-strategy/99-delete | starting test step 99-delete
58+
logger.go:42: 17:59:38 | 005-app-wide-update-strategy/99-delete | test step completed 99-delete
59+
logger.go:42: 17:59:38 | 005-app-wide-update-strategy | skipping kubernetes event logging
60+
=== NAME kuttl
61+
harness.go:407: run tests finished
62+
harness.go:515: cleaning up
63+
harness.go:572: removing temp folder: ""
64+
--- PASS: kuttl (2.18s)
65+
--- PASS: kuttl/harness (0.00s)
66+
--- PASS: kuttl/harness/005-app-wide-update-strategy (2.17s)
67+
PASS
68+
```

0 commit comments

Comments
 (0)