Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 1 | --- |
| 2 | # test-examplservice/tasks/main.yml |
| 3 | # |
| 4 | # Run tests to check that the single-node deployment has worked |
| 5 | |
| 6 | - name: Onboard ExampleService and instantiate a VM |
| 7 | command: ansible xos-1 -u ubuntu -m shell \ |
| 8 | -a "cd ~/service-profile/cord-pod; make exampleservice" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 9 | tags: |
| 10 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 11 | |
| 12 | - name: Pause 60 seconds (work around bug in synchronizer) |
| 13 | pause: seconds=60 |
| 14 | |
| 15 | - name: Re-run 'make vtn' (work around bug in synchronizer) |
| 16 | command: ansible xos-1 -u ubuntu -m shell \ |
| 17 | -a "cd ~/service-profile/cord-pod; make vtn" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 18 | tags: |
| 19 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 20 | |
| 21 | - name: Wait for ExampleService VM to come up |
| 22 | shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null" |
| 23 | register: result |
| 24 | until: result | success |
| 25 | retries: 10 |
| 26 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 27 | tags: |
| 28 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 29 | |
| 30 | - name: Get ID of VM |
| 31 | shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2" |
| 32 | register: nova_id |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 33 | tags: |
| 34 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 35 | |
| 36 | - name: Get mgmt IP of VM |
| 37 | shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 172.27.[[:digit:]]*.[[:digit:]]*" |
| 38 | register: mgmt_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 39 | tags: |
| 40 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 41 | |
| 42 | - name: Get public IP of VM |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 43 | shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 10.6.[[:digit:]]*.[[:digit:]]*" |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 44 | register: public_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 45 | tags: |
| 46 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 47 | |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 48 | - name: Get name of compute node |
| 49 | shell: bash -c "source ~/admin-openrc.sh; nova service-list|grep nova-compute|cut -d '|' -f 3" |
| 50 | register: node_name |
| 51 | tags: |
| 52 | - skip_ansible_lint # running a sub job |
| 53 | |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 54 | - name: Wait for Apache to come up inside VM |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 55 | shell: ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu {{ node_name.stdout }}" ubuntu@{{ mgmt_ip.stdout }} "ls /var/run/apache2/apache2.pid" > /dev/null |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 56 | register: result |
| 57 | until: result | success |
| 58 | retries: 20 |
| 59 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 60 | tags: |
| 61 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 62 | |
| 63 | - name: Install curl in testclient |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 64 | become: yes |
| 65 | lxc_container: |
| 66 | name: testclient |
| 67 | container_command: apt-get -y install curl |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 68 | tags: |
| 69 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 70 | |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 71 | # Don't use lxc_container in order to get output |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 72 | - name: Test connectivity to ExampleService from test client |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 73 | become: yes |
| 74 | command: lxc-attach -n testclient -- curl -s http://{{ public_ip.stdout }} |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 75 | register: curltest |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 76 | tags: |
| 77 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 78 | |
| 79 | - name: Output from curl test |
| 80 | debug: var=curltest.stdout_lines |