Skip to content

Commit

Permalink
move e2e test from start dev script + minor fix for run.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
nnmin-aws committed Jan 17, 2023
1 parent b1b89a9 commit ecb172d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ BIN_ARCH_LINUX ?= amd64 arm64
BIN_ARCH_WINDOWS ?= amd64
BIN_ARCH_DARWIN ?= amd64

#CI is defined in test-infra https://github.com/kubernetes/test-infra/blob/2e3dd84399745eb49cef69afc3ed5bded8a6580c/prow/pod-utils/downwardapi/jobspec.go#L89
# and passed in when running on github prow
CI ?= false
RUNNER ?= kops

ALL_LINUX_BIN_TARGETS = $(foreach arch,$(BIN_ARCH_LINUX),$(OUTPUT)/bin/aws-iam-authenticator_$(VERSION)_linux_$(arch))
ALL_WINDOWS_BIN_TARGETS = $(foreach arch,$(BIN_ARCH_WINDOWS),$(OUTPUT)/bin/aws-iam-authenticator_$(VERSION)_windows_$(arch).exe)
ALL_DARWIN_BIN_TARGETS = $(foreach arch,$(BIN_ARCH_DARWIN),$(OUTPUT)/bin/aws-iam-authenticator_$(VERSION)_darwin_$(arch))
Expand Down Expand Up @@ -102,7 +107,7 @@ integration:
.PHONY: e2e
e2e: bin
ifeq ($(RUNNER),kops)
./hack/e2e/run.sh
CI=$(CI) ./hack/e2e/run.sh
else ifeq ($(RUNNER),kind)
./hack/start-dev-env-dynamicfile.sh
./hack/stop-dev-env.sh
Expand Down
5 changes: 5 additions & 0 deletions hack/e2e-dynamicfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ function e2e_dynamicfile(){
fi
}

echo "start end to end testing for mountfile mode"
e2e_mountfile
echo "starting end to end testing for dynamicfile mode"
e2e_dynamicfile




Expand Down
14 changes: 12 additions & 2 deletions hack/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ BASE_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")")
source "${BASE_DIR}"/kops.sh
source "${BASE_DIR}"/aws.sh

KOPS_USERID=$(whoami)
#detect if run on github and set var accordingly
if [ $CI = true ]
then
REPO_NAME=${REPO_NAME:-aws-iam-authenticator-e2e}
KOPS_STATE_BUCKET=${KOPS_STATE_BUCKET:-k8s-kops-auth-e2e}
else
REPO_NAME=${REPO_NAME:-aws-iam-authenticator}
KOPS_STATE_BUCKET=${KOPS_STATE_BUCKET:-k8s-kops-auth-${KOPS_USERID}}
fi

TEST_ID=${TEST_ID:-$RANDOM}
CLUSTER_NAME=test-cluster-${TEST_ID}.k8s.local
CLUSTER_TYPE=kops
Expand All @@ -39,15 +50,14 @@ INSTANCE_TYPE=${INSTANCE_TYPE:-c5.large}

AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
USER_ARN=$(aws sts get-caller-identity --query Arn --output text)
REPO_NAME=${REPO_NAME:-aws-iam-authenticator-e2e}
ECR_URL=${AWS_ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com
IMAGE_NAME=${IMAGE_NAME:-${ECR_URL}/${REPO_NAME}}
IMAGE_TAG=${IMAGE_TAG:-${TEST_ID}}

K8S_VERSION=${K8S_VERSION:-1.22.10}

KOPS_VERSION=${KOPS_VERSION:-1.23.0}
KOPS_STATE_BUCKET=${KOPS_STATE_BUCKET:-k8s-kops-auth-e2e}

KOPS_STATE_FILE=${KOPS_STATE_FILE:-s3://${KOPS_STATE_BUCKET}}
KOPS_PATCH_FILE=${KOPS_PATCH_FILE:-${BASE_DIR}/kops-patch.yaml}

Expand Down
5 changes: 0 additions & 5 deletions hack/start-dev-env-dynamicfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ADMIN_ARN=$(aws sts get-caller-identity --query Arn --output text)
REPO_NAME=${REPO_NAME:-aws-iam-authenticator}

source "${REPO_ROOT}/hack/lib/dev-env.sh"
source "${REPO_ROOT}/hack/e2e-dynamicfile.sh"

make image
LOCAL_IMAGE_TAG=$(docker images | awk '{print $2}' | awk 'NR==2')
Expand All @@ -56,7 +55,3 @@ write_kind_config
create_kind_cluster
certificate_authority_data="$(extract_certificate_authority_data)"
write_kubectl_kubeconfig
echo "start end to end testing for mountfile mode"
e2e_mountfile
echo "starting end to end testing for dynamicfile mode"
e2e_dynamicfile

0 comments on commit ecb172d

Please sign in to comment.