-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for .spec.contributions field in DevWorkspace
Add tests covering .spec.contributions field use in DevWorkspaces. This is done by copying tests for plugin components and adapting them to use contributions instead to make sure we cover as many use cases as possible. Signed-off-by: Angel Misevski <[email protected]>
- Loading branch information
Showing
26 changed files
with
1,942 additions
and
9 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
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
46 changes: 46 additions & 0 deletions
46
pkg/library/flatten/testdata/spec-contributions/adds-resources.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,46 @@ | ||
name: "Adds attributes from contribution" | ||
|
||
input: | ||
devworkspace: | ||
components: | ||
- name: test-component | ||
attributes: | ||
controller.devfile.io/merge-contribution: true | ||
container: | ||
image: test-image | ||
memoryLimit: 1Gi | ||
memoryRequest: 1000Mi | ||
cpuLimit: 1500m | ||
cpuRequest: "1" | ||
contributions: | ||
- name: test-contribution | ||
uri: test-contribution.yaml | ||
|
||
devfileResources: | ||
test-contribution.yaml: | ||
schemaVersion: 2.1.0 | ||
metadata: | ||
name: test-contribution | ||
components: | ||
- name: test-contribution | ||
attributes: | ||
controller.devfile.io/container-contribution: true | ||
container: | ||
image: contribution-image | ||
memoryLimit: 512Mi | ||
memoryRequest: 1.5G | ||
cpuLimit: "0.5" | ||
cpuRequest: 500m | ||
|
||
output: | ||
devworkspace: | ||
components: | ||
- name: test-component | ||
attributes: | ||
controller.devfile.io/merged-contributions: "test-contribution" | ||
container: | ||
image: test-image | ||
memoryLimit: 1536Mi | ||
memoryRequest: "2548576000" # 1.5G + 1000Mi = 1.5*1000^3 + 1000*1024^2 | ||
cpuLimit: "2" | ||
cpuRequest: 1500m |
75 changes: 75 additions & 0 deletions
75
pkg/library/flatten/testdata/spec-contributions/adds-unmerged-elements.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,75 @@ | ||
name: "Adds unmerged elements" | ||
|
||
input: | ||
devworkspace: | ||
components: | ||
- name: test-component | ||
attributes: | ||
controller.devfile.io/merge-contribution: true | ||
container: | ||
image: test-image | ||
env: | ||
- name: TEST_ENVVAR | ||
value: TEST_VALUE | ||
contributions: | ||
- name: test-contribution | ||
uri: test-contribution.yaml | ||
|
||
devfileResources: | ||
test-contribution.yaml: | ||
schemaVersion: 2.1.0 | ||
metadata: | ||
name: test-contribution | ||
components: | ||
- name: test-contribution | ||
attributes: | ||
controller.devfile.io/container-contribution: true | ||
container: | ||
image: contribution-image | ||
env: | ||
- name: CONTRIB_ENVVAR | ||
value: CONTRIB_VALUE | ||
- name: unmerged-container | ||
container: | ||
image: unmerged-container | ||
- name: unmerged-volume | ||
volume: {} | ||
commands: | ||
- name: plugin-command | ||
apply: | ||
component: unmerged-container | ||
events: | ||
prestart: | ||
- plugin-command | ||
|
||
output: | ||
devworkspace: | ||
components: | ||
- name: test-component | ||
attributes: | ||
controller.devfile.io/merged-contributions: "test-contribution" | ||
container: | ||
image: test-image | ||
env: | ||
- name: TEST_ENVVAR | ||
value: TEST_VALUE | ||
- name: CONTRIB_ENVVAR | ||
value: CONTRIB_VALUE | ||
- name: unmerged-container | ||
attributes: | ||
controller.devfile.io/imported-by: test-contribution | ||
container: | ||
image: unmerged-container | ||
- name: unmerged-volume | ||
attributes: | ||
controller.devfile.io/imported-by: test-contribution | ||
volume: {} | ||
commands: | ||
- name: plugin-command | ||
attributes: | ||
controller.devfile.io/imported-by: test-contribution | ||
apply: | ||
component: unmerged-container | ||
events: | ||
prestart: | ||
- plugin-command |
Oops, something went wrong.