Skip to content

Commit

Permalink
chore: Refactor test for wait functionality
Browse files Browse the repository at this point in the history
- Test all supported resources separatly
- Test DaemonSet resource
  • Loading branch information
s-diez committed Jun 26, 2024
1 parent ea02f51 commit 2b9c32b
Show file tree
Hide file tree
Showing 18 changed files with 261 additions and 286 deletions.
374 changes: 134 additions & 240 deletions kustomize/resource_kustomization_test.go

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions kustomize/test_kustomizations/nowait/initial/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: test
name: test
spec:
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- image: nginx
name: nginx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ namespace: test-nowait

resources:
- namespace.yaml
- daemonset.yaml
- statefulset.yaml
- ../../_example_app
8 changes: 4 additions & 4 deletions kustomize/test_kustomizations/nowait/initial/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: test-statefulset
name: test-statefulset
app: test
name: test
spec:
replicas: 1
selector:
matchLabels:
app: test-statefulset
app: test
template:
metadata:
labels:
app: test-statefulset
app: test
spec:
containers:
- image: nginx
Expand Down
12 changes: 10 additions & 2 deletions kustomize/test_kustomizations/nowait/modified/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ patches:
path: /spec/template/metadata/annotations
value:
new: this will cause a redeploy
- target:
kind: DaemonSet
name: test
patch: |
- op: add
path: /spec/template/metadata/annotations
value:
new: this will cause a redeploy
- target:
kind: StatefulSet
name: test-statefulset
name: test
patch: |
- op: add
path: /spec/template/metadata/annotations
value:
new: this will cause statefulset to redeploy
new: this will cause a redeploy
18 changes: 18 additions & 0 deletions kustomize/test_kustomizations/wait-change/initial/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: test
name: test
spec:
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- image: nginx
name: nginx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ namespace: test-wait-change

resources:
- namespace.yaml
- daemonset.yaml
- statefulset.yaml
- ../../_example_app
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: test-statefulset
name: test-statefulset
app: test
name: test
spec:
replicas: 1
selector:
matchLabels:
app: test-statefulset
app: test
template:
metadata:
labels:
app: test-statefulset
app: test
spec:
containers:
- image: nginx
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

18 changes: 18 additions & 0 deletions kustomize/test_kustomizations/wait-fail/initial/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: test
name: test
spec:
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- image: nginx
name: nginx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ namespace: test-wait-fail

resources:
- namespace.yaml
- daemonset.yaml
- statefulset.yaml
- ../../_example_app

images:
Expand Down
19 changes: 19 additions & 0 deletions kustomize/test_kustomizations/wait-fail/initial/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: test
name: test
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- image: nginx
name: nginx
18 changes: 18 additions & 0 deletions kustomize/test_kustomizations/wait/initial/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: test
name: test
spec:
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- image: nginx
name: nginx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ namespace: test-wait

resources:
- namespace.yaml
- daemonset.yaml
- statefulset.yaml
- ../../_example_app
8 changes: 4 additions & 4 deletions kustomize/test_kustomizations/wait/initial/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: test-statefulset
name: test-statefulset
app: test
name: test
spec:
replicas: 1
selector:
matchLabels:
app: test-statefulset
app: test
template:
metadata:
labels:
app: test-statefulset
app: test
spec:
containers:
- image: nginx
Expand Down
10 changes: 9 additions & 1 deletion kustomize/test_kustomizations/wait/modified/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ patches:
new: this will cause a redeploy
- target:
kind: StatefulSet
name: test-statefulset
name: test
patch: |
- op: add
path: /spec/template/metadata/annotations
value:
new: this will cause a redeploy
- target:
kind: DaemonSet
name: test
patch: |
- op: add
path: /spec/template/metadata/annotations
Expand Down

0 comments on commit 2b9c32b

Please sign in to comment.