diff --git a/.travis.yml b/.travis.yml index c458303a..7face288 100644 --- a/.travis.yml +++ b/.travis.yml @@ -119,6 +119,8 @@ jobs: - echo "Running Test Scripts" - ./travis/test_docker_image_version "$OS_BUILD_VERSION_TAG" - ./travis/regression_test_script -i "$OS_SNAPSHOT_IMAGE_TAG" -l "$TESTS_LOG_BASE" -V "$HYRAX_WEB_UI_VERSION" + - $TRAVIS_BUILD_DIR/travis/test_hyrax_service_version "http://localhost:8080/opendap" "$HYRAX_WEB_UI_VERSION" + - stage: BUILD name: "Build opendap/besd" @@ -141,8 +143,8 @@ jobs: - docker image ls -a - cd "$TRAVIS_BUILD_DIR" - echo "Running Test Scripts" - - ./travis/test_docker_image_version "$OS_BUILD_VERSION_TAG" - ./travis/test_image_starts_without_crashing.sh "$OS_BUILD_VERSION_TAG" + - ./travis/test_docker_image_version "$OS_BUILD_VERSION_TAG" - stage: BUILD name: "Build opendap/hyrax_ncwms" @@ -233,6 +235,7 @@ jobs: - cd "$TRAVIS_BUILD_DIR" - echo "Running Hyrax Regression Test Script on $OS_BUILD_VERSION_TAG" >&2 - $TRAVIS_BUILD_DIR/travis/regression_test_script -V "$HYRAX_WEB_UI_VERSION" -i "$OS_BUILD_VERSION_TAG" -l "deployed-image-regression-tests-$TRAVIS_JOB_NUMBER" + - $TRAVIS_BUILD_DIR/travis/test_hyrax_service_version "http://localhost:8080/opendap" "$HYRAX_WEB_UI_VERSION" - export DEPLOY_ME="false" after_success: diff --git a/travis/regression_test_script b/travis/regression_test_script index 02728fbf..dc3ba073 100755 --- a/travis/regression_test_script +++ b/travis/regression_test_script @@ -10,6 +10,13 @@ set -e # -i "$OS_BUILD_VERSION_TAG" \ # -l "deployed-image-regression-tests-$TRAVIS_JOB_NUMBER" # +# This script starts the target docker image and then runs the +# hyrax_regression_tests on the new server. +# +# !! NOTE !! +# As written this script leaves the tested hyrax docker container +# running so that downstream service tests can be easily run. +# HR0="#######################################################################" HR1="- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" HR2="--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---" @@ -255,163 +262,6 @@ function clean_and_start() { loggy "$HR0" } -######################################################################################################### -# check_version() -# Verify that we have the expected server version -function check_version() { - local prolog="check_version() -" - loggy "$HR0" - loggy "$prolog BEGIN" - - local d_id="$1" - if test -z "$d_id"; then - loggy "$prolog ERROR! You must pass valid docker id as parameter 1" - return 1 - fi - - local end_point_url="$2" - if test -z "$end_point_url"; then - loggy "$prolog ERROR! You must pass a Hyrax endpoint url string as parameter 2" - return 2 - fi - - local expected_hyrax_version="$3" - if test -z "$expected_hyrax_version"; then - loggy "$prolog ERROR! You must pass a Hyrax endpoint url string as parameter 3" - return 3 - fi - - local docker_version_label - local docker_version_status - local status - local version_url - local version_response - local hyrax_version_value - local version_url="$end_point_url/hyrax/version" - local contents_url="$end_point_url/hyrax/contents.html" - local ifh_url="$end_point_url/hyrax/data/nc/fnoc1.nc.dmr.html" - - ##################################################### - # Get Hyrax version response from the running server - loggy "$prolog Retrieving Hyrax Version Response from: '$version_url'" - version_response="$(curl -s -c cookies -b cookies -n "$NETRC_FILE" -L "$version_url")" - loggy "$prolog Hyrax Version Response:" - loggy "$version_response" - loggy "$HR1" - - ############################################################ - # Verify Hyrax Version Injection - # Get this line from the version response: - # - # and then use awk to get the actual value of ########## - hyrax_version_value="$(echo "$version_response" | grep "&2 } -function test_hyrax_version_response(){ - local prolog="test_hyrax_version_response() -" +############################################################################# +# test_response_content() +# This function dereferences $test_url and then uses grep to search the +# response document for the $expected_string. If the $expected_string is +# found in the response then the test is a success. If the $expected_string +# is not found in response then the test fails. +function test_response_content(){ + local prolog="test_response_content() -" loggy "$HR1" loggy "$prolog BEGIN" - local end_point_url="$1" - loggy "$prolog end_point_url: $end_point_url" + local test_url="$1" + if test -z "$test_url"; then + loggy "$prolog ERROR! You must pass a test url string as parameter 1" + return 1 + fi - local expected_version_str="$2" - loggy "$prolog expected_version_str: $expected_version_str" + local expected_string="$2" + if test -z "$expected_string"; then + loggy "$prolog ERROR! You must pass an expected string as parameter 2" + return 2 + fi + local status + local some_page - local version_url="$end_point_url/hyrax/version" - loggy "$prolog version_url: $end_point_url" - - ##################################################### - # Get Hyrax version response from the running server - loggy "$prolog Retrieving Hyrax Version Response from: '$version_url'" - version_response="$(curl -s -c cookies -b cookies -n $NETRC_FILE -L "$version_url")" - loggy "$prolog Hyrax Version Response:" - loggy "$version_response" - loggy "$HR1" + ##################################################################### + # Retrieve the response foe test_url and check for the presence of + # expected_string within. + loggy "$prolog Checking '$test_url' for correct the expected string: '$expected_string'" + some_page="$(curl -s -c cookies -b cookies -n "$NETRC_FILE" -L "$test_url")" - ############################################################ - # Verify Hyrax Version Injection - # Get this line from the version response: - # - # and then use awk to get the actual value of ########## - local hyrax_version_value - hyrax_version_value="$(echo "$version_response" | grep "