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

RFC: e2e: enhance WithFeatureGate labels #124350

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Apr 17, 2024

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

We want:

  • To keep test annotations simple: using both WithFeatureGate and WithFeature should only be necessary when a test really has requirements that go beyond "feature gate needs to be enabled" (example: HonorPVReclaimPolicy in add e2e test for HonorPVReclaimPolicy #123151 only needs the feature gate).

  • To run tests which depend only on feature gates being enabled in the ci-kubernetes-e2e-kind-alpha-features resp. ci-kubernetes-e2e-kind-beta-features, because otherwise we may have a proliferation of many bespoke jobs which only run very few tests. This would make testing more expensive for Kubernetes.

  • To enable those tests only once in the ci-kubernetes-e2e-kind-alpha-features and ci-kubernetes-e2e-kind-beta-features definition instead of having to update those each time feature gates change.

Special notes for your reviewer:

This can be achieved by adding Feature:Alpha resp. Feature:Beta as Ginkgo labels instead of just Alpha and Beta. Then jobs which are configured to skip tests with feature dependencies via --label-filter=!/^Feature:.+/ will skip tests which are labeled with just WithFeatureGate. The ci-kubernetes jobs can select to include such tests with a special regexp that mimicks a negative lookahead (see kubernetes/community#7824).

Note that removing WithFeature depends on first updating job definitions to use --label-filter or to skip based on the inline [Alpha] or [Beta] text, otherwise tests that were previously skipped because of WithFeature might start to run in jobs which don't have the feature gate enabled.

Does this PR introduce a user-facing change?

e2e.test and e2e_node.test: tests which depend on alpha or beta feature gates now have `Feature:Alpha` or `Feature:Beta` as Ginkgo labels. The inline text is `[Alpha]` or `[Beta]`, as before.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 17, 2024
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.30 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.30.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Wed Apr 17 13:56:00 UTC 2024.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 17, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Apr 17, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 17, 2024
We want:

- To keep test annotations simple, using both WithFeatureGate
  and WithFeature should only be necessary when a test really
  has requirements that go beyond "feature gate needs to be enabled".

- To run tests which depend only on feature gates being enabled
  in the ci-kubernetes-e2e-kind-alpha-features resp.
  ci-kubernetes-e2e-kind-beta-features, because otherwise we
  may have a proliferation of many bespoke jobs which only run
  very few tests. This would make testing more expensive for
  Kubernetes.

- To enable those tests only once in the ci-kubernetes-e2e-kind-alpha-features
  and ci-kubernetes-e2e-kind-beta-features definition instead
  of having to update those each time feature gates change.

This can be achieved by adding `Feature:Alpha` resp. `Feature:Beta` as Ginkgo
labels instead of just `Alpha` and `Beta`. Then jobs which are configured to
skip tests with feature dependencies via --label-filter=!/Feature:.+/ will skip
tests which are labeled with just WithFeatureGate. The ci-kubernetes jobs
can select to include such tests with a special regexp that mimicks
a negative lookahead (see k8s.io/community/contributors/devel/sig-testing/e2e-tests.md)

Note that removing WithFeature depends on first updating job definitions to use
--label-filter or to skip based on the inline `[Alpha]` or `[Beta]` text,
otherwise tests that were previously skipped because of WithFeature might
start to run in jobs which don't have the feature gate enabled.
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 18, 2024
// [Alpha] resp. [Beta] get added to the test name automatically depending
// on the current stability level of the feature. Feature:Alpha resp.
// Feature:Beta get added to the Ginkgo labels because this is a special
// requirement for how the cluster needs to be configured.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Beta is an edge case here: if the feature gate is on by default, any cluster might work out-of-the-box. I am saying "might" because:

  • the cluster might explicitly turn off beta features
  • the feature might depend on a beta API group - those are not on by default

I think it is safer to assume that "beta" does not mean "available by default" and thus add the Feature:Beta label.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

extra string
// extra is an optional feature name. It gets added as [<extraFeature>]
// to the test name and as Feature:<extraFeature> to the labels.
extraFeature string
Copy link
Member

Choose a reason for hiding this comment

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

you got me puzzled with this, so there is only one change in this PR that is

	if slices.Contains(labels, "Feature:"+tag) {
				// Okay, was also set as label.
				continue
			}

the rest is a rename of this field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only user-visible change is indeed that the Alpha Ginkgo label becomes Feature:Alpha and Beta becomes Feature:Beta.

I'm not aware of anyone currently using the Ginkgo labels, so I think it's fairly safe to do this.

I am not renaming the inline [Alpha] and [Beta] tags. Those have been around for longer, so they might be used?

Copy link
Member

Choose a reason for hiding this comment

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

it was a side comment, this LGTM

@aojea
Copy link
Member

aojea commented Apr 23, 2024

/lgtm

/hold

/assign @BenTheElder

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 23, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 23, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: a4eb4d858d64fa4de9805d769011a67d2b2a76b4

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. area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants