tests: split etc_environment test in two

Turns out nobody supports ~/.pam_environment any more. Keep the
behaviour around for the time being.
issue510
David Wilson 6 years ago
parent 59eb6d13c5
commit a717c5406c

@ -0,0 +1,35 @@
# /etc/environment
- file:
path: /etc/environment
state: absent
become: true
- shell: echo $MAGIC_ETC_ENV
register: echo
- assert:
that: echo.stdout == ""
- copy:
dest: /etc/environment
content: |
MAGIC_ETC_ENV=555
become: true
- shell: echo $MAGIC_ETC_ENV
register: echo
- assert:
that: echo.stdout == "555"
- file:
path: /etc/environment
state: absent
become: true
- shell: echo $MAGIC_ETC_ENV
register: echo
- assert:
that: echo.stdout == ""

@ -0,0 +1,32 @@
# ~/.pam_environment
- file:
path: ~/.pam_environment
state: absent
- shell: echo $MAGIC_PAM_ENV
register: echo
- assert:
that: echo.stdout == ""
- copy:
dest: ~/.pam_environment
content: |
MAGIC_PAM_ENV=321
- shell: echo $MAGIC_PAM_ENV
register: echo
- assert:
that: echo.stdout == "321"
- file:
path: ~/.pam_environment
state: absent
- shell: echo $MAGIC_PAM_ENV
register: echo
- assert:
that: echo.stdout == ""

@ -3,78 +3,13 @@
# but less likely to brick a development workstation
- name: integration/runner/etc_environment.yml
hosts: test-targets
hosts: test-targets[0]
any_errors_fatal: true
gather_facts: true
tasks:
# ~/.pam_environment
- include_tasks: _etc_environment_user.yml
when: ansible_system == "Linux" and is_mitogen
- file:
path: ~/.pam_environment
state: absent
- shell: echo $MAGIC_PAM_ENV
register: echo
- assert:
that: echo.stdout == ""
- copy:
dest: ~/.pam_environment
content: |
MAGIC_PAM_ENV=321
- shell: echo $MAGIC_PAM_ENV
register: echo
- assert:
that: echo.stdout == "321"
- file:
path: ~/.pam_environment
state: absent
- shell: echo $MAGIC_PAM_ENV
register: echo
- assert:
that: echo.stdout == ""
# /etc/environment
- meta: end_play
when: ansible_virtualization_type != "docker"
- file:
path: /etc/environment
state: absent
become: true
- shell: echo $MAGIC_ETC_ENV
register: echo
- assert:
that: echo.stdout == ""
- copy:
dest: /etc/environment
content: |
MAGIC_ETC_ENV=555
become: true
- shell: echo $MAGIC_ETC_ENV
register: echo
- assert:
that: echo.stdout == "555"
- file:
path: /etc/environment
state: absent
become: true
- shell: echo $MAGIC_ETC_ENV
register: echo
- assert:
that: echo.stdout == ""
- include_tasks: _etc_environment_global.yml
# Don't destroy laptops.
when: ansible_virtualization_type == "docker"

Loading…
Cancel
Save