-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(e2e): Add e2e test for filtering apps by name with match-applic…
…ation-name option (#841) Signed-off-by: Cheng Fang <[email protected]>
- Loading branch information
Showing
11 changed files
with
309 additions
and
0 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
test/e2e/suite/102-kustomize-match-application-name/01-install.yaml
This file contains 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,83 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: image-updater-e2e-102-0 | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: image-updater-102-0 | ||
annotations: | ||
argocd-image-updater.argoproj.io/image-list: guestbook=gcr.io/heptio-images/ks-guestbook-demo:~0 | ||
argocd-image-updater.argoproj.io/test.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-102-0 | ||
syncPolicy: | ||
automated: {} | ||
retry: | ||
limit: 2 | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: image-updater-e2e-102-1 | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: image-updater-102-1 | ||
annotations: | ||
argocd-image-updater.argoproj.io/image-list: guestbook=gcr.io/heptio-images/ks-guestbook-demo:~0 | ||
argocd-image-updater.argoproj.io/test.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-102-1 | ||
syncPolicy: | ||
automated: {} | ||
retry: | ||
limit: 2 | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: image-updater-e2e-102-2 | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: image-updater-102-2 | ||
annotations: | ||
argocd-image-updater.argoproj.io/image-list: guestbook=gcr.io/heptio-images/ks-guestbook-demo:~0 | ||
argocd-image-updater.argoproj.io/test.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-102-2 | ||
syncPolicy: | ||
automated: {} | ||
retry: | ||
limit: 2 |
29 changes: 29 additions & 0 deletions
29
test/e2e/suite/102-kustomize-match-application-name/02-assert.yaml
This file contains 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,29 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: image-updater-102-0 | ||
status: | ||
health: | ||
status: Healthy | ||
sync: | ||
status: Synced | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: image-updater-102-1 | ||
status: | ||
health: | ||
status: Healthy | ||
sync: | ||
status: Synced | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: image-updater-102-2 | ||
status: | ||
health: | ||
status: Healthy | ||
sync: | ||
status: Synced |
9 changes: 9 additions & 0 deletions
9
test/e2e/suite/102-kustomize-match-application-name/02-run-updater.yaml
This file contains 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,9 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: | | ||
${SRC_DIR}/dist/argocd-image-updater run --once \ | ||
--argocd-namespace argocd-image-updater-e2e \ | ||
--match-application-name no-match* \ | ||
--registries-conf-path="" \ | ||
--loglevel info |
34 changes: 34 additions & 0 deletions
34
test/e2e/suite/102-kustomize-match-application-name/03-assert.yaml
This file contains 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,34 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: image-updater-102-0 | ||
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-102-1 | ||
status: | ||
health: | ||
status: Healthy | ||
sync: | ||
status: Synced | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: image-updater-102-2 | ||
status: | ||
health: | ||
status: Healthy | ||
sync: | ||
status: Synced |
9 changes: 9 additions & 0 deletions
9
test/e2e/suite/102-kustomize-match-application-name/03-run-updater.yaml
This file contains 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,9 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: | | ||
${SRC_DIR}/dist/argocd-image-updater run --once \ | ||
--argocd-namespace argocd-image-updater-e2e \ | ||
--match-application-name image-updater-102-0 \ | ||
--registries-conf-path="" \ | ||
--loglevel info |
39 changes: 39 additions & 0 deletions
39
test/e2e/suite/102-kustomize-match-application-name/04-assert.yaml
This file contains 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,39 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: image-updater-102-0 | ||
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-102-1 | ||
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-102-2 | ||
status: | ||
health: | ||
status: Healthy | ||
sync: | ||
status: Synced |
10 changes: 10 additions & 0 deletions
10
test/e2e/suite/102-kustomize-match-application-name/04-run-updater.yaml
This file contains 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 | ||
commands: | ||
- script: | | ||
${SRC_DIR}/dist/argocd-image-updater run --once \ | ||
--argocd-namespace argocd-image-updater-e2e \ | ||
--match-application-name image-updater-102-0 \ | ||
--match-application-name image-updater-102-1 \ | ||
--registries-conf-path="" \ | ||
--loglevel info |
44 changes: 44 additions & 0 deletions
44
test/e2e/suite/102-kustomize-match-application-name/05-assert.yaml
This file contains 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,44 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: image-updater-102-0 | ||
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-102-1 | ||
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-102-2 | ||
spec: | ||
source: | ||
kustomize: | ||
images: | ||
- gcr.io/heptio-images/ks-guestbook-demo:0.2 | ||
status: | ||
health: | ||
status: Healthy | ||
sync: | ||
status: Synced |
9 changes: 9 additions & 0 deletions
9
test/e2e/suite/102-kustomize-match-application-name/05-run-updater.yaml
This file contains 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,9 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: | | ||
${SRC_DIR}/dist/argocd-image-updater run --once \ | ||
--argocd-namespace argocd-image-updater-e2e \ | ||
--match-application-name image-updater-102-* \ | ||
--registries-conf-path="" \ | ||
--loglevel info |
22 changes: 22 additions & 0 deletions
22
test/e2e/suite/102-kustomize-match-application-name/99-delete.yaml
This file contains 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,22 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
timeout: 120 | ||
delete: | ||
- apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
name: image-updater-102-0 | ||
- apiVersion: v1 | ||
kind: Namespace | ||
name: image-updater-e2e-102-0 | ||
- apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
name: image-updater-102-1 | ||
- apiVersion: v1 | ||
kind: Namespace | ||
name: image-updater-e2e-102-1 | ||
- apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
name: image-updater-102-2 | ||
- apiVersion: v1 | ||
kind: Namespace | ||
name: image-updater-e2e-102-2 |
21 changes: 21 additions & 0 deletions
21
test/e2e/suite/102-kustomize-match-application-name/README.md
This file contains 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,21 @@ | ||
This test case verifies [filtering applications by name](https://argocd-image-updater.readthedocs.io/en/stable/install/reference/#flags) with `--match-application-name` command line options | ||
* match against a non-existent application name | ||
* match against an exact application name | ||
* specify `--match-application-name` option multiple times to match against multiple application names | ||
* use wild card `*` in application name pattern | ||
|
||
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 102-kustomize-match-application-name` | ||
|
||
The test output logs that during each test step, 0, 1, 2, or 3 images are updated, as specified by argocd-image-updater `--match-application-name` option: | ||
```bash | ||
102-kustomize-match-application-name/2-run-updater msg="Processing results: applications=0 images_considered=0 images_skipped=0 images_updated=0 errors=0" | ||
102-kustomize-match-application-name/3-run-updater msg="Processing results: applications=1 images_considered=1 images_skipped=0 images_updated=1 errors=0" | ||
102-kustomize-match-application-name/4-run-updater msg="Processing results: applications=2 images_considered=2 images_skipped=0 images_updated=2 errors=0" | ||
102-kustomize-match-application-name/5-run-updater msg="Processing results: applications=3 images_considered=3 images_skipped=0 images_updated=3 errors=0" | ||
``` |