Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Gillson <[email protected]>
  • Loading branch information
TylerGillson committed Jan 20, 2024
1 parent 6fe1bd8 commit 69b57d2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
4 changes: 2 additions & 2 deletions test/env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export PROJECT_UID=<YOUR_PROJECT_ID>
export EDGE_REGISTRATION_TOKEN=<YOUR_REGISTRATION_TOKEN>
export DOMAIN=dev.spectrocloud.com
export PUBLIC_PACK_REPO_UID=<YOUR_PUBLIC_PACK_REPO_UID> # this varies per Palette tenant, identify via Chrome inspector on Tenant Admin -> Pack Registries page
export CLUSTER_NAME=two-node-<YOU_NAME>-$(git -C ../stylus describe --always)
export CLUSTER_NAME=two-node-<YOUR_NAME>-$(git -C ../stylus describe --always)
export CLUSTER_PROFILE_UID= # if left blank, a cluster profile will be created
export CLUSTER_VIP= # choose an unassigned VIP

Expand All @@ -33,4 +33,4 @@ export PROVIDER_K3S_BRANCH=${PROVIDER_K3S_BRANCH:-two-node}
export PE_VERSION="4.1.2"

# two node vars
export TWO_NODE_BACKEND=postgres # one of: [ postgres | sqlite ]
export TWO_NODE_BACKEND=postgres
31 changes: 14 additions & 17 deletions test/test-two-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,11 @@ set -e

# Do not edit anything below

(return 0 2>/dev/null) && sourced=1 || sourced=0

if [[ $sourced == 0 ]]; then
envfile=$(dirname "${0}")/.env
if [ -f "${envfile}" ]; then
source "${envfile}"
else
echo "Please create a .env file in the test directory and populate it with the required variables."
exit 1
fi
fi

# note: host names must start with an alphabetic character as they're DNS names
declare -a vm_array=("tn1-$HOST_SUFFIX" "tn2-$HOST_SUFFIX")
export HOST_1="${vm_array[0]}"
export HOST_2="${vm_array[1]}"


echo ${vm_array[@]}

function create_canvos_args() {
cat <<EOF > .arg
CUSTOM_TAG=twonode
Expand Down Expand Up @@ -326,8 +311,13 @@ function create_cluster() {
-H "Content-Type: application/json" \
-H "ProjectUid: $PROJECT_UID" \
-d @two-node-create.json | jq -r .uid)
rm -f two-node-create.json
echo Cluster $uid created
if [ "$uid" = "null" ]; then
echo "Cluster creation failed. Please check two-node-create.json and retry creation manually to see Hubble's response."
return 1
else
rm -f two-node-create.json
echo Cluster $uid created
fi
}

function destroy_cluster() {
Expand Down Expand Up @@ -466,5 +456,12 @@ if [[ $sourced == 1 ]]; then
grep ^function ${BASH_SOURCE[0]} | grep -v main | awk '{gsub(/function /,""); gsub(/\(\) \{/,""); print;}'
echo
else
envfile=$(dirname "${0}")/.env
if [ -f "${envfile}" ]; then
source "${envfile}"
else
echo "Please create a .env file in the test directory and populate it with the required variables."
exit 1
fi
main
fi

0 comments on commit 69b57d2

Please sign in to comment.