forked from devfile/devworkspace-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add overrides test cases for patch directives
Signed-off-by: Angel Misevski <[email protected]>
- Loading branch information
Showing
8 changed files
with
221 additions
and
14 deletions.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
...ibrary/overrides/testdata/container-overrides/overrides-can-override-securityContext.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,26 @@ | ||
name: "container overrides can override securityContext" | ||
|
||
input: | ||
component: | ||
name: test-component | ||
attributes: | ||
container-overrides: | ||
securityContext: | ||
runAsUser: 1001 | ||
container: | ||
image: test-image | ||
|
||
container: | ||
name: test-component | ||
image: test-image | ||
securityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 2000 | ||
|
||
output: | ||
container: | ||
name: test-component | ||
image: test-image | ||
securityContext: | ||
runAsUser: 1001 | ||
runAsGroup: 2000 |
24 changes: 24 additions & 0 deletions
24
pkg/library/overrides/testdata/container-overrides/overrides-can-use-delete-directive.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,24 @@ | ||
name: "container overrides can use $patch: delete to delete fields rather than merging" | ||
|
||
input: | ||
component: | ||
name: test-component | ||
attributes: | ||
container-overrides: | ||
securityContext: | ||
$patch: delete | ||
container: | ||
image: test-image | ||
|
||
container: | ||
name: test-component | ||
image: test-image | ||
securityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 2000 | ||
|
||
output: | ||
container: | ||
name: test-component | ||
image: test-image | ||
securityContext: {} |
26 changes: 26 additions & 0 deletions
26
pkg/library/overrides/testdata/container-overrides/overrides-can-use-replace-directive.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,26 @@ | ||
name: "container overrides can use $patch: replace to overwrite fields rather than merging" | ||
|
||
input: | ||
component: | ||
name: test-component | ||
attributes: | ||
container-overrides: | ||
securityContext: | ||
runAsUser: 1001 | ||
$patch: replace | ||
container: | ||
image: test-image | ||
|
||
container: | ||
name: test-component | ||
image: test-image | ||
securityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 2000 | ||
|
||
output: | ||
container: | ||
name: test-component | ||
image: test-image | ||
securityContext: | ||
runAsUser: 1001 |
25 changes: 25 additions & 0 deletions
25
pkg/library/overrides/testdata/pod-overrides/error_cannot-override-volumes.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,25 @@ | ||
name: "Returns error when attempting to patch pod volumes" | ||
|
||
input: | ||
workspace: | ||
attributes: | ||
pod-overrides: | ||
spec: | ||
volumes: | ||
- name: test-volume | ||
components: | ||
- name: test-component | ||
container: | ||
image: test-image | ||
|
||
podTemplateSpec: | ||
metadata: | ||
labels: | ||
controller.devfile.io/devworkspace-id: test-id | ||
spec: | ||
containers: | ||
- name: test-component | ||
image: test-image | ||
|
||
output: | ||
errRegexp: "cannot use pod-overrides to override pod volumes" |
41 changes: 41 additions & 0 deletions
41
pkg/library/overrides/testdata/pod-overrides/overrides-can-override-securityContext.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,41 @@ | ||
name: "Pod overrides can override securityContext" | ||
|
||
input: | ||
workspace: | ||
attributes: | ||
pod-overrides: | ||
spec: | ||
securityContext: | ||
runAsUser: 1001 | ||
components: | ||
- name: test-component | ||
container: | ||
image: test-image | ||
|
||
podTemplateSpec: | ||
metadata: | ||
labels: | ||
controller.devfile.io/devworkspace-id: test-id | ||
spec: | ||
containers: | ||
- name: test-component | ||
image: test-image | ||
securityContext: | ||
fsGroup: 2000 | ||
runAsGroup: 3000 | ||
runAsUser: 1000 | ||
|
||
|
||
output: | ||
podTemplateSpec: | ||
metadata: | ||
labels: | ||
controller.devfile.io/devworkspace-id: test-id | ||
spec: | ||
containers: | ||
- name: test-component | ||
image: test-image | ||
securityContext: | ||
fsGroup: 2000 | ||
runAsGroup: 3000 | ||
runAsUser: 1001 |
38 changes: 38 additions & 0 deletions
38
pkg/library/overrides/testdata/pod-overrides/overrides-can-use-delete-directive.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,38 @@ | ||
name: "Pod overrides can use $patch: delete to delete fields rather than merging" | ||
|
||
input: | ||
workspace: | ||
attributes: | ||
pod-overrides: | ||
spec: | ||
securityContext: | ||
$patch: delete | ||
components: | ||
- name: test-component | ||
container: | ||
image: test-image | ||
|
||
podTemplateSpec: | ||
metadata: | ||
labels: | ||
controller.devfile.io/devworkspace-id: test-id | ||
spec: | ||
containers: | ||
- name: test-component | ||
image: test-image | ||
securityContext: | ||
fsGroup: 2000 | ||
runAsGroup: 3000 | ||
runAsUser: 1000 | ||
|
||
|
||
output: | ||
podTemplateSpec: | ||
metadata: | ||
labels: | ||
controller.devfile.io/devworkspace-id: test-id | ||
spec: | ||
containers: | ||
- name: test-component | ||
image: test-image | ||
securityContext: {} |
40 changes: 40 additions & 0 deletions
40
pkg/library/overrides/testdata/pod-overrides/overrides-can-use-replace-directive.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,40 @@ | ||
name: "Pod overrides can use $patch: replace to overwrite fields rather than merging" | ||
|
||
input: | ||
workspace: | ||
attributes: | ||
pod-overrides: | ||
spec: | ||
securityContext: | ||
runAsUser: 1001 | ||
$patch: replace | ||
components: | ||
- name: test-component | ||
container: | ||
image: test-image | ||
|
||
podTemplateSpec: | ||
metadata: | ||
labels: | ||
controller.devfile.io/devworkspace-id: test-id | ||
spec: | ||
containers: | ||
- name: test-component | ||
image: test-image | ||
securityContext: | ||
fsGroup: 2000 | ||
runAsGroup: 3000 | ||
runAsUser: 1000 | ||
|
||
|
||
output: | ||
podTemplateSpec: | ||
metadata: | ||
labels: | ||
controller.devfile.io/devworkspace-id: test-id | ||
spec: | ||
containers: | ||
- name: test-component | ||
image: test-image | ||
securityContext: | ||
runAsUser: 1001 |