adjust e2e tests to new syntax

pull/300/head
iwilltry42 4 years ago
parent 594ead1428
commit 59359073e4
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
  1. 8
      tests/common.sh
  2. 8
      tests/test_basic.sh
  3. 12
      tests/test_full_lifecycle.sh
  4. 4
      tests/test_multi_master.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
}

@ -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

@ -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

@ -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

Loading…
Cancel
Save