From 5cb4b61e546b653b248452c025a0a6ec059d6ba2 Mon Sep 17 00:00:00 2001 From: Todd Malsbary Date: Tue, 18 Aug 2020 15:44:34 -0700 Subject: Use external service address and ports in sanity-check-for-v2.sh. This allows it to be used as an automated test. Issue-ID: MULTICLOUD-1181 Signed-off-by: Todd Malsbary Change-Id: Ib8636159291243bbb60f974984f296b67f6e397e --- kud/tests/_functions.sh | 19 ++++++++ kud/tests/sanity-check-for-v2.sh | 94 +++++++++++++++++++++++++--------------- 2 files changed, 77 insertions(+), 36 deletions(-) (limited to 'kud') diff --git a/kud/tests/_functions.sh b/kud/tests/_functions.sh index 8e715ef4..720470eb 100755 --- a/kud/tests/_functions.sh +++ b/kud/tests/_functions.sh @@ -247,6 +247,25 @@ function wait_for_deployment { done } +# wait_for_deployment_status() - Wait until the deployment intent group is the specified status +function wait_for_deployment_status { + #Example usage: + # wait_for_deployment_status {base-url-orchestrator}/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/status Instantiated + if [ "$#" -ne 2 ]; then + echo "Usage: wait_for_deployment_status URL STATUS" + exit 1 + fi + for try in {0..59}; do + sleep 1 + new_phase="$(call_api $1 | jq -r .status)" + echo "$(date +%H:%M:%S) - Filter=[$*] : $new_phase" + if [[ "$new_phase" == "$2" ]]; then + return 0 + fi + done + exit 1 +} + # setup() - Base testing setup shared among functional tests function setup { if ! $(kubectl version &>/dev/null); then diff --git a/kud/tests/sanity-check-for-v2.sh b/kud/tests/sanity-check-for-v2.sh index 994b86b1..80dc2d5c 100755 --- a/kud/tests/sanity-check-for-v2.sh +++ b/kud/tests/sanity-check-for-v2.sh @@ -15,33 +15,36 @@ # limitations under the License. # - set -o errexit set -o nounset set -o pipefail - source _common_test.sh source _functions.sh #source _common.sh +# TODO Workaround for MULTICLOUD-1202 +function delete_resource_nox { + call_api_nox -X DELETE "$1" + ! call_api -X GET "$1" >/dev/null +} -base_url_orchestrator=${base_url_orchestrator:-"http://localhost:9015/v2"} -base_url_clm=${base_url_clm:-"http://localhost:9019/v2"} - +master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ + awk -F ":" '{print $2}' | awk -F "//" '{print $2}') +rsync_service_port=30441 +rsync_service_host="$master_ip" +base_url_orchestrator=${base_url_orchestrator:-"http://$master_ip:30415/v2"} +base_url_clm=${base_url_clm:-"http://$master_ip:30461/v2"} CSAR_DIR="/opt/csar" csar_id="cb009bfe-bbee-11e8-9766-525400435678" - app1_helm_path="$CSAR_DIR/$csar_id/prometheus-operator.tar.gz" app1_profile_path="$CSAR_DIR/$csar_id/prometheus-operator_profile.tar.gz" app2_helm_path="$CSAR_DIR/$csar_id/collectd.tar.gz" app2_profile_path="$CSAR_DIR/$csar_id/collectd_profile.tar.gz" -kubeConfigLocal="/home/otc/.kube/config" - - +kubeconfig_path="$HOME/.kube/config" function populate_CSAR_composite_app_helm { _checks_args "$1" @@ -103,8 +106,8 @@ rsynccontrollerdata="$(cat<