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

e2e-k8s.sh: support --ginkgo.label-filter #3582

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Apr 16, 2024

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. However, actual labels were only added in Kubernetes 1.29.

Note: I have not tested this yet. If we are confident that it'll work, then we can merge and I'll start using it in a small job (most likely DRA) once it is available.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 16, 2024
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 16, 2024
@pohly
Copy link
Contributor Author

pohly commented Apr 16, 2024

Is my understanding correct that this change will be usable right after merging, i.e. without a formal kind release?

@aojea
Copy link
Contributor

aojea commented Jun 11, 2024

Is my understanding correct that this change will be usable right after merging, i.e. without a formal kind release?

yes

@pohly @onsi this output looks weird, Will run 2144 of 7407 specs but it Ran 875 of 7407 Specs

/home/prow/go/src/k8s.io/kubernetes/_output/bin/ginkgo --nodes=25 --poll-progress-after=60m --poll-progress-interval=5m --source-root=/home/prow/go/src/k8s.io/kubernetes/cluster/.. --timeout=24h --flake-attempts=1 --no-color /home/prow/go/src/k8s.io/kubernetes/_output/bin/e2e.test -- --kubeconfig=/root/.kube/kind-test-config --host=https://127.0.0.1:41971/ --provider=skeleton --gce-project= --gce-zone= --gce-region= --gce-multizone=false --gke-cluster= --kube-master= --cluster-tag= --cloud-config-file= --repo-root=/home/prow/go/src/k8s.io/kubernetes/cluster/.. --node-instance-group= --prefix=e2e --network=e2e --node-tag= --master-tag= --docker-config-file= --dns-domain=cluster.local --prepull-images=false --report-complete-ginkgo --report-complete-junit --provider=skeleton --num-nodes=2 --ginkgo.focus=. '--ginkgo.skip=\[Serial\]|\[Slow\]|\[Disruptive\]|\[Flaky\]|\[Feature:.+\]|PodSecurityPolicy|LoadBalancer|load.balancer|Simple.pod.should.support.exec.through.an.HTTP.proxy|subPath.should.support.existing' --ginkgo.label-filter= --report-dir=/logs/artifacts --disable-log-dump=true
Running Suite: Kubernetes e2e suite - /home/prow/go/src/k8s.io/kubernetes/_output/bin
=====================================================================================
Random Seed: 1713281512 - will randomize all specs
Will run 2144 of 7407 specs
Running in parallel across 25 processes
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
... snipped ...
Ran 875 of 7407 Specs in 924.114 seconds
SUCCESS! -- 875 Passed | 0 Failed | 0 Pending | 6532 Skipped

@onsi
Copy link

onsi commented Jun 11, 2024

@aojea i don’t know if y’all also call Skip() in some specs at runtime. That would explain the discrepancy.

@pohly
Copy link
Contributor Author

pohly commented Jun 12, 2024

We do a lot of runtime skipping. I think that explains it.

FOCUS="${FOCUS:-"\\[Conformance\\]"}"
FOCUS="${FOCUS:-}"
LABEL_FILTER="${LABEL_FILTER:-}"
if [ -z "${SKIP}" ] && [ -z "${FOCUS}" ] && [ -z "${LABEL_FILTER}" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SKIP was not influencing the defaulting of Focus before, to be backwards compatible should not this be ?

Suggested change
if [ -z "${SKIP}" ] && [ -z "${FOCUS}" ] && [ -z "${LABEL_FILTER}" ]; then
if [ -z "${FOCUS}" ] && [ -z "${LABEL_FILTER}" ]; then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think you are right. Changed.

As you were asking about SKIP, I also looked at the surrounding lines a bit more and started to wonder whether we should still use FOCUS and SKIP at all as defaults. We could get the same effect with the new label filter.

I decided against it (again?) because it's better to be conservative and to keep using what we used before. It also minimizes the changes to the script.

But I could also be convinced to be more audacious and clean this up so that FOCUS and SKIP are only set when explicitly requested. That would expedite our transition to using labels. 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would expedite our transition to using labels.

better do baby steps, so we can identify clearly what change do what

@aojea
Copy link
Contributor

aojea commented Jun 12, 2024

one last comment and we are good to go https://github.com/kubernetes-sigs/kind/pull/3582/files#r1635882841

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.
@aojea
Copy link
Contributor

aojea commented Jun 12, 2024

/lgtm
/approve

/cc: @BenTheElder

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 12, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea, pohly

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 12, 2024
@aojea
Copy link
Contributor

aojea commented Jun 12, 2024

we should also think in phasing this:
1.31 start the transition to labels and deprecation focus and skip , warn on test-infra to use filters

1.32 phase out and forbid focus and skip in test-infra with a. linter

@k8s-ci-robot k8s-ci-robot merged commit b6c15be into kubernetes-sigs:main Jun 12, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants