Add tests for uninstalling ODL RPM 01/67201/2
authorDaniel Farrell <dfarrell@redhat.com>
Tue, 16 Jan 2018 12:05:26 +0000 (07:05 -0500)
committerDaniel Farrell <dfarrell@redhat.com>
Tue, 16 Jan 2018 12:40:48 +0000 (12:40 +0000)
Fixes: INTPAK-128
Change-Id: I3343325e97b3ee1899b530ab88add796973dc6df
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
jjb/packaging/packaging.yaml
jjb/packaging/uninstall-rpm.sh [new file with mode: 0644]

index b30742effa2a6973c9aa0d14593e6fe71787765d..5012648af14e3bbd8f383377db19c2fd7c8efb47 100644 (file)
@@ -92,6 +92,7 @@
           sudo yum install -y nmap
       - shell: !include-raw: test-karaf.expect
       - shell: !include-raw: stop-odl.sh
+      - shell: !include-raw: uninstall-rpm.sh
       - lf-infra-deploy-maven-file:
           global-settings-file: 'global-settings'
           settings-file: 'packaging-settings'
           sudo yum install -y nmap
       - shell: !include-raw: test-karaf.expect
       - shell: !include-raw: stop-odl.sh
+      - shell: !include-raw: uninstall-rpm.sh
 
     publishers:
       # TODO: Remove the archive publisher
       - shell: !include-raw: start-odl.sh
       - shell: !include-raw: test-karaf.expect
       - shell: !include-raw: stop-odl.sh
+      - shell: !include-raw: uninstall-rpm.sh
 
     publishers:
       - lf-infra-publish
diff --git a/jjb/packaging/uninstall-rpm.sh b/jjb/packaging/uninstall-rpm.sh
new file mode 100644 (file)
index 0000000..1d62ede
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Options:
+#   -x: Echo commands
+#   -e: Fail on errors
+#   -o pipefail: Fail on errors in scripts this calls, give stacktrace
+set -ex -o pipefail
+
+# Uninstall ODL
+sudo yum remove -y opendaylight
+
+# Verify ODL not installed
+if yum list installed opendaylight; then
+  # Fail if exit code 0, ie ODL is still installed
+  echo "OpenDaylight unexpectedly still installed"
+  exit 1
+else
+  echo "OpenDaylight not installed, as expected"
+fi