Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for env files #705

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions tests/integration/targets/podman_container/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,71 @@
that:
- not service2_file.stat.exists | bool

- name: Create environment variables files
copy:
dest: /tmp/envfile
content: |
FOO=bar
BAR=foo
TEST=1
BOOL=false

- name: Create another environment variables files
copy:
dest: /tmp/envfile2
content: |
TESTVAR=qwerty

- name: Create container with environment variables file
containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
name: container1
image: alpine
state: started
command:
- sh
- -c
- echo $BAR
attach:
- stdout
- stderr
env_file: /tmp/envfile
register: envfile

- name: Check output is correct for env file
assert:
that:
- envfile.stdout == "foo\n"

- name: Create container with multiple environment variables files
containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
name: container1
image: alpine
state: started
command:
- sh
- -c
- echo $TESTVAR
attach:
- stdout
- stderr
env_file:
- /tmp/envfile
- /tmp/envfile2
register: envfile2

- name: Check output is correct for multiple env files
assert:
that:
- envfile2.stdout == "qwerty\n"

- name: Delete container with environment variables file
containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
name: container1
state: absent

- name: Create temporary rootfs directory
ansible.builtin.tempfile:
state: directory
Expand Down
Loading