Skip to content

[Slice] Test E2E quick rebuild. #593

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

Open
wants to merge 1 commit into
base: slice-main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion slice/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ E2E_K8S_FULL_VERSION ?= $(filter $(E2E_K8S_VERSION).%,$(E2E_K8S_VERSIONS))
E2E_K8S_FULL_VERSION := $(or $(E2E_K8S_FULL_VERSION),$(E2E_K8S_VERSION).0)
E2E_KIND_VERSION ?= kindest/node:v$(E2E_K8S_FULL_VERSION)
E2E_RUN_ONLY_ENV ?= false
E2E_RUN_ONLY_SLICE ?= false

.PHONY: all
all: build
Expand Down Expand Up @@ -122,7 +123,7 @@ run-test-e2e-%:
E2E_KIND_VERSION="kindest/node:v$(K8S_VERSION)" KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) CREATE_KIND_CLUSTER=$(CREATE_KIND_CLUSTER) \
EXTERNAL_CRDS_DIR=$(EXTERNAL_CRDS_DIR) ARTIFACTS="$(ARTIFACTS)/$@" IMAGE_TAG=$(IMAGE_TAG) GINKGO_ARGS="$(GINKGO_ARGS)" \
KUEUE_IMAGE=$(KUEUE_IMAGE) JOBSET_IMAGE=$(JOBSET_IMAGE) \
TEST_LOG_LEVEL=$(TEST_LOG_LEVEL) E2E_RUN_ONLY_ENV=$(E2E_RUN_ONLY_ENV) \
TEST_LOG_LEVEL=$(TEST_LOG_LEVEL) E2E_RUN_ONLY_ENV=$(E2E_RUN_ONLY_ENV) E2E_RUN_ONLY_SLICE=$(E2E_RUN_ONLY_SLICE) \
./hack/e2e-test.sh

.PHONY: cleanup-test-e2e
Expand Down
4 changes: 4 additions & 0 deletions slice/hack/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ function cluster_slice_deploy {
local build_output
build_output=$($KUSTOMIZE build "${ROOT_DIR}/config/dev")
build_output="${build_output//$DEFAULT_SLICE_NAMESPACE/$SLICE_NAMESPACE}"
# Add rollout-timestamp annotation to the Deployment's pod template
local timestamp
timestamp=$(date +%s) # Unix timestamp for uniqueness
build_output=$(yq eval "select(.kind == \"Deployment\").spec.template.metadata.annotations += {\"kubectl.kubernetes.io/timestamp\": \"$timestamp\"}" - <<< "$build_output")
echo "$build_output" | kubectl apply --kubeconfig="$1" --server-side -f -

(cd "${ROOT_DIR}/config/manager" && $KUSTOMIZE edit set image controller="$initial_image")
Expand Down
37 changes: 25 additions & 12 deletions slice/hack/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,34 @@ function startup {
fi
}

trap cleanup EXIT
startup
prepare_docker_images
if [[ "${E2E_RUN_ONLY_SLICE}" != 'true' ]]; then
trap cleanup EXIT
startup
prepare_docker_images
fi

kind_load "$KIND_CLUSTER_NAME" ""

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

cluster_slice_deploy ""

if [ "$E2E_RUN_ONLY_ENV" == 'true' ]; then
read -rp "Press Enter to cleanup."
else
# shellcheck disable=SC2086
$GINKGO $GINKGO_ARGS --junit-report=junit.xml --json-report=e2e.json --output-dir="$ARTIFACTS" -v ./test/e2e/...
if [ "$E2E_RUN_ONLY_ENV" = "true" ]; then
if [[ "${E2E_RUN_ONLY_SLICE}" != 'true' ]]; then
read -rp "Do you want to cleanup? [Y/n] " reply
if [[ "$reply" =~ ^[nN]$ ]]; then
trap - EXIT
echo "Skipping cleanup for kind cluster."
echo -e "\nKind cluster cleanup:\n kind delete cluster --name $KIND_CLUSTER_NAME"
fi
fi
exit 0
fi

# shellcheck disable=SC2086
$GINKGO $GINKGO_ARGS --junit-report=junit.xml --json-report=e2e.json --output-dir="$ARTIFACTS" -v ./test/e2e/...
Loading