-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add log_opt and annotaion options to podman_play module (#668)
* Add tests for options of podman_play Signed-off-by: nishipy <goodisonev4@gmail.com> * Add log_opt and annotaion options for podman_play Signed-off-by: nishipy <goodisonev4@gmail.com> * Fix pep8 errors Signed-off-by: nishipy <goodisonev4@gmail.com> * Update tests in play-with-options.yml Signed-off-by: nishipy <goodisonev4@gmail.com> * Update podman_play.py Signed-off-by: nishipy <goodisonev4@gmail.com> * Update test Signed-off-by: nishipy <goodisonev4@gmail.com> --------- Signed-off-by: nishipy <goodisonev4@gmail.com>
- Loading branch information
Showing
4 changed files
with
130 additions
and
1 deletion.
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
14 changes: 14 additions & 0 deletions
14
tests/integration/targets/podman_play/tasks/files/play-pod.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,14 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: web-deploy | ||
labels: | ||
app: webapp | ||
spec: | ||
containers: | ||
- name: alpinex | ||
image: alpine | ||
command: ['sleep', '1d'] | ||
- name: alpiney | ||
image: alpine | ||
command: ['sleep', '1d'] |
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
52 changes: 52 additions & 0 deletions
52
tests/integration/targets/podman_play/tasks/play-with-options.yml
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,52 @@ | ||
--- | ||
- name: Test play pod with options | ||
block: | ||
- name: Copy kube file | ||
copy: | ||
src: "{{ kube_file }}" | ||
dest: "{{ kube_dir }}/{{ kube_file }}" | ||
remote_src: false | ||
|
||
- name: Create Pod with many options | ||
containers.podman.podman_play: | ||
kube_file: "{{ kube_dir }}/{{ kube_file }}" | ||
state: started | ||
recreate: true | ||
annotation: | ||
greeting: hello | ||
greet_to: world | ||
userns: "{{ userns }}" | ||
log_opt: | ||
path: "{{ log_opt.path }}" | ||
max_size: "{{ log_opt.size }}" | ||
register: play_pod | ||
|
||
- name: Get pod info | ||
containers.podman.podman_pod_info: | ||
name: "{{ target_pod }}" | ||
register: play_pod_info | ||
|
||
- name: Check userns is set in Pod | ||
assert: | ||
that: | ||
- play_pod_info.pods.0.InfraConfig.userns == userns | ||
|
||
- name: Get container info | ||
containers.podman.podman_container_info: | ||
name: "{{ target_container }}" | ||
register: play_container_info | ||
|
||
- name: Check annotations and log options are set in Pod | ||
assert: | ||
that: | ||
- play_container_info.containers.0.Config.Annotations["greeting"] == "hello" | ||
- play_container_info.containers.0.Config.Annotations["greet_to"] == "world" | ||
- play_container_info.containers.0.HostConfig.LogConfig["Path"] == log_opt.path | ||
- play_container_info.containers.0.HostConfig.LogConfig["Size"] | lower == log_opt.size | ||
|
||
always: | ||
|
||
- name: Cleanup pods | ||
containers.podman.podman_play: | ||
kube_file: "{{ kube_dir }}/{{ kube_file }}" | ||
state: absent |