Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print controller logs on e2e test failure #101

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,31 @@ do_test: $(GINKGO)
PATH=${PATH} \
E2ETEST=1 \
KUBECTL=$(KUBECTL) \
$(GINKGO) --fail-fast -v $(GINKGO_FLAGS) singlek8s
$(GINKGO) --fail-fast -v $(GINKGO_FLAGS) singlek8s; \
if [ "$$?" -ne 0 ]; then \
echo "Controller logs for $(CEPH_CLUSTER1_NAMESPACE) namespace:"; \
$(KUBECTL) logs --tail 100 -n $(CEPH_CLUSTER1_NAMESPACE) -l app.kubernetes.io/name=mantle -c mantle; \
echo ""; \
echo "Controller logs for $(CEPH_CLUSTER2_NAMESPACE) namespace:"; \
$(KUBECTL) logs --tail 100 -n $(CEPH_CLUSTER2_NAMESPACE) -l app.kubernetes.io/name=mantle -c mantle; \
# Explicitly fail the test to mark the CI job as failed. \
exit 1; \
fi

.PHONY: do-test-multik8s
do-test-multik8s: $(GINKGO)
export KUBECTL_PRIMARY="$(MINIKUBE) -p $(MINIKUBE_PROFILE_PRIMARY) kubectl -- "; \
export KUBECTL_SECONDARY="$(MINIKUBE) -p $(MINIKUBE_PROFILE_SECONDARY) kubectl -- "; \
env \
PATH=${PATH} \
E2ETEST=1 \
KUBECTL_PRIMARY="$(MINIKUBE) -p $(MINIKUBE_PROFILE_PRIMARY) kubectl -- " \
KUBECTL_SECONDARY="$(MINIKUBE) -p $(MINIKUBE_PROFILE_SECONDARY) kubectl -- " \
$(GINKGO) --fail-fast -v $(GINKGO_FLAGS) $(addprefix multik8s/, $(TEST_MULTIK8S_PACKAGES))
$(GINKGO) --fail-fast -v $(GINKGO_FLAGS) $(addprefix multik8s/, $(TEST_MULTIK8S_PACKAGES)); \
if [ "$$?" -ne 0 ]; then \
echo "Controller logs for $(MINIKUBE_PROFILE_PRIMARY):"; \
$${KUBECTL_PRIMARY} logs --tail 100 -n $(CEPH_CLUSTER1_NAMESPACE) -l app.kubernetes.io/name=mantle -c mantle; \
echo ""; \
echo "Controller logs for $(MINIKUBE_PROFILE_SECONDARY):"; \
$${KUBECTL_SECONDARY} logs --tail 100 -n $(CEPH_CLUSTER1_NAMESPACE) -l app.kubernetes.io/name=mantle -c mantle; \
# Explicitly fail the test to mark the CI job as failed. \
exit 1; \
fi
2 changes: 1 addition & 1 deletion test/e2e/multik8s/testutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func WaitControllerToBeReady() {
}).Should(Succeed())

Eventually(func() error {
return CheckDeploymentReady(PrimaryK8sCluster, CephClusterNamespace, "mantle-controller")
return CheckDeploymentReady(SecondaryK8sCluster, CephClusterNamespace, "mantle-controller")
}).Should(Succeed())
})
}
Expand Down