issue #409: more lxc/lxd stub tests, let tests run on vanilla.

issue260
David Wilson 6 years ago
parent 54445470e2
commit 144685a327

@ -1,3 +1,5 @@
- import_playbook: kubectl.yml - import_playbook: kubectl.yml
- import_playbook: lxc.yml
- import_playbook: lxd.yml
- import_playbook: setns_lxc.yml - import_playbook: setns_lxc.yml
- import_playbook: setns_lxd.yml - import_playbook: setns_lxd.yml

@ -4,6 +4,9 @@
gather_facts: false gather_facts: false
any_errors_fatal: true any_errors_fatal: true
tasks: tasks:
- meta: end_play
when: not is_mitogen
- meta: end_play - meta: end_play
when: ansible_version.full < '2.5' when: ansible_version.full < '2.5'

@ -0,0 +1,18 @@
- name: integration/stub_connections/lxc.yml
hosts: test-targets
gather_facts: false
any_errors_fatal: true
tasks:
- meta: end_play
when: not is_mitogen
- custom_python_detect_environment:
vars:
ansible_connection: lxc
mitogen_lxc_attach_path: stub-lxc-attach.py
register: out
- assert:
that:
- out.env.THIS_IS_STUB_LXC_ATTACH == '1'

@ -0,0 +1,18 @@
- name: integration/stub_connections/lxd.yml
hosts: test-targets
gather_facts: false
any_errors_fatal: true
tasks:
- meta: end_play
when: not is_mitogen
- custom_python_detect_environment:
vars:
ansible_connection: lxd
mitogen_lxc_path: stub-lxc.py
register: out
- assert:
that:
- out.env.THIS_IS_STUB_LXC == '1'

@ -8,6 +8,9 @@
any_errors_fatal: false any_errors_fatal: false
connection: local connection: local
tasks: tasks:
- meta: end_play
when: not is_mitogen
- include_tasks: _end_play_if_not_sudo_linux.yml - include_tasks: _end_play_if_not_sudo_linux.yml
- command: | - command: |
@ -22,9 +25,6 @@
args: args:
chdir: ../.. chdir: ../..
warn: false warn: false
when: |
out.ansible_facts.ansible_system == 'Linux'
and sudo_available.rc == 0
register: result register: result
- assert: - assert:

@ -2,12 +2,15 @@
# setns is hard -- it wants to do superuser syscalls, so we must run it in a # setns is hard -- it wants to do superuser syscalls, so we must run it in a
# child Ansible via sudo. But that only works if sudo works. # child Ansible via sudo. But that only works if sudo works.
- name: integration/stub_connections/setns_lxc.yml - name: integration/stub_connections/setns_lxd.yml
hosts: test-targets hosts: test-targets
gather_facts: false gather_facts: false
any_errors_fatal: false any_errors_fatal: false
connection: local connection: local
tasks: tasks:
- meta: end_play
when: not is_mitogen
- include_tasks: _end_play_if_not_sudo_linux.yml - include_tasks: _end_play_if_not_sudo_linux.yml
- command: | - command: |
@ -15,7 +18,7 @@
-i localhost, -i localhost,
-c setns -c setns
-e mitogen_kind=lxd -e mitogen_kind=lxd
-e mitogen_lxc_info_path=stub-lxc.py -e mitogen_lxc_path=stub-lxc.py
-m shell -m shell
-a "echo hi" -a "echo hi"
localhost localhost

@ -4,4 +4,5 @@ import sys
import os import os
os.environ['ORIGINAL_ARGV'] = repr(sys.argv) os.environ['ORIGINAL_ARGV'] = repr(sys.argv)
os.environ['THIS_IS_STUB_LXC_ATTACH'] = '1'
os.execv(sys.executable, sys.argv[sys.argv.index('--') + 1:]) os.execv(sys.executable, sys.argv[sys.argv.index('--') + 1:])

@ -9,4 +9,5 @@ if sys.argv[1] == 'info':
sys.exit(0) sys.exit(0)
os.environ['ORIGINAL_ARGV'] = repr(sys.argv) os.environ['ORIGINAL_ARGV'] = repr(sys.argv)
os.environ['THIS_IS_STUB_LXC'] = '1'
os.execv(sys.executable, sys.argv[sys.argv.index('--') + 1:]) os.execv(sys.executable, sys.argv[sys.argv.index('--') + 1:])

Loading…
Cancel
Save