Skip to content

Commit

Permalink
Rearrange test files in test folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreya Anil Naik committed Nov 10, 2021
1 parent 28822f6 commit afac494
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/run-tests.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ source "$DIR"/lib/cluster.sh
source "$DIR"/lib/integration.sh
source "$DIR"/lib/performance_tests.sh


# Variables used in /lib/aws.sh
OS=$(go env GOOS)
ARCH=$(go env GOARCH)
Expand Down Expand Up @@ -62,7 +63,7 @@ TEST_CONFIG_DIR="$TEST_DIR/config"
# test cluster config location
# Pass in CLUSTER_ID to reuse a test cluster
: "${CLUSTER_ID:=$RANDOM}"
CLUSTER_NAME=cni-test-$CLUSTER_ID
export CLUSTER_NAME=cni-test-$CLUSTER_ID
TEST_CLUSTER_DIR=${TEST_BASE_DIR}/cluster-$CLUSTER_NAME
CLUSTER_MANAGE_LOG_PATH=$TEST_CLUSTER_DIR/cluster-manage.log
: "${CLUSTER_CONFIG:=${TEST_CLUSTER_DIR}/${CLUSTER_NAME}.yaml}"
Expand Down Expand Up @@ -211,7 +212,7 @@ ADDONS_CNI_IMAGE=$($KUBECTL_PATH describe daemonset aws-node -n kube-system | gr

echo "*******************************************************************************"
echo "Running integration tests on default CNI version, $ADDONS_CNI_IMAGE"
sh "$DIR"/run-new-integration-tests.sh
sh "$DIR"/test/run-new-integration-tests.sh


echo "*******************************************************************************"
Expand Down Expand Up @@ -249,7 +250,7 @@ fi

echo "*******************************************************************************"
echo "Running integration tests on current image:"
sh "$DIR"/run-new-integration-tests.sh
sh "$DIR"/test/run-new-integration-tests.sh

if [[ $TEST_PASS -eq 0 && "$RUN_CONFORMANCE" == true ]]; then
echo "Running conformance tests against cluster."
Expand Down
39 changes: 39 additions & 0 deletions scripts/test/run-new-integration-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

set -e
OS_OVERRIDE=$(go env GOOS)
DIR=$(pwd)

pushd "$DIR/test/integration-new"

echo "Running integration test with the following configuration:
KUBE CONFIG: $KUBECONFIG
CLUSTER_NAME: $CLUSTER_NAME
AWS_REGION: $AWS_REGION
OS_OVERRIDE: $OS_OVERRIDE"

if [[ -z "${OS_OVERRIDE}" ]]; then
OS_OVERRIDE=linux
fi

CLUSTER_INFO=$(aws eks describe-cluster --name $CLUSTER_NAME --region $AWS_REGION)

VPC_ID=$(echo $CLUSTER_INFO | jq -r '.cluster.resourcesVpcConfig.vpcId')
SERVICE_ROLE_ARN=$(echo $CLUSTER_INFO | jq -r '.cluster.roleArn')
ROLE_NAME=${SERVICE_ROLE_ARN##*/}

dirs=( $( ls -d */) )

START=$SECONDS

for dir in "${dirs[@]}"; do
cd "$dir"
ginkgo -v -r -- --cluster-kubeconfig=$KUBECONFIG --cluster-name=$CLUSTER_NAME --aws-region=$AWS_REGION --aws-vpc-id=$VPC_ID
cd ..
done

DEFAULT_INTEGRATION_DURATION=$((SECONDS - START))
echo "TIMELINE: Integration tests took $DEFAULT_INTEGRATION_DURATION seconds."


popd

0 comments on commit afac494

Please sign in to comment.