diff options
Diffstat (limited to 'kud/tests')
-rwxr-xr-x | kud/tests/_functions.sh | 7 | ||||
-rwxr-xr-x | kud/tests/emco.sh | 3 | ||||
-rwxr-xr-x | kud/tests/kubevirt.sh | 3 | ||||
-rwxr-xr-x | kud/tests/negative_tests/test_all_intents.sh | 4 | ||||
-rwxr-xr-x | kud/tests/negative_tests/test_composite_app.sh | 4 | ||||
-rwxr-xr-x | kud/tests/negative_tests/test_controllers.sh | 4 | ||||
-rwxr-xr-x | kud/tests/negative_tests/test_deployment_intent_group.sh | 4 | ||||
-rwxr-xr-x | kud/tests/negative_tests/test_generic_placement_intent.sh | 4 | ||||
-rwxr-xr-x | kud/tests/negative_tests/test_generic_placement_intent_app.sh | 4 | ||||
-rwxr-xr-x | kud/tests/negative_tests/test_multipart.sh | 4 | ||||
-rwxr-xr-x | kud/tests/negative_tests/test_profile.sh | 4 | ||||
-rwxr-xr-x | kud/tests/negative_tests/test_profile_apps.sh | 4 | ||||
-rwxr-xr-x | kud/tests/onap4k8s.sh | 4 | ||||
-rwxr-xr-x | kud/tests/plugin_collection_v2.sh | 4 | ||||
-rwxr-xr-x | kud/tests/plugin_eaa.sh | 4 | ||||
-rwxr-xr-x | kud/tests/plugin_edgex.sh | 4 | ||||
-rwxr-xr-x | kud/tests/plugin_fw.sh | 4 | ||||
-rwxr-xr-x | kud/tests/plugin_fw_v2.sh | 3 |
18 files changed, 22 insertions, 50 deletions
diff --git a/kud/tests/_functions.sh b/kud/tests/_functions.sh index ec415409..367888e5 100755 --- a/kud/tests/_functions.sh +++ b/kud/tests/_functions.sh @@ -29,9 +29,12 @@ function print_msg { echo -e "${RED} $msg ---------------------------------------${NC}" } +function control_plane_ip { + kubectl get endpoints kubernetes -o jsonpath='{.subsets[].addresses[].ip}' +} + function ssh_cluster { - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | awk -F '[:/]' '{print $4}') - ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${master_ip} -- "$@" + ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(control_plane_ip) -- "$@" } function get_ovn_central_address { diff --git a/kud/tests/emco.sh b/kud/tests/emco.sh index 1e003968..109f5638 100755 --- a/kud/tests/emco.sh +++ b/kud/tests/emco.sh @@ -17,8 +17,7 @@ function delete_resource_nox { ! call_api -X GET "$1" >/dev/null } -master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') +master_ip=$(control_plane_ip) rsync_service_port=30441 rsync_service_host="$master_ip" base_url_orchestrator=${base_url_orchestrator:-"http://$master_ip:30415/v2"} diff --git a/kud/tests/kubevirt.sh b/kud/tests/kubevirt.sh index fbcf1bf6..529a67a7 100755 --- a/kud/tests/kubevirt.sh +++ b/kud/tests/kubevirt.sh @@ -39,7 +39,6 @@ if (($try > $tries)); then fi # Test -master_ip=$(kubectl cluster-info | grep "Kubernetes master" | awk -F '[:/]' '{print $4}') deployment_pod=$(kubectl get pods | grep $kubevirt_vmi_name | awk '{print $1}') echo "Pod name: $deployment_pod" echo "ssh testuser@$(kubectl get pods $deployment_pod -o jsonpath="{.status.podIP}")" @@ -50,7 +49,7 @@ interval=60 for ((try=1;try<=$tries;try++)); do echo "try $try/$tries: Wait for $interval seconds to check for ssh access" sleep $interval - if sshpass -p testuser ssh -o ProxyCommand="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -W %h:%p $master_ip" -o StrictHostKeyChecking=no testuser@$(kubectl get pods $deployment_pod -o jsonpath="{.status.podIP}") -- uptime; then + if sshpass -p testuser ssh -o ProxyCommand="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -W %h:%p $(control_plane_ip)" -o StrictHostKeyChecking=no testuser@$(kubectl get pods $deployment_pod -o jsonpath="{.status.podIP}") -- uptime; then echo "ssh access check is success" break fi diff --git a/kud/tests/negative_tests/test_all_intents.sh b/kud/tests/negative_tests/test_all_intents.sh index 1f2f721f..00304906 100755 --- a/kud/tests/negative_tests/test_all_intents.sh +++ b/kud/tests/negative_tests/test_all_intents.sh @@ -26,10 +26,8 @@ source _test_functions.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/negative_tests/test_composite_app.sh b/kud/tests/negative_tests/test_composite_app.sh index 8656a1d8..d020b860 100755 --- a/kud/tests/negative_tests/test_composite_app.sh +++ b/kud/tests/negative_tests/test_composite_app.sh @@ -26,10 +26,8 @@ source _test_functions.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/negative_tests/test_controllers.sh b/kud/tests/negative_tests/test_controllers.sh index 20e6bda0..80e2f34f 100755 --- a/kud/tests/negative_tests/test_controllers.sh +++ b/kud/tests/negative_tests/test_controllers.sh @@ -25,10 +25,8 @@ source _test_functions.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/negative_tests/test_deployment_intent_group.sh b/kud/tests/negative_tests/test_deployment_intent_group.sh index 402a0b1d..18857e42 100755 --- a/kud/tests/negative_tests/test_deployment_intent_group.sh +++ b/kud/tests/negative_tests/test_deployment_intent_group.sh @@ -26,10 +26,8 @@ source _test_functions.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/negative_tests/test_generic_placement_intent.sh b/kud/tests/negative_tests/test_generic_placement_intent.sh index 708180f8..4d8834da 100755 --- a/kud/tests/negative_tests/test_generic_placement_intent.sh +++ b/kud/tests/negative_tests/test_generic_placement_intent.sh @@ -26,10 +26,8 @@ source _test_functions.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/negative_tests/test_generic_placement_intent_app.sh b/kud/tests/negative_tests/test_generic_placement_intent_app.sh index 23e7dd00..f0b7fbb8 100755 --- a/kud/tests/negative_tests/test_generic_placement_intent_app.sh +++ b/kud/tests/negative_tests/test_generic_placement_intent_app.sh @@ -26,10 +26,8 @@ source _test_functions.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/negative_tests/test_multipart.sh b/kud/tests/negative_tests/test_multipart.sh index 7f4a84be..ee15bf27 100755 --- a/kud/tests/negative_tests/test_multipart.sh +++ b/kud/tests/negative_tests/test_multipart.sh @@ -26,10 +26,8 @@ source _test_functions.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/negative_tests/test_profile.sh b/kud/tests/negative_tests/test_profile.sh index c5002d50..44cfee23 100755 --- a/kud/tests/negative_tests/test_profile.sh +++ b/kud/tests/negative_tests/test_profile.sh @@ -26,10 +26,8 @@ source _test_functions.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/negative_tests/test_profile_apps.sh b/kud/tests/negative_tests/test_profile_apps.sh index ca8c6454..6e6adbf8 100755 --- a/kud/tests/negative_tests/test_profile_apps.sh +++ b/kud/tests/negative_tests/test_profile_apps.sh @@ -26,10 +26,8 @@ source _test_functions.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/onap4k8s.sh b/kud/tests/onap4k8s.sh index 702bed46..67aae58f 100755 --- a/kud/tests/onap4k8s.sh +++ b/kud/tests/onap4k8s.sh @@ -13,13 +13,11 @@ set -o pipefail source _functions.sh set +e -master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 declare -i timeout=18 declare -i interval=10 -base_url="http://$master_ip:$onap_svc_node_port/v1" +base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" function check_onap_svc { while ((timeout > 0)); do diff --git a/kud/tests/plugin_collection_v2.sh b/kud/tests/plugin_collection_v2.sh index 84f5ca27..5695dfc7 100755 --- a/kud/tests/plugin_collection_v2.sh +++ b/kud/tests/plugin_collection_v2.sh @@ -25,10 +25,8 @@ source _common.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/plugin_eaa.sh b/kud/tests/plugin_eaa.sh index 5cf44e02..1fedbbf3 100755 --- a/kud/tests/plugin_eaa.sh +++ b/kud/tests/plugin_eaa.sh @@ -19,10 +19,8 @@ source _common.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/plugin_edgex.sh b/kud/tests/plugin_edgex.sh index ae390add..ff27ab27 100755 --- a/kud/tests/plugin_edgex.sh +++ b/kud/tests/plugin_edgex.sh @@ -19,10 +19,8 @@ source _common.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/plugin_fw.sh b/kud/tests/plugin_fw.sh index 4d59006b..0a0f62dc 100755 --- a/kud/tests/plugin_fw.sh +++ b/kud/tests/plugin_fw.sh @@ -23,10 +23,8 @@ source _common.sh if [ ${1:+1} ]; then if [ "$1" == "--external" ]; then - master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') onap_svc_node_port=30498 - base_url="http://$master_ip:$onap_svc_node_port/v1" + base_url="http://$(control_plane_ip):$onap_svc_node_port/v1" fi fi diff --git a/kud/tests/plugin_fw_v2.sh b/kud/tests/plugin_fw_v2.sh index abab9004..86ef97f9 100755 --- a/kud/tests/plugin_fw_v2.sh +++ b/kud/tests/plugin_fw_v2.sh @@ -56,8 +56,7 @@ while [[ $# -gt 0 ]]; do case $arg in "--external" ) - service_host=$(kubectl cluster-info | grep "Kubernetes master" | \ - awk -F ":" '{print $2}' | awk -F "//" '{print $2}') + service_host=$(control_plane_ip) shift ;; * ) |