Skip to content

Commit 17b8930

Browse files
committed
[Slice] Test E2E quick rebuild.
1 parent 1d34113 commit 17b8930

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

slice/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ E2E_K8S_FULL_VERSION ?= $(filter $(E2E_K8S_VERSION).%,$(E2E_K8S_VERSIONS))
6464
E2E_K8S_FULL_VERSION := $(or $(E2E_K8S_FULL_VERSION),$(E2E_K8S_VERSION).0)
6565
E2E_KIND_VERSION ?= kindest/node:v$(E2E_K8S_FULL_VERSION)
6666
E2E_RUN_ONLY_ENV ?= false
67+
E2E_RUN_ONLY_SLICE ?= false
6768

6869
.PHONY: all
6970
all: build
@@ -122,7 +123,7 @@ run-test-e2e-%:
122123
E2E_KIND_VERSION="kindest/node:v$(K8S_VERSION)" KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) CREATE_KIND_CLUSTER=$(CREATE_KIND_CLUSTER) \
123124
EXTERNAL_CRDS_DIR=$(EXTERNAL_CRDS_DIR) ARTIFACTS="$(ARTIFACTS)/$@" IMAGE_TAG=$(IMAGE_TAG) GINKGO_ARGS="$(GINKGO_ARGS)" \
124125
KUEUE_IMAGE=$(KUEUE_IMAGE) JOBSET_IMAGE=$(JOBSET_IMAGE) \
125-
TEST_LOG_LEVEL=$(TEST_LOG_LEVEL) E2E_RUN_ONLY_ENV=$(E2E_RUN_ONLY_ENV) \
126+
TEST_LOG_LEVEL=$(TEST_LOG_LEVEL) E2E_RUN_ONLY_ENV=$(E2E_RUN_ONLY_ENV) E2E_RUN_ONLY_SLICE=$(E2E_RUN_ONLY_SLICE) \
126127
./hack/e2e-test.sh
127128

128129
.PHONY: cleanup-test-e2e

slice/hack/e2e-common.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ function cluster_slice_deploy {
111111
local build_output
112112
build_output=$($KUSTOMIZE build "${ROOT_DIR}/config/dev")
113113
build_output="${build_output//$DEFAULT_SLICE_NAMESPACE/$SLICE_NAMESPACE}"
114+
# Add rollout-timestamp annotation to the Deployment's pod template
115+
local timestamp
116+
timestamp=$(date +%s) # Unix timestamp for uniqueness
117+
build_output=$(yq eval "select(.kind == \"Deployment\").spec.template.metadata.annotations += {\"kubectl.kubernetes.io/timestamp\": \"$timestamp\"}" - <<< "$build_output")
114118
echo "$build_output" | kubectl apply --kubeconfig="$1" --server-side -f -
115119

116120
(cd "${ROOT_DIR}/config/manager" && $KUSTOMIZE edit set image controller="$initial_image")

slice/hack/e2e-test.sh

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,34 @@ function startup {
4444
fi
4545
}
4646

47-
trap cleanup EXIT
48-
startup
49-
prepare_docker_images
47+
if [[ "${E2E_RUN_ONLY_SLICE}" != 'true' ]]; then
48+
trap cleanup EXIT
49+
startup
50+
prepare_docker_images
51+
fi
52+
5053
kind_load "$KIND_CLUSTER_NAME" ""
5154

52-
# We need to wait for Kueue to become available;
53-
# otherwise, we encounter the error: "no endpoints available for service 'kueue-webhook-service'"
54-
echo "Waiting for Kueue to become available..."
55-
kubectl wait deploy/kueue-controller-manager -nkueue-system --for=condition=available --timeout=5m
55+
if [[ "${E2E_RUN_ONLY_SLICE}" != 'true' ]]; then
56+
# We need to wait for Kueue to become available;
57+
# otherwise, we encounter the error: "no endpoints available for service 'kueue-webhook-service'"
58+
echo "Waiting for Kueue to become available..."
59+
kubectl wait deploy/kueue-controller-manager -nkueue-system --for=condition=available --timeout=5m
60+
fi
5661

5762
cluster_slice_deploy ""
5863

59-
if [ "$E2E_RUN_ONLY_ENV" == 'true' ]; then
60-
read -rp "Press Enter to cleanup."
61-
else
62-
# shellcheck disable=SC2086
63-
$GINKGO $GINKGO_ARGS --junit-report=junit.xml --json-report=e2e.json --output-dir="$ARTIFACTS" -v ./test/e2e/...
64+
if [ "$E2E_RUN_ONLY_ENV" = "true" ]; then
65+
if [[ "${E2E_RUN_ONLY_SLICE}" != 'true' ]]; then
66+
read -rp "Do you want to cleanup? [Y/n] " reply
67+
if [[ "$reply" =~ ^[nN]$ ]]; then
68+
trap - EXIT
69+
echo "Skipping cleanup for kind cluster."
70+
echo -e "\nKind cluster cleanup:\n kind delete cluster --name $KIND_CLUSTER_NAME"
71+
fi
72+
fi
73+
exit 0
6474
fi
75+
76+
# shellcheck disable=SC2086
77+
$GINKGO $GINKGO_ARGS --junit-report=junit.xml --json-report=e2e.json --output-dir="$ARTIFACTS" -v ./test/e2e/...

0 commit comments

Comments
 (0)