Skip to content

Commit c7de3bd

Browse files
committed
Changed out echo server image, small edits
1 parent a407e48 commit c7de3bd

File tree

4 files changed

+73
-69
lines changed

4 files changed

+73
-69
lines changed

hack/e2e-kind-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# this config file contains all config fields with comments
22
kind: Cluster
33
apiVersion: kind.x-k8s.io/v1alpha4
4-
# 1 control plane node and 3 workers
4+
# 1 control plane node and 1 workers
55
nodes:
66
# the control plane node config
77
- role: control-plane
88
# kubernetes version 1.20.7 from kind v0.11.0
99
image: kindest/node:v1.20.7@sha256:e645428988191fc824529fd0bb5c94244c12401cf5f5ea3bd875eb0a787f0fe9
10-
# the three workers
10+
# the worker
1111
- role: worker
1212
# kubernetes version 1.20.7 from kind v0.11.0
1313
image: kindest/node:v1.20.7@sha256:e645428988191fc824529fd0bb5c94244c12401cf5f5ea3bd875eb0a787f0fe9

hack/run-e2e-kind.sh

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@
2727
# See the License for the specific language governing permissions and
2828
# limitations under the License.
2929

30-
export ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/..
30+
export ROOT_DIR="$(dirname "$(dirname "$(readlink -fm "$0")")")"
3131
export LOG_LEVEL=3
32-
export CLEANUP_CLUSTER=${CLEANUP_CLUSTER:-1}
32+
export CLEANUP_CLUSTER=${CLEANUP_CLUSTER:-"true"}
3333
export CLUSTER_CONTEXT="--name test"
3434
# Using older image due to older version of kubernetes cluster"
35-
export IMAGE_NGINX="nginx:1.15.12"
36-
export IMAGE_ECHOSERVER="k8s.gcr.io/echoserver:1.4"
35+
export IMAGE_ECHOSERVER="kicbase/echo-server:1.0"
3736
export KIND_OPT=${KIND_OPT:=" --config ${ROOT_DIR}/hack/e2e-kind-config.yaml"}
3837
export KA_BIN=_output/bin
3938
export WAIT_TIME="20s"
4039
export IMAGE_REPOSITORY_MCAD="${1}"
4140
export IMAGE_TAG_MCAD="${2}"
4241
export MCAD_IMAGE_PULL_POLICY="${3-Always}"
4342
export IMAGE_MCAD="${IMAGE_REPOSITORY_MCAD}:${IMAGE_TAG_MCAD}"
43+
CLUSTER_STARTED="false"
4444

4545
function update_test_host {
4646
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
@@ -54,7 +54,7 @@ function update_test_host {
5454
sudo curl -o /usr/local/bin/kind -L https://github.com/kubernetes-sigs/kind/releases/download/v0.11.0/kind-linux-amd64
5555
sudo chmod +x /usr/local/bin/kind
5656

57-
# Installing helm3
57+
# Installing helm3
5858
curl -fsSL -o ${ROOT_DIR}/get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
5959
chmod 700 ${ROOT_DIR}/get_helm.sh
6060
${ROOT_DIR}/get_helm.sh
@@ -65,19 +65,19 @@ function update_test_host {
6565
function check-prerequisites {
6666
echo "checking prerequisites"
6767
which kind >/dev/null 2>&1
68-
if [[ $? -ne 0 ]]; then
68+
if [ $? -ne 0 ]; then
6969
echo "kind not installed, exiting."
7070
exit 1
7171
else
7272
echo -n "found kind, version: " && kind version
7373
fi
7474

7575
which kubectl >/dev/null 2>&1
76-
if [[ $? -ne 0 ]]; then
76+
if [ $? -ne 0 ]; then
7777
echo "kubectl not installed, exiting."
7878
exit 1
7979
else
80-
echo -n "found kubectl, " && kubectl version --short --client
80+
echo -n "found kubectl, " && kubectl version
8181
fi
8282

8383
if [[ $IMAGE_REPOSITORY_MCAD == "" ]]
@@ -93,7 +93,7 @@ function check-prerequisites {
9393
fi
9494

9595
which helm >/dev/null 2>&1
96-
if [[ $? -ne 0 ]]
96+
if [ $? -ne 0 ]
9797
then
9898
echo "helm not installed, exiting."
9999
exit 1
@@ -106,43 +106,44 @@ function check-prerequisites {
106106
function kind-up-cluster {
107107
echo "Running kind: [kind create cluster ${CLUSTER_CONTEXT} ${KIND_OPT}]"
108108
kind create cluster ${CLUSTER_CONTEXT} ${KIND_OPT} --wait ${WAIT_TIME}
109+
if [ $? -ne 0 ]
110+
then
111+
echo "Failed to start kind cluster"
112+
exit 1
113+
fi
114+
CLUSTER_STARTED="true"
109115

110-
docker images
111116
docker pull ${IMAGE_ECHOSERVER}
112-
docker pull ${IMAGE_NGINX}
113117
if [[ "$MCAD_IMAGE_PULL_POLICY" = "Always" ]]
114118
then
115119
docker pull ${IMAGE_MCAD}
116120
fi
117121
docker images
118-
119-
kind load docker-image ${IMAGE_NGINX} ${CLUSTER_CONTEXT}
120-
if [[ $? -ne 0 ]]
121-
then
122-
echo "Failed to load image ${IMAGE_NGINX} in cluster"
123-
exit 1
124-
fi
125-
122+
126123
kind load docker-image ${IMAGE_ECHOSERVER} ${CLUSTER_CONTEXT}
127-
if [[ $? -ne 0 ]]
124+
if [ $? -ne 0 ]
128125
then
129126
echo "Failed to load image ${IMAGE_ECHOSERVER} in cluster"
130127
exit 1
131128
fi
132129

133130
kind load docker-image ${IMAGE_MCAD} ${CLUSTER_CONTEXT}
134-
if [[ $? -ne 0 ]]
131+
if [ $? -ne 0 ]
135132
then
136133
echo "Failed to load image ${IMAGE_MCAD} in cluster"
137134
exit 1
138-
fi
135+
fi
139136
}
140137

141138
# clean up
142139
function cleanup {
143140
echo "==========================>>>>> Cleaning up... <<<<<=========================="
144141
echo " "
145-
142+
if [[ ${CLUSTER_STARTED} == "false" ]]
143+
then
144+
echo "Cluster was not started, nothing more to do."
145+
return
146+
fi
146147

147148
echo "Custom Resource Definitions..."
148149
echo "kubectl get crds"
@@ -185,8 +186,13 @@ function cleanup {
185186
echo "kubectl logs ${mcad_pod} -n kube-system"
186187
kubectl logs ${mcad_pod} -n kube-system
187188
fi
188-
kind delete cluster ${CLUSTER_CONTEXT}
189189
rm -rf ${ROOT_DIR}/get_helm.sh
190+
if [[ $CLEANUP_CLUSTER == "true" ]]
191+
then
192+
kind delete cluster ${CLUSTER_CONTEXT}
193+
else
194+
echo "Cluster requested to stay up, not deleting cluster"
195+
fi
190196
}
191197

192198
debug_function() {
@@ -231,7 +237,7 @@ spec:
231237
spec:
232238
containers:
233239
- name: hellodiana-2-test-0
234-
image: k8s.gcr.io/echoserver:1.4
240+
image: ${IMAGE_ECHOSERVER}
235241
imagePullPolicy: Always
236242
ports:
237243
- containerPort: 80
@@ -287,8 +293,7 @@ EOF
287293
}
288294

289295
function kube-test-env-up {
290-
cd ${ROOT_DIR}
291-
296+
292297
echo "---"
293298
export KUBECONFIG="$(kind get kubeconfig-path ${CLUSTER_CONTEXT})"
294299

@@ -384,6 +389,4 @@ kind-up-cluster
384389
kube-test-env-up
385390

386391
echo "==========================>>>>> Running E2E tests... <<<<<=========================="
387-
go test ./test/e2e -v -timeout 55m
388-
debug_function
389-
sleep 3600s
392+
go test ./test/e2e -v -timeout 55m

test/e2e/queue.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ var _ = Describe("AppWrapper E2E Test", func() {
155155
aw := createJobAWWithInitContainer(context, "aw-job-3-init-container", 60, "exponential", 0)
156156
appwrappers = append(appwrappers, aw)
157157

158-
err := waitAWPodsCompleted(context, aw, 720 * time.Second) // This test waits for 10 minutes to make sure all PODs complete
158+
err := waitAWPodsCompleted(context, aw, 720*time.Second) // This test waits for 10 minutes to make sure all PODs complete
159159
Expect(err).NotTo(HaveOccurred())
160160
})
161161

@@ -173,7 +173,7 @@ var _ = Describe("AppWrapper E2E Test", func() {
173173
aw := createJobAWWithInitContainer(context, "aw-job-3-init-container", 1, "none", 3)
174174
appwrappers = append(appwrappers, aw)
175175

176-
err := waitAWPodsCompleted(context, aw, 300 * time.Second)
176+
err := waitAWPodsCompleted(context, aw, 300*time.Second)
177177
Expect(err).To(HaveOccurred())
178178
})
179179

@@ -615,7 +615,7 @@ var _ = Describe("AppWrapper E2E Test", func() {
615615
aw := createGenericJobAWWithScheduleSpec(context, "aw-test-job-with-scheduling-spec")
616616
err1 := waitAWPodsReady(context, aw)
617617
Expect(err1).NotTo(HaveOccurred())
618-
err2 := waitAWPodsCompleted(context, aw, 90 * time.Second)
618+
err2 := waitAWPodsCompleted(context, aw, 90*time.Second)
619619
Expect(err2).NotTo(HaveOccurred())
620620

621621
// Once pods are completed, we wait for them to see if they change their status to anything BUT "Completed"
@@ -733,8 +733,8 @@ var _ = Describe("AppWrapper E2E Test", func() {
733733

734734
context := initTestContext()
735735
var aws []*arbv1.AppWrapper
736-
//appwrappersPtr := &aws
737-
//defer cleanupTestObjectsPtr(context, appwrappersPtr)
736+
appwrappersPtr := &aws
737+
defer cleanupTestObjectsPtr(context, appwrappersPtr)
738738

739739
const (
740740
awCount = 100

0 commit comments

Comments
 (0)