Add ability to enable/disable SELinux during tests

Add a pair of variables to control whether or not SELinux
is enabled during particular tests.  In all cases, make
sure it's re-enabled afterwards.

Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
Chris Evich 2017-10-24 19:40:05 -04:00
parent b3ab85b908
commit adf664928a
3 changed files with 19 additions and 3 deletions

View file

@ -48,15 +48,16 @@
&> {{ artifacts }}/e2e.log
# Fix vim syntax hilighting: "
- name: disable SELinux
command: setenforce 0
- block:
- name: Disable swap during e2e tests
command: 'swapoff -a'
when: not e2e_swap_enabled
- name: Disable selinux during e2e tests
command: 'setenforce 0'
when: not e2e_selinux_enabled
- name: run e2e tests
shell: "{{ e2e_shell_cmd | regex_replace('\\s+', ' ') }}"
args:
@ -64,5 +65,8 @@
always:
- name: Re-enable SELinux after e2e tsts
command: 'setenforce 1'
- name: Re-enalbe swap after e2e tests
command: 'swapon -a'

View file

@ -23,6 +23,10 @@
command: 'swapoff -a'
when: not integration_swap_enabled
- name: Disable selinux during integration tests
command: 'setenforce 0'
when: not integration_selinux_enabled
- name: run integration tests
shell: "CGROUP_MANAGER=cgroupfs STORAGE_OPTIONS='--storage-driver=overlay{{ extra_storage_opts | default('') }}' make localintegration >& {{ artifacts }}/testout.txt"
args:
@ -32,5 +36,8 @@
always:
- name: Re-enable SELinux after integration tsts
command: 'setenforce 1'
- name: Re-enalbe swap after integration tests
command: 'swapon -a'

View file

@ -8,6 +8,11 @@ swapfileGB: 8
integration_swap_enabled: False
e2e_swap_enabled: True
# When False, disable SELinux on the system only during
# particular tests.
integration_selinux_enabled: True
e2e_selinux_enabled: False
# For results.yml Paths use rsync 'source' conventions
artifacts: "/tmp/artifacts" # Base-directory for collection
crio_integration_filepath: "{{ artifacts }}/testout.txt"