summaryrefslogtreecommitdiffstats
path: root/test/integration/openshift_health_checker/preflight
diff options
context:
space:
mode:
authorLuke Meyer <lmeyer@redhat.com>2017-03-30 13:08:34 -0400
committerLuke Meyer <lmeyer@redhat.com>2017-04-25 12:16:20 -0400
commit75f0c57654429d3b861d792169a9c1bdf9156bf8 (patch)
tree5d3e40be9e7f05d2855d8f7bd8bcaf21938e6bee /test/integration/openshift_health_checker/preflight
parent634a8957e1cc29374a170aaa8c2113b8fbbfe7e4 (diff)
downloadopenshift-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/preflight')
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/package_availability_missing_required.yml20
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/package_availability_succeeds.yml20
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/package_update_dep_missing.yml24
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_broken.yml31
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_disabled.yml21
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_unreachable.yml27
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/package_version_matches.yml24
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/package_version_mismatches.yml24
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/package_version_multiple.yml26
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/package_version_origin.yml20
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/preflight_fail_all.yml11
l---------test/integration/openshift_health_checker/preflight/playbooks/roles1
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/setup_container.yml23
-rw-r--r--test/integration/openshift_health_checker/preflight/playbooks/tasks/enable_repo.yml9
-rw-r--r--test/integration/openshift_health_checker/preflight/preflight_test.go101
15 files changed, 338 insertions, 44 deletions
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/package_availability_missing_required.yml b/test/integration/openshift_health_checker/preflight/playbooks/package_availability_missing_required.yml
new file mode 100644
index 000000000..31d0d521e
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_availability_missing_required.yml
@@ -0,0 +1,20 @@
+---
+- include: ../../setup_container.yml
+ vars:
+ image: preflight-aos-package-checks
+ l_host_vars:
+ deployment_type: openshift-enterprise
+
+- name: Fail as required packages cannot be installed
+ hosts: all
+ roles:
+ - openshift_health_checker
+ tasks:
+ - block:
+
+ - action: openshift_health_check
+ args:
+ checks: [ 'package_availability' ]
+
+ always: # destroy the container whether check passed or not
+ - include: ../../teardown_container.yml
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/package_availability_succeeds.yml b/test/integration/openshift_health_checker/preflight/playbooks/package_availability_succeeds.yml
new file mode 100644
index 000000000..16ff41673
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_availability_succeeds.yml
@@ -0,0 +1,20 @@
+---
+- include: ../../setup_container.yml
+ vars:
+ image: preflight-aos-package-checks
+ l_host_vars:
+ deployment_type: origin
+
+- name: Succeeds as Origin packages are public
+ hosts: all
+ roles:
+ - openshift_health_checker
+ tasks:
+ - block:
+
+ - action: openshift_health_check
+ args:
+ checks: [ 'package_availability' ]
+
+ always: # destroy the container whether check passed or not
+ - include: ../../teardown_container.yml
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/package_update_dep_missing.yml b/test/integration/openshift_health_checker/preflight/playbooks/package_update_dep_missing.yml
new file mode 100644
index 000000000..7b6e71f91
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_update_dep_missing.yml
@@ -0,0 +1,24 @@
+---
+- include: ../../setup_container.yml
+ vars:
+ image: preflight-aos-package-checks
+ l_host_vars:
+ openshift_deployment_type: openshift-enterprise
+ openshift_release: 3.2
+
+- name: Fails when a dependency required for update is missing
+ hosts: all
+ roles:
+ - openshift_health_checker
+ tasks:
+ - block:
+
+ - include: tasks/enable_repo.yml
+ vars: { repo_name: "break-yum" }
+
+ - action: openshift_health_check
+ args:
+ checks: [ 'package_update' ]
+
+ always: # destroy the container whether check passed or not
+ - include: ../../teardown_container.yml
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_broken.yml b/test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_broken.yml
new file mode 100644
index 000000000..c2e9c3866
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_broken.yml
@@ -0,0 +1,31 @@
+---
+- include: ../../setup_container.yml
+ vars:
+ image: preflight-aos-package-checks
+ l_host_vars:
+ openshift_deployment_type: openshift-enterprise
+ openshift_release: 3.2
+
+- name: Fails when a repo definition is completely broken
+ hosts: all
+ roles:
+ - openshift_health_checker
+ tasks:
+ - block:
+
+ - include: tasks/enable_repo.yml
+ vars: { repo_name: "break-yum" }
+
+ - name: Break the break-yum repo
+ replace:
+ dest: /etc/yum.repos.d/break-yum.repo
+ backup: no
+ regexp: "^baseurl"
+ replace: "#baseurl"
+
+ - action: openshift_health_check
+ args:
+ checks: [ 'package_update' ]
+
+ always: # destroy the container whether check passed or not
+ - include: ../../teardown_container.yml
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_disabled.yml b/test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_disabled.yml
new file mode 100644
index 000000000..98d41aad4
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_disabled.yml
@@ -0,0 +1,21 @@
+---
+- include: ../../setup_container.yml
+ vars:
+ image: preflight-aos-package-checks
+ l_host_vars:
+ openshift_deployment_type: openshift-enterprise
+ openshift_release: 3.2
+
+- name: Succeeds when nothing blocks a yum update
+ hosts: all
+ roles:
+ - openshift_health_checker
+ tasks:
+ - block:
+
+ - action: openshift_health_check
+ args:
+ checks: [ 'package_update' ]
+
+ always: # destroy the container whether check passed or not
+ - include: ../../teardown_container.yml
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_unreachable.yml b/test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_unreachable.yml
new file mode 100644
index 000000000..60ab9942a
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_update_repo_unreachable.yml
@@ -0,0 +1,27 @@
+---
+- include: ../../setup_container.yml
+ vars:
+ image: preflight-aos-package-checks
+ l_host_vars:
+ openshift_deployment_type: openshift-enterprise
+ openshift_release: 3.2
+
+- name: Fails when repo content is not available
+ hosts: all
+ roles:
+ - openshift_health_checker
+ tasks:
+ - block:
+
+ - include: tasks/enable_repo.yml
+ vars: { repo_name: "break-yum" }
+
+ - name: Remove the local repo entirely
+ file: path=/mnt/localrepo state=absent
+
+ - action: openshift_health_check
+ args:
+ checks: [ 'package_update' ]
+
+ always: # destroy the container whether check passed or not
+ - include: ../../teardown_container.yml
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/package_version_matches.yml b/test/integration/openshift_health_checker/preflight/playbooks/package_version_matches.yml
new file mode 100644
index 000000000..cd60dee5a
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_version_matches.yml
@@ -0,0 +1,24 @@
+---
+- include: ../../setup_container.yml
+ vars:
+ image: preflight-aos-package-checks
+ l_host_vars:
+ deployment_type: openshift-enterprise
+ openshift_release: 3.2
+
+- name: Success when AOS version matches openshift_release
+ hosts: all
+ roles:
+ - openshift_health_checker
+ tasks:
+ - block:
+
+ - include: tasks/enable_repo.yml
+ vars: { repo_name: "ose-3.2" }
+
+ - action: openshift_health_check
+ args:
+ checks: [ 'package_version' ]
+
+ always: # destroy the container whether check passed or not
+ - include: ../../teardown_container.yml
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/package_version_mismatches.yml b/test/integration/openshift_health_checker/preflight/playbooks/package_version_mismatches.yml
new file mode 100644
index 000000000..5939a1ef1
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_version_mismatches.yml
@@ -0,0 +1,24 @@
+---
+- include: ../../setup_container.yml
+ vars:
+ image: preflight-aos-package-checks
+ l_host_vars:
+ deployment_type: openshift-enterprise
+ openshift_release: 3.3
+
+- name: Failure when AOS version doesn't match openshift_release
+ hosts: all
+ roles:
+ - openshift_health_checker
+ tasks:
+ - block:
+
+ - include: tasks/enable_repo.yml
+ vars: { repo_name: "ose-3.2" }
+
+ - action: openshift_health_check
+ args:
+ checks: [ 'package_version' ]
+
+ always: # destroy the container whether check passed or not
+ - include: ../../teardown_container.yml
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/package_version_multiple.yml b/test/integration/openshift_health_checker/preflight/playbooks/package_version_multiple.yml
new file mode 100644
index 000000000..be0f9bc7a
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_version_multiple.yml
@@ -0,0 +1,26 @@
+---
+- include: ../../setup_container.yml
+ vars:
+ image: preflight-aos-package-checks
+ l_host_vars:
+ openshift_deployment_type: openshift-enterprise
+
+- name: Fails when multiple AOS versions are available
+ hosts: all
+ roles:
+ - openshift_health_checker
+ tasks:
+ - block:
+
+ - include: tasks/enable_repo.yml
+ vars: { repo_name: "ose-3.2" }
+
+ - include: tasks/enable_repo.yml
+ vars: { repo_name: "ose-3.3" }
+
+ - action: openshift_health_check
+ args:
+ checks: [ 'package_version' ]
+
+ always: # destroy the container whether check passed or not
+ - include: ../../teardown_container.yml
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/package_version_origin.yml b/test/integration/openshift_health_checker/preflight/playbooks/package_version_origin.yml
new file mode 100644
index 000000000..da3f6b844
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_version_origin.yml
@@ -0,0 +1,20 @@
+---
+- include: ../../setup_container.yml
+ vars:
+ image: preflight-aos-package-checks
+ l_host_vars:
+ openshift_deployment_type: origin
+
+- name: Succeeds with Origin although multiple versions are available
+ hosts: all
+ roles:
+ - openshift_health_checker
+ tasks:
+ - block:
+
+ - action: openshift_health_check
+ args:
+ checks: [ 'package_version' ]
+
+ always: # destroy the container whether check passed or not
+ - include: ../../teardown_container.yml
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/preflight_fail_all.yml b/test/integration/openshift_health_checker/preflight/playbooks/preflight_fail_all.yml
deleted file mode 100644
index e7790a0d4..000000000
--- a/test/integration/openshift_health_checker/preflight/playbooks/preflight_fail_all.yml
+++ /dev/null
@@ -1,11 +0,0 @@
----
-- include: setup_container.yml
- vars:
- name: preflight_fail_all
-
-- name: Run preflight checks
- include: ../../../../../playbooks/byo/openshift-preflight/check.yml
-
-# - include: tasks/teardown_container.yml
-# vars:
-# name: preflight_fail_all
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/roles b/test/integration/openshift_health_checker/preflight/playbooks/roles
new file mode 120000
index 000000000..6bc1a7aef
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/roles
@@ -0,0 +1 @@
+../../../../../roles \ No newline at end of file
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/setup_container.yml b/test/integration/openshift_health_checker/preflight/playbooks/setup_container.yml
deleted file mode 100644
index fff797c27..000000000
--- a/test/integration/openshift_health_checker/preflight/playbooks/setup_container.yml
+++ /dev/null
@@ -1,23 +0,0 @@
----
-# Required vars:
-# * name = name of the container to be started
-
-- name: Start CentOS 7 container
- gather_facts: no
- hosts: localhost
- connection: local
- vars:
- container_name: openshift_ansible_test_{{ name }}
- tasks:
- - name: start container
- docker_container:
- name: "{{ container_name }}"
- image: centos:7
- command: sleep infinity
- recreate: yes
- - name: add host
- add_host:
- name: "{{ container_name }}"
- ansible_connection: docker
- groups: OSEv3,masters,nodes
- deployment_type: origin
diff --git a/test/integration/openshift_health_checker/preflight/playbooks/tasks/enable_repo.yml b/test/integration/openshift_health_checker/preflight/playbooks/tasks/enable_repo.yml
new file mode 100644
index 000000000..aaacf205e
--- /dev/null
+++ b/test/integration/openshift_health_checker/preflight/playbooks/tasks/enable_repo.yml
@@ -0,0 +1,9 @@
+---
+- name: Enable {{ repo_name }} repo
+ # believe it or not we can't use the yum_repository module for this.
+ # https://github.com/ansible/ansible-modules-extras/issues/2384
+ ini_file:
+ dest: /etc/yum.repos.d/{{ repo_name }}.repo
+ section: "{{ repo_name }}"
+ option: enabled
+ value: 1
diff --git a/test/integration/openshift_health_checker/preflight/preflight_test.go b/test/integration/openshift_health_checker/preflight/preflight_test.go
index a1b98bf0f..05ddf139f 100644
--- a/test/integration/openshift_health_checker/preflight/preflight_test.go
+++ b/test/integration/openshift_health_checker/preflight/preflight_test.go
@@ -6,19 +6,100 @@ import (
. ".."
)
-func TestPreflightFailAll(t *testing.T) {
+func TestPackageUpdateDepMissing(t *testing.T) {
PlaybookTest{
- Path: "playbooks/preflight_fail_all.yml",
+ Path: "playbooks/package_update_dep_missing.yml",
ExitCode: 2,
Output: []string{
- "Failure summary",
- "Cannot install all of the necessary packages",
- "origin-clients",
- "origin-master",
- "origin-node",
- "origin-sdn-ovs",
- "python-httplib2",
- "failed=1",
+ "check \"package_update\":",
+ "Could not perform a yum update.",
+ "break-yum-update-1.0-2.noarch requires package-that-does-not-exist",
+ },
+ }.Run(t)
+}
+
+func TestPackageUpdateRepoBroken(t *testing.T) {
+ PlaybookTest{
+ Path: "playbooks/package_update_repo_broken.yml",
+ ExitCode: 2,
+ Output: []string{
+ "check \"package_update\":",
+ "Error with yum repository configuration: Cannot find a valid baseurl for repo",
+ },
+ }.Run(t)
+}
+
+func TestPackageUpdateRepoDisabled(t *testing.T) {
+ PlaybookTest{
+ Path: "playbooks/package_update_repo_disabled.yml",
+ ExitCode: 0,
+ Output: []string{
+ "CHECK [package_update",
+ },
+ }.Run(t)
+}
+
+func TestPackageUpdateRepoUnreachable(t *testing.T) {
+ PlaybookTest{
+ Path: "playbooks/package_update_repo_unreachable.yml",
+ ExitCode: 2,
+ Output: []string{
+ "check \"package_update\":",
+ "Error getting data from at least one yum repository",
+ },
+ }.Run(t)
+}
+
+func TestPackageVersionMatches(t *testing.T) {
+ PlaybookTest{
+ Path: "playbooks/package_version_matches.yml",
+ ExitCode: 0,
+ Output: []string{
+ "CHECK [package_version",
+ },
+ }.Run(t)
+}
+
+func TestPackageVersionMismatches(t *testing.T) {
+ PlaybookTest{
+ Path: "playbooks/package_version_mismatches.yml",
+ ExitCode: 2,
+ Output: []string{
+ "check \"package_version\":",
+ "Not all of the required packages are available at requested version",
+ },
+ }.Run(t)
+}
+
+func TestPackageVersionMultiple(t *testing.T) {
+ PlaybookTest{
+ Path: "playbooks/package_version_multiple.yml",
+ ExitCode: 2,
+ Output: []string{
+ "check \"package_version\":",
+ "Multiple minor versions of these packages are available",
+ },
+ }.Run(t)
+}
+
+func TestPackageAvailabilityMissingRequired(t *testing.T) {
+ PlaybookTest{
+ Path: "playbooks/package_availability_missing_required.yml",
+ ExitCode: 2,
+ Output: []string{
+ "check \"package_availability\":",
+ "Cannot install all of the necessary packages.",
+ "atomic-openshift",
+ },
+ }.Run(t)
+}
+
+func TestPackageAvailabilitySucceeds(t *testing.T) {
+ PlaybookTest{
+ Path: "playbooks/package_availability_succeeds.yml",
+ ExitCode: 0,
+ Output: []string{
+ "CHECK [package_availability",
},
}.Run(t)
}