Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
fixup! Run PAPR on newly added test
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-nguyen committed Jun 9, 2017
1 parent 0cb112d commit e8bb4c3
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 216 deletions.
1 change: 1 addition & 0 deletions .test_director
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if [ ${#NEW_TESTS[@]} -eq 0 ]; then
ansible-playbook -vi testnode, common/ans_ah_head-1_deploy.yml
ansible-playbook -vi testnode, tests/improved-sanity-test/main.yml
else
printf '%s\n' "${NEW_TESTS[@]}"
for NEW_TEST in "${NEW_TESTS[@]}"; do
ansible-playbook -vi testnode, $NEW_TEST
done
Expand Down
35 changes: 0 additions & 35 deletions tests/fake-test/README.md

This file was deleted.

6 changes: 0 additions & 6 deletions tests/fake-test/info.txt

This file was deleted.

171 changes: 0 additions & 171 deletions tests/fake-test/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,174 +29,3 @@
avc_minor: "2"
tags:
- ansible_version_check

- role: docker_version_check
docker_version: 1.12.0
tags:
- docker_version_check

# Subscribe if the system is RHEL
- role: redhat_subscription
when: ansible_distribution == 'RedHat'
tags:
- redhat_subscription

post_tasks:
# docker swarm will not work with live restore enabled
# and must be turned off
- name: Determine if /etc/docker/daemon.json exists
stat:
path: /etc/docker/daemon.json
register: daemon_file

- name: Turn off live restore
replace:
dest: /etc/docker/daemon.json
regexp: 'true'
replace: 'false'
when: daemon_file.stat.exists

- name: Restart docker service
service:
name: docker
state: restarted
when: daemon_file.stat.exists

- name: Docker Swarm - Basic Functional Test
hosts: all
become: yes

tags:
- basic

vars_files:
- vars.yml

tasks:
- name: Verify docker swarm is not running
command: docker info
register: di

- name: Fail if docker swarm is already running
fail:
msg: "Docker swarm is already running"
when: "'Swarm: active' in di.stdout"

- name: Initialize docker swarm
command: docker swarm init --advertise-addr 127.0.0.1

- name: Verify docker swarm is started
command: docker info
register: di

- name: Fail if docker swarm is is not active
fail:
msg: "Docker swarm is not active"
when: "'Swarm: active' not in di.stdout"

- name: Create docker swarm service
command: >
docker service create
--replicas 1
--name {{ g_service_name }}
-p {{ g_ports }}
{{ g_image_name }}
- name: Verify service is started
command: docker service ls
register: dsls

- name: Fail if httpd is not in output
fail:
msg: "{{ g_service_name }} is not in docker service ls output"
when: g_service_name not in dsls.stdout

- name: Wait for the {{ g_service_name }} container to open port 80
wait_for:
port: 80
timeout: 30

- name: Run docker ps
command: docker ps
register: dps

- name: Fail if docker ps output does not contain {{ g_image_name }}
fail:
msg: "Docker ps output does not contain {{ g_image_name }}"
when: g_image_name not in dps.stdout

- name: Inspect the {{ g_service_name }} service
command: docker inspect {{ g_service_name }}
register: dis

# check image
- name: Fail when image is incorrect
fail:
msg: "Image is incorrect"
when: g_image_name not in dis.stdout

- name: Scale service to 5 instances
command: docker service scale {{ g_service_name }}=5

- name: Check for 5 instances of {{ g_service_name }}
shell: docker ps | grep {{ g_image_name }} | wc -l
register: num_services
until: num_services.stdout == "5"
retries: 5
delay: 2

- name: Fail if services did not scale
fail:
msg: "Service did not scale to 5 instances"
when: num_services.stdout != "5"

- name: Scale service back to 1 instance
command: docker service scale {{ g_service_name }}=1

- name: Check for 1 instance of {{ g_service_name }}
shell: docker ps | grep {{ g_image_name }} | wc -l
register: num_services
until: num_services.stdout == "1"
retries: 5
delay: 2

- name: Remove {{ g_service_name }}
command: docker service remove {{ g_service_name }}

- name: Verify {{ g_service_name }} is not longer active
command: docker service ls
register: dsls

- name: Fail if {{ g_service_name }} is still in docker service ls output
fail:
msg: "{{ g_service_name }} should not be in docker service ls output"
when: g_service_name in dsls.stdout

- name: Deactivate swarm
command: docker swarm leave --force

- name: Verify swarm is inactive
command: docker info
register: di

- name: Fail if swarm is not inactive
fail:
msg: "Swarm is not inactive"
when: "'Swarm: inactive' not in di.stdout"

- name: Docker Swarm - Cleanup
hosts: all
become: yes

tags:
- cleanup

roles:
- role: docker_remove_all
tags:
- docker_remove_all

- role: redhat_unsubscribe
when: ansible_distribution == 'RedHat'
tags:
- redhat_unsubscribe
4 changes: 0 additions & 4 deletions tests/fake-test/vars.yml

This file was deleted.

0 comments on commit e8bb4c3

Please sign in to comment.