From 59359073e40a85dcdca6a48e9ba11bc5a7c7e17d Mon Sep 17 00:00:00 2001 From: iwilltry42 Date: Tue, 14 Jul 2020 12:52:34 +0200 Subject: [PATCH] adjust e2e tests to new syntax --- tests/common.sh | 8 ++++---- tests/test_basic.sh | 8 ++++---- tests/test_full_lifecycle.sh | 12 ++++++------ tests/test_multi_master.sh | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/common.sh b/tests/common.sh index 42b180f4..2b6c7a51 100755 --- a/tests/common.sh +++ b/tests/common.sh @@ -61,7 +61,7 @@ check_url() { check_clusters() { [ -n "$EXE" ] || abort "EXE is not defined" for c in "$@" ; do - $EXE get kubeconfig "$c" --switch + $EXE kubeconfig merge "$c" --switch if kubectl cluster-info ; then passed "cluster $c is reachable" else @@ -75,7 +75,7 @@ check_clusters() { check_cluster_count() { expectedClusterCount=$1 - actualClusterCount=$($EXE get clusters --no-headers | wc -l) + actualClusterCount=$($EXE cluster list --no-headers | wc -l) if [[ $actualClusterCount != $expectedClusterCount ]]; then failed "incorrect number of clusters available: $actualClusterCount != $expectedClusterCount" return 1 @@ -87,7 +87,7 @@ check_cluster_count() { check_multi_node() { cluster=$1 expectedNodeCount=$2 - $EXE get kubeconfig "$cluster" --switch + $EXE kubeconfig merge "$cluster" --switch nodeCount=$(kubectl get nodes -o=custom-columns=NAME:.metadata.name --no-headers | wc -l) if [[ $nodeCount == $expectedNodeCount ]]; then passed "cluster $cluster has $expectedNodeCount nodes, as expected" @@ -110,5 +110,5 @@ check_volume_exists() { check_cluster_token_exist() { [ -n "$EXE" ] || abort "EXE is not defined" - $EXE get cluster "$1" --token | grep "TOKEN" >/dev/null 2>&1 + $EXE cluster list "$1" --token | grep "TOKEN" >/dev/null 2>&1 } diff --git a/tests/test_basic.sh b/tests/test_basic.sh index d615ed61..02f64f45 100755 --- a/tests/test_basic.sh +++ b/tests/test_basic.sh @@ -7,8 +7,8 @@ CURR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source "$CURR_DIR/common.sh" info "Creating two clusters..." -$EXE create cluster c1 --wait --timeout 60s --api-port 6443 || failed "could not create cluster c1" -$EXE create cluster c2 --wait --timeout 60s || failed "could not create cluster c2" +$EXE cluster create c1 --wait --timeout 60s --api-port 6443 || failed "could not create cluster c1" +$EXE cluster create c2 --wait --timeout 60s || failed "could not create cluster c2" info "Checking that we can get both clusters..." check_cluster_count 2 @@ -21,8 +21,8 @@ check_cluster_token_exist "c1" || failed "could not find cluster token c1" check_cluster_token_exist "c2" || failed "could not find cluster token c2" info "Deleting clusters..." -$EXE delete cluster c1 || failed "could not delete the cluster c1" -$EXE delete cluster c2 || failed "could not delete the cluster c2" +$EXE cluster delete c1 || failed "could not delete the cluster c1" +$EXE cluster delete c2 || failed "could not delete the cluster c2" exit 0 diff --git a/tests/test_full_lifecycle.sh b/tests/test_full_lifecycle.sh index fe0a48c8..7e7c4258 100755 --- a/tests/test_full_lifecycle.sh +++ b/tests/test_full_lifecycle.sh @@ -9,7 +9,7 @@ source "$CURR_DIR/common.sh" clustername="lifecycletest" info "Creating cluster $clustername..." -$EXE create cluster "$clustername" --workers 1 --api-port 6443 --wait --timeout 360s || failed "could not create cluster $clustername" +$EXE cluster create "$clustername" --workers 1 --api-port 6443 --wait --timeout 360s || failed "could not create cluster $clustername" info "Sleeping for 5 seconds to give the cluster enough time to get ready..." sleep 5 @@ -23,14 +23,14 @@ check_multi_node "$clustername" 2 || failed "failed to verify number of nodes" # 2. stop the cluster info "Stopping cluster..." -$EXE stop cluster "$clustername" +$EXE cluster stop "$clustername" info "Checking that cluster was stopped" check_clusters "$clustername" && failed "cluster was not stopped, since we still have access" # 3. start the cluster info "Starting cluster..." -$EXE start cluster "$clustername" --wait --timeout 360s || failed "cluster didn't come back in time" +$EXE cluster start "$clustername" --wait --timeout 360s || failed "cluster didn't come back in time" info "Checking that we have access to the cluster..." check_clusters "$clustername" || failed "error checking cluster" @@ -40,7 +40,7 @@ check_multi_node "$clustername" 2 || failed "failed to verify number of nodes" # 4. adding another worker node info "Adding one worker node..." -$EXE create node "extra-worker" --cluster "$clustername" --role "worker" --wait --timeout 360s || failed "failed to add worker node" +$EXE node create "extra-worker" --cluster "$clustername" --role "worker" --wait --timeout 360s || failed "failed to add worker node" info "Checking that we have 3 nodes available now..." check_multi_node "$clustername" 3 || failed "failed to verify number of nodes" @@ -49,12 +49,12 @@ check_multi_node "$clustername" 3 || failed "failed to verify number of nodes" info "Loading an image into the cluster..." docker pull nginx:latest > /dev/null docker tag nginx:latest nginx:local > /dev/null -$EXE load image nginx:local -c $clustername || failed "could not import image in $clustername" +$EXE image import nginx:local -c $clustername || failed "could not import image in $clustername" # Cleanup info "Deleting cluster $clustername..." -$EXE delete cluster "$clustername" || failed "could not delete the cluster $clustername" +$EXE cluster delete "$clustername" || failed "could not delete the cluster $clustername" exit 0 diff --git a/tests/test_multi_master.sh b/tests/test_multi_master.sh index 8361687b..a8447c37 100755 --- a/tests/test_multi_master.sh +++ b/tests/test_multi_master.sh @@ -7,7 +7,7 @@ CURR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source "$CURR_DIR/common.sh" info "Creating cluster multimaster..." -$EXE create cluster "multimaster" --masters 3 --api-port 6443 --wait --timeout 360s || failed "could not create cluster multimaster" +$EXE cluster create "multimaster" --masters 3 --api-port 6443 --wait --timeout 360s || failed "could not create cluster multimaster" info "Checking that we have access to the cluster..." check_clusters "multimaster" || failed "error checking cluster" @@ -19,7 +19,7 @@ info "Checking that we have 3 master nodes online..." check_multi_node "multimaster" 3 || failed "failed to verify number of nodes" info "Deleting cluster multimaster..." -$EXE delete cluster "multimaster" || failed "could not delete the cluster multimaster" +$EXE cluster delete "multimaster" || failed "could not delete the cluster multimaster" exit 0