Skip to content

Commit

Permalink
e2e-k8s.sh: support --ginkgo.label-filter
Browse files Browse the repository at this point in the history
The label filter query is more expressive (logical operations) and readable (no
regexp unless absolutely required). Such a query can be combined with focus +
skip, but in practice a single label filter can replace both of those and is
easier to understand.

Kubernetes has supported ginkgo v2 and thus --label-filter since v1.25.0. This
makes it safe to pass that command line flag unconditionally when invoking the
E2E suite.
  • Loading branch information
pohly committed Jun 12, 2024
1 parent 7cb9e6b commit 165e08b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions hack/ci/e2e-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ set -o errexit -o nounset -o xtrace
# Settings:
# SKIP: ginkgo skip regex
# FOCUS: ginkgo focus regex
# LABEL_FILTER: ginkgo label query for selecting tests (see "Spec Labels" in https://onsi.github.io/ginkgo/#filtering-specs)
#
# The default is to focus on conformance tests. Serial tests get skipped when
# parallel testing is enabled. Using LABEL_FILTER instead of combining SKIP and
# FOCUS is recommended (more expressive, easier to read than regexp).
#
# GA_ONLY: true - limit to GA APIs/features as much as possible
# false - (default) APIs and features left at defaults
# FEATURE_GATES:
Expand Down Expand Up @@ -237,9 +243,13 @@ run_tests() {
printf '%s' "${fixed_coredns}" | kubectl apply -f -
fi

# ginkgo regexes
# ginkgo regexes and label filter
SKIP="${SKIP:-}"
FOCUS="${FOCUS:-"\\[Conformance\\]"}"
FOCUS="${FOCUS:-}"
LABEL_FILTER="${LABEL_FILTER:-}"
if [ -z "${FOCUS}" ] && [ -z "${LABEL_FILTER}" ]; then
FOCUS="\\[Conformance\\]"
fi
# if we set PARALLEL=true, skip serial tests set --ginkgo-parallel
if [ "${PARALLEL:-false}" = "true" ]; then
export GINKGO_PARALLEL=y
Expand All @@ -262,7 +272,7 @@ run_tests() {
# interrupt
./hack/ginkgo-e2e.sh \
'--provider=skeleton' "--num-nodes=${NUM_NODES}" \
"--ginkgo.focus=${FOCUS}" "--ginkgo.skip=${SKIP}" \
"--ginkgo.focus=${FOCUS}" "--ginkgo.skip=${SKIP}" "--ginkgo.label-filter=${LABEL_FILTER}" \
"--report-dir=${ARTIFACTS}" '--disable-log-dump=true' &
GINKGO_PID=$!
wait "$GINKGO_PID"
Expand Down

0 comments on commit 165e08b

Please sign in to comment.