From 634a8957e1cc29374a170aaa8c2113b8fbbfe7e4 Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Fri, 4 Nov 2016 18:30:34 +0100 Subject: Add stub of preflight integration tests --- .../example/example_test.go | 26 ++++++++++++++++++++++ .../example/playbooks/test_fail.yml | 14 ++++++++++++ .../example/playbooks/test_ping.yml | 14 ++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 test/integration/openshift_health_checker/example/example_test.go create mode 100644 test/integration/openshift_health_checker/example/playbooks/test_fail.yml create mode 100644 test/integration/openshift_health_checker/example/playbooks/test_ping.yml (limited to 'test/integration/openshift_health_checker/example') diff --git a/test/integration/openshift_health_checker/example/example_test.go b/test/integration/openshift_health_checker/example/example_test.go new file mode 100644 index 000000000..f59c21291 --- /dev/null +++ b/test/integration/openshift_health_checker/example/example_test.go @@ -0,0 +1,26 @@ +package example + +import ( + "testing" + + . ".." +) + +// TestPing and TestFail below are just examples of tests that involve running +// 'ansible-playbook' with a given playbook and verifying the outcome. Real +// tests look similar, but call more interesting playbooks. + +func TestPing(t *testing.T) { + PlaybookTest{ + Path: "playbooks/test_ping.yml", + Output: []string{"[test ping]"}, + }.Run(t) +} + +func TestFail(t *testing.T) { + PlaybookTest{ + Path: "playbooks/test_fail.yml", + ExitCode: 2, + Output: []string{"[test fail]", `"msg": "Failed as requested from task"`}, + }.Run(t) +} diff --git a/test/integration/openshift_health_checker/example/playbooks/test_fail.yml b/test/integration/openshift_health_checker/example/playbooks/test_fail.yml new file mode 100644 index 000000000..318f1c507 --- /dev/null +++ b/test/integration/openshift_health_checker/example/playbooks/test_fail.yml @@ -0,0 +1,14 @@ +--- +# This is just a placeholder playbook. Our aim is to make it: +# 1. Build one or more Docker images with a certain interesting state; +# 2. Ensure one or more containers (with random names) are running with the +# latest build of the image; +# 3. Run the byo OpenShift installation playbook targeting the container. +- hosts: localhost + gather_facts: no + tasks: + - name: waste some time + pause: + seconds: 1 + - name: test fail + fail: diff --git a/test/integration/openshift_health_checker/example/playbooks/test_ping.yml b/test/integration/openshift_health_checker/example/playbooks/test_ping.yml new file mode 100644 index 000000000..da31b3d85 --- /dev/null +++ b/test/integration/openshift_health_checker/example/playbooks/test_ping.yml @@ -0,0 +1,14 @@ +--- +# This is just a placeholder playbook. Our aim is to make it: +# 1. Build one or more Docker images with a certain interesting state; +# 2. Ensure one or more containers (with random names) are running with the +# latest build of the image; +# 3. Run the byo OpenShift installation playbook targeting the container. +- hosts: localhost + gather_facts: no + tasks: + - name: waste some time + pause: + seconds: 1 + - name: test ping + ping: -- cgit v1.2.3