Skip to content

Commit

Permalink
test/e2e: retry minikube start at most three times
Browse files Browse the repository at this point in the history
Signed-off-by: Ryotaro Banno <ryotaro.banno@gmail.com>
  • Loading branch information
ushitora-anqou committed Jan 16, 2025
1 parent 2d9eda4 commit ca4e8c6
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,8 @@ $(HELM): | $(BINDIR)
| tar xvz -C $(BINDIR) --strip-components 1 linux-amd64/helm

.PHONY: launch-minikube
launch-minikube: MINIKUBE_PROFILE=
launch-minikube:
# TODO: Is there any better way to verify whether k8s cluster is available or not?
if $(MINIKUBE) profile $(MINIKUBE_PROFILE) |& grep "not found" > /dev/null; then \
$(MINIKUBE) start \
--kubernetes-version="v$(KUBERNETES_VERSION)" \
--driver=kvm2 \
--memory 6g \
--cpus=2 \
--extra-config=kubeadm.node-name=$(NODE_NAME) \
--extra-config=kubelet.hostname-override=$(NODE_NAME) \
--network mantle-test \
-p $(MINIKUBE_PROFILE) ; \
fi
$(MAKE) do-minikube-start
$(MINIKUBE) profile $(MINIKUBE_PROFILE)
$(MAKE) image-build
$(MAKE) create-loop-dev
Expand All @@ -140,6 +128,35 @@ launch-minikube:
> testdata/persistentvolumes.yaml
$(KUBECTL) apply -f testdata/persistentvolumes.yaml

.PHONY: do-minikube-start
do-minikube-start:
# TODO: Is there any better way to verify whether k8s cluster is available or not?
if $(MINIKUBE) profile $(MINIKUBE_PROFILE) |& grep "not found" > /dev/null; then \
ok=0; \
for i in $(shell seq 1 3) ; do \
if [ "$$ok" -eq 0 ]; then \
if [ "$$i" -ne 1 ]; then \
$(MINIKUBE) delete -p $(MINIKUBE_PROFILE) || true; \
fi; \
$(MINIKUBE) start \
--kubernetes-version="v$(KUBERNETES_VERSION)" \
--driver=kvm2 \
--memory 6g \
--cpus=2 \
--extra-config=kubeadm.node-name=$(NODE_NAME) \
--extra-config=kubelet.hostname-override=$(NODE_NAME) \
--network mantle-test \
-p $(MINIKUBE_PROFILE) ; \
if [ "$$?" -eq 0 ]; then \
ok=1; \
fi; \
fi; \
done; \
if [ $$ok -eq 0 ]; then \
exit 1; \
fi \
fi

.PHONY: create-loop-dev
create-loop-dev:
$(MINIKUBE) ssh -- $(DD) if=/dev/zero of=$(LOOP_FILE) bs=1G seek=32 count=0
Expand Down

0 comments on commit ca4e8c6

Please # to comment.