Fix, refactor RPM upgrade tests 60/74960/5
authorDaniel Farrell <dfarrell@redhat.com>
Thu, 9 Aug 2018 05:23:47 +0000 (01:23 -0400)
committerDaniel Farrell <dfarrell@redhat.com>
Thu, 11 Oct 2018 22:35:14 +0000 (00:35 +0200)
* Refactor macros
* Get upgrade test passing

Jira: INTPAK-14
Change-Id: I364e99cbae46be8cb35256cb79a4b4e54ec49814
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
jjb/packaging/packaging-macros.yaml
jjb/packaging/packaging.yaml
jjb/packaging/test-karaf-oxygensafe.expect

index c573746a0167a9bc33602cbde82a0e73dd80431c..ae1e2573bb509ca6015c8adadf2ca731a9104da9 100644 (file)
@@ -1,5 +1,74 @@
 # Integration/Packaging macros
 ---
+- builder:
+    name: install-rpm
+    builders:
+      - shell: !include-raw: install-rpm.sh
+
+- builder:
+    name: install-repo-cfg-rpm
+    builders:
+      - shell: |
+          # shellcheck disable=SC2154
+          repo_file="${REPO_CFG_FILE_URL##*/}"
+          sudo curl -s -o /etc/yum.repos.d/"$repo_file" "$REPO_CFG_FILE_URL"
+
+- builder:
+    name: start-odl
+    builders:
+      - shell: !include-raw: start-odl.sh
+
+- builder:
+    name: test-odl
+    builders:
+      - shell: |
+          # Install expect to interact with Karaf shell
+          # Install nmap to check status of ODL's SSH port
+          sudo yum install -y expect nmap
+      - shell: !include-raw: test-ports-nofeature.sh
+      - shell: !include-raw: test-karaf-oxygensafe.expect
+      # Disable this test until ODLPARENT-139 is fixed
+      # - shell: !include-raw: test-rest-ok.sh
+
+- builder:
+    name: stop-odl
+    builders:
+      - shell: !include-raw: stop-odl.sh
+
+- builder:
+    name: uninstall-rpm
+    builders:
+      - shell: !include-raw: uninstall-rpm.sh
+
+- builder:
+    name: upgrade-odl
+    builders:
+      - shell: |
+          sudo yum upgrade -y opendaylight
+
+- builder:
+    name: install-start-test-stop-rpm
+    builders:
+      - install-rpm
+      - start-odl
+      - test-odl
+      - stop-odl
+
+- builder:
+    name: install-start-test-stop-uninstall-rpm
+    builders:
+      - install-start-test-stop-rpm
+      - uninstall-rpm
+
+- builder:
+    name: installrepcfg-upgrade-start-test-stop-rpm
+    builders:
+      - install-repo-cfg-rpm
+      - upgrade-odl
+      - start-odl
+      - test-odl
+      - stop-odl
+
 - builder:
     name: install-test-uninstall-rpm
     builders:
index 8191744d3ba6a900eba3cea21e1f55c080a99f49..fb6c335cc879a7ccdc45e8207054984c77197ddd 100644 (file)
           branch: '{branch}'
           refspec: 'refs/heads/{branch}'
           artifacts: '{archive-artifacts}'
-      - string:
-          name: URL
-          # yamllint disable-line rule:line-length
-          default: 'https://raw.githubusercontent.com/opendaylight/integration-packaging/master/packages/rpm/example_repo_configs/opendaylight-8-release.repo'
-          description: 'Link to .repo or .rpm file'
-      - string:
-          name: UPGRADE_URL
-          # yamllint disable-line rule:line-length
-          default: 'https://raw.githubusercontent.com/opendaylight/integration-packaging/master/packages/rpm/example_repo_configs/opendaylight-8-devel.repo'
-          description: 'Link to .repo or .rpm file'
 
     scm:
       - integration-gerrit-scm:
           build-timeout: '{build-timeout}'
 
     builders:
-      - shell: !include-raw-escape: install-rpm.sh
-      - shell: !include-raw: start-odl.sh
-      - shell: |
-          # Install expect to interact with Karaf shell
-          sudo yum install -y expect
-          # Install nmap to check status of ODL's SSH port
-          sudo yum install -y nmap
-      - shell: !include-raw: test-karaf-oxygensafe.expect
-      - shell: !include-raw: stop-odl.sh
-      - shell: !include-raw: test-rpm-upgrade.sh
-      - shell: !include-raw: start-odl.sh
-      - shell: !include-raw: test-karaf-oxygensafe.expect
-      - shell: !include-raw: stop-odl.sh
-      - shell: !include-raw: uninstall-rpm.sh
+      # Tests (current and future):
+      #   * Install latest release, stop/uninstall, install latest CD
+      #   * Upgrade from latest release latest CD
+      #   * TODO: Upgrade from latest release to proposed packaging/** logic
+      #   * TODO: Upgrade from CD to proposed packaging/** logic
+      #   * TODO: Upgrade from proposed packaging/** logic (older ODL) to
+      #     proposed packaging logic (latest ODL)
+
+      # Test 1: Install latest release, stop/uninstall, install latest CD
+      - inject:
+          # yamllint disable-line rule:line-length
+          properties-content: 'URL=https://raw.githubusercontent.com/opendaylight/integration-packaging/master/packages/rpm/example_repo_configs/opendaylight-90-release.repo'
+      - install-start-test-stop-uninstall-rpm
+      - inject:
+          # yamllint disable-line rule:line-length
+          properties-content: 'URL=https://raw.githubusercontent.com/opendaylight/integration-packaging/master/packages/rpm/example_repo_configs/opendaylight-9-devel.repo'
+      - install-start-test-stop-uninstall-rpm
+
+      # Test 2: Install latest release, stop, upgrade to latest CD
+      - inject:
+          # yamllint disable-line rule:line-length
+          properties-content: 'URL=https://raw.githubusercontent.com/opendaylight/integration-packaging/master/packages/rpm/example_repo_configs/opendaylight-90-release.repo'
+      - install-start-test-stop-rpm
+      - inject:
+          # yamllint disable-line rule:line-length
+          properties-content: 'REPO_CFG_FILE_URL=https://raw.githubusercontent.com/opendaylight/integration-packaging/master/packages/rpm/example_repo_configs/opendaylight-9-devel.repo'
+      - installrepcfg-upgrade-start-test-stop-rpm
+
+    triggers:
+      - gerrit-trigger-patch-submitted:
+          gerrit-server-name: '{gerrit-server-name}'
+          project: '{project}'
+          branch: '{branch}'
+          files: 'packages/**'
+          forbidden-files: ''
 
     publishers:
       - lf-infra-publish
index 8b5fbcd67e1651992b74c6aa27f6e9c39e2caebe..efcdf4a2c58919d9d7b7e0e651d3769487205891 100644 (file)
@@ -18,6 +18,7 @@ send_user "Waiting on OpenDaylight to start listening for SSH on port 8101\n"
 exec bash -c "while ! nmap -Pn -p8101 localhost | grep -q open; do sleep 0.1; done"
 
 # SSH into Karaf shell
+send_user "SSH into ODL Karaf shell\n"
 spawn ssh -p 8101 -o StrictHostKeyChecking=no karaf@127.0.0.1
 
 # Auth to Karaf shell
@@ -26,8 +27,18 @@ expect "Password: "
 send "$password\r"
 
 # Show features to make debugging easier
+# Check for "No features available" error message
 expect "$prompt"
 send "feature:list\r"
+expect {{
+  timeout {{
+    send_user "\nFeatures seem to be available\n"
+  }}
+  "No features available" {{
+    send_user "\nNo features available, error\n"
+    exit 1
+  }}
+}}
 
 # Verify that a major feature is present
 expect "$prompt"
@@ -66,3 +77,5 @@ expect {{
 #     send_user "\nTest feature installed successfully\n"
 #   }}
 # }}
+
+send_user "End of Karaf shell tests\n"