From 0f53f9252733e58d450c73ef6bdc37f6eeed9915 Mon Sep 17 00:00:00 2001 From: Daniel Farrell Date: Thu, 9 Aug 2018 01:23:47 -0400 Subject: [PATCH] Fix, refactor RPM upgrade tests * Refactor macros * Get upgrade test passing Jira: INTPAK-14 Change-Id: I364e99cbae46be8cb35256cb79a4b4e54ec49814 Signed-off-by: Daniel Farrell --- jjb/packaging/packaging-macros.yaml | 69 ++++++++++++++++++++++ jjb/packaging/packaging.yaml | 59 ++++++++++-------- jjb/packaging/test-karaf-oxygensafe.expect | 13 ++++ 3 files changed, 117 insertions(+), 24 deletions(-) diff --git a/jjb/packaging/packaging-macros.yaml b/jjb/packaging/packaging-macros.yaml index c573746a01..ae1e2573bb 100644 --- a/jjb/packaging/packaging-macros.yaml +++ b/jjb/packaging/packaging-macros.yaml @@ -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: diff --git a/jjb/packaging/packaging.yaml b/jjb/packaging/packaging.yaml index 8191744d3b..fb6c335cc8 100644 --- a/jjb/packaging/packaging.yaml +++ b/jjb/packaging/packaging.yaml @@ -438,16 +438,6 @@ 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: @@ -460,20 +450,41 @@ 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 diff --git a/jjb/packaging/test-karaf-oxygensafe.expect b/jjb/packaging/test-karaf-oxygensafe.expect index 8b5fbcd67e..efcdf4a2c5 100644 --- a/jjb/packaging/test-karaf-oxygensafe.expect +++ b/jjb/packaging/test-karaf-oxygensafe.expect @@ -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" -- 2.36.6