From a87c736edf1c2d6a5a2cea00f82604e4ca0a24e9 Mon Sep 17 00:00:00 2001
From: Luke Meyer <lmeyer@redhat.com>
Date: Wed, 24 May 2017 14:08:24 -0400
Subject: preflight int tests: fix for package_version changes

---
 .../builds/aos-package-checks/Dockerfile                |  2 ++
 .../builds/aos-package-checks/root/root/ose-3.2.spec    | 17 +++++++++++++++--
 .../builds/aos-package-checks/root/root/ose-3.3.spec    | 17 +++++++++++++++--
 .../preflight/playbooks/package_version_matches.yml     |  4 ++++
 .../preflight/playbooks/package_version_multiple.yml    |  4 ++++
 .../preflight/playbooks/tasks/enable_repo.yml           |  2 +-
 .../preflight/preflight_test.go                         |  2 +-
 7 files changed, 42 insertions(+), 6 deletions(-)

(limited to 'test')

diff --git a/test/integration/openshift_health_checker/builds/aos-package-checks/Dockerfile b/test/integration/openshift_health_checker/builds/aos-package-checks/Dockerfile
index 8542029f6..0d8162c2e 100644
--- a/test/integration/openshift_health_checker/builds/aos-package-checks/Dockerfile
+++ b/test/integration/openshift_health_checker/builds/aos-package-checks/Dockerfile
@@ -25,6 +25,8 @@ RUN cd /root/rpmbuild/SOURCES && \
     rpmbuild -bb /root/ose-3.3.spec  && \
     mkdir /mnt/localrepo/ose-3.{2,3} && \
     cp /root/rpmbuild/RPMS/noarch/atomic-openshift*-3.2-1.noarch.rpm /mnt/localrepo/ose-3.2 && \
+    cp /root/rpmbuild/RPMS/noarch/{openvswitch-2.4,docker-1.10}-1.noarch.rpm /mnt/localrepo/ose-3.2 && \
     createrepo /mnt/localrepo/ose-3.2 && \
     cp /root/rpmbuild/RPMS/noarch/atomic-openshift*-3.3-1.noarch.rpm /mnt/localrepo/ose-3.3 && \
+    cp /root/rpmbuild/RPMS/noarch/{openvswitch-2.4,docker-1.10}-1.noarch.rpm /mnt/localrepo/ose-3.3 && \
     createrepo /mnt/localrepo/ose-3.3
diff --git a/test/integration/openshift_health_checker/builds/aos-package-checks/root/root/ose-3.2.spec b/test/integration/openshift_health_checker/builds/aos-package-checks/root/root/ose-3.2.spec
index dbc9f0c8e..3b3eab696 100644
--- a/test/integration/openshift_health_checker/builds/aos-package-checks/root/root/ose-3.2.spec
+++ b/test/integration/openshift_health_checker/builds/aos-package-checks/root/root/ose-3.2.spec
@@ -12,6 +12,12 @@ BuildArch:	noarch
 Summary:        package the critical aos packages
 %package node
 Summary:        package the critical aos packages
+%package -n openvswitch
+Summary:        package the critical aos packages
+Version:	2.4
+%package -n docker
+Summary:        package the critical aos packages
+Version:	1.10
 
 %description
 Package for pretending to provide AOS
@@ -22,6 +28,12 @@ Package for pretending to provide AOS
 %description node
 Package for pretending to provide AOS
 
+%description -n openvswitch
+Package for pretending to provide openvswitch
+
+%description -n docker
+Package for pretending to provide docker
+
 %prep
 %setup -q
 
@@ -37,8 +49,9 @@ mkdir -p $RPM_BUILD_ROOT
 %files
 %files master
 %files node
-%doc
-
+%files -n openvswitch
+%files -n docker
 
+%doc
 
 %changelog
diff --git a/test/integration/openshift_health_checker/builds/aos-package-checks/root/root/ose-3.3.spec b/test/integration/openshift_health_checker/builds/aos-package-checks/root/root/ose-3.3.spec
index 9546e8430..66be0a862 100644
--- a/test/integration/openshift_health_checker/builds/aos-package-checks/root/root/ose-3.3.spec
+++ b/test/integration/openshift_health_checker/builds/aos-package-checks/root/root/ose-3.3.spec
@@ -12,6 +12,12 @@ BuildArch:	noarch
 Summary:        package the critical aos packages
 %package node
 Summary:        package the critical aos packages
+%package -n openvswitch
+Summary:        package the critical aos packages
+Version:	2.4
+%package -n docker
+Summary:        package the critical aos packages
+Version:	1.10
 
 %description
 Package for pretending to provide AOS
@@ -22,6 +28,12 @@ Package for pretending to provide AOS
 %description node
 Package for pretending to provide AOS
 
+%description -n openvswitch
+Package for pretending to provide openvswitch
+
+%description -n docker
+Package for pretending to provide docker
+
 %prep
 %setup -q
 
@@ -37,8 +49,9 @@ mkdir -p $RPM_BUILD_ROOT
 %files
 %files master
 %files node
-%doc
-
+%files -n openvswitch
+%files -n docker
 
+%doc
 
 %changelog
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
index 66d43d809..58bed0fc0 100644
--- a/test/integration/openshift_health_checker/preflight/playbooks/package_version_matches.yml
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_version_matches.yml
@@ -20,6 +20,10 @@
   post_tasks:
     - block:
 
+        # disable extras so we control docker version
+        - include: tasks/enable_repo.yml
+          vars: { repo_file: "CentOS-Base", repo_name: "extras", repo_enabled: 0 }
+
         - action: openshift_health_check
           args:
             checks: [ 'package_version' ]
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
index c941413de..850a55a72 100644
--- a/test/integration/openshift_health_checker/preflight/playbooks/package_version_multiple.yml
+++ b/test/integration/openshift_health_checker/preflight/playbooks/package_version_multiple.yml
@@ -23,6 +23,10 @@
         - include: tasks/enable_repo.yml
           vars: { repo_name: "ose-3.3" }
 
+        # disable extras so we control docker version
+        - include: tasks/enable_repo.yml
+          vars: { repo_file: "CentOS-Base", repo_name: "extras", repo_enabled: 0 }
+
         - action: openshift_health_check
           args:
             checks: [ 'package_version' ]
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
index a41cb3c9a..6022f4289 100644
--- a/test/integration/openshift_health_checker/preflight/playbooks/tasks/enable_repo.yml
+++ b/test/integration/openshift_health_checker/preflight/playbooks/tasks/enable_repo.yml
@@ -3,7 +3,7 @@
   # 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
+    dest: /etc/yum.repos.d/{{ repo_file | default(repo_name) }}.repo
     section: "{{ repo_name }}"
     option: enabled
     value: "{{ repo_enabled | default(1) }}"
diff --git a/test/integration/openshift_health_checker/preflight/preflight_test.go b/test/integration/openshift_health_checker/preflight/preflight_test.go
index 05ddf139f..9dfd713ec 100644
--- a/test/integration/openshift_health_checker/preflight/preflight_test.go
+++ b/test/integration/openshift_health_checker/preflight/preflight_test.go
@@ -66,7 +66,7 @@ func TestPackageVersionMismatches(t *testing.T) {
 		ExitCode: 2,
 		Output: []string{
 			"check \"package_version\":",
-			"Not all of the required packages are available at requested version",
+			"Not all of the required packages are available at their requested version",
 		},
 	}.Run(t)
 }
-- 
cgit v1.2.3