diff options
author | Luke Meyer <lmeyer@redhat.com> | 2017-03-30 13:08:34 -0400 |
---|---|---|
committer | Luke Meyer <lmeyer@redhat.com> | 2017-04-25 12:16:20 -0400 |
commit | 75f0c57654429d3b861d792169a9c1bdf9156bf8 (patch) | |
tree | 5d3e40be9e7f05d2855d8f7bd8bcaf21938e6bee /test/integration/openshift_health_checker/setup_container.yml | |
parent | 634a8957e1cc29374a170aaa8c2113b8fbbfe7e4 (diff) | |
download | openshift-75f0c57654429d3b861d792169a9c1bdf9156bf8.tar.gz openshift-75f0c57654429d3b861d792169a9c1bdf9156bf8.tar.bz2 openshift-75f0c57654429d3b861d792169a9c1bdf9156bf8.tar.xz openshift-75f0c57654429d3b861d792169a9c1bdf9156bf8.zip |
preflight int tests: generalize; add tests
Make the container setup and teardown more reusable.
Remove example tests.
Add basic package tests.
Diffstat (limited to 'test/integration/openshift_health_checker/setup_container.yml')
-rw-r--r-- | test/integration/openshift_health_checker/setup_container.yml | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/integration/openshift_health_checker/setup_container.yml b/test/integration/openshift_health_checker/setup_container.yml new file mode 100644 index 000000000..4dd2c4b1e --- /dev/null +++ b/test/integration/openshift_health_checker/setup_container.yml @@ -0,0 +1,45 @@ +--- +# Include this play once for each container you want to create and use as a test host. +# +# Optional parameters on the include are as follows: +# * scenario = unique name for the container to be started +# * image = name of the image to start in the container +# * command = command to run in the container +# * l_groups = host groups that the container should be added to +# * l_host_vars = any variables that should be added to the host + +- name: Start container for specified test host + gather_facts: no + hosts: localhost + connection: local + tasks: + + - set_fact: + # This is a little weird but if we use a var instead of a fact, + # a different random value is generated for each task. See: + # https://opensolitude.com/2015/05/27/ansible-lookups-variables-vs-facts.html + container_name: openshift_ansible_test_{{ scenario | default(100000000000000 | random) }} + + - name: start container + docker_container: + name: "{{ container_name }}" + image: "{{ image | default('test-target-base') }}" + command: "{{ command | default('sleep 1800') }}" + recreate: yes + # NOTE: When/if we need to run containers that are docker hosts as well: + # volumes: [ "/var/run/docker.sock:/var/run/docker.sock:z" ] + + - name: add container as host in inventory + add_host: + ansible_connection: docker + name: "{{ container_name }}" + groups: '{{ l_groups | default("masters,nodes,etcd") }}' + + # There ought to be a better way to transfer the host vars, but see: + # https://groups.google.com/forum/#!topic/Ansible-project/Jwx8RYhqxPA + - name: set host facts per test parameters + set_fact: + "{{ item.key }}": "{{ item.value }}" + delegate_facts: True + delegate_to: "{{ container_name }}" + with_dict: "{{ l_host_vars | default({}) }}" |