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

Fix HTTPRoute validation tests. #970

Merged

Conversation

jpeach
Copy link
Contributor

@jpeach jpeach commented Dec 21, 2021

What type of PR is this?

/kind bug
/kind cleanup

What this PR does / why we need it:

The HTTPRoute validation tests were directly calling internal API
functions to try to pinpoint the set of tests that they expected to
be run. This is a risky pattern, because there's nothing that ensures
that the internal functions are actually wired up to the validation
logic correctly.

This change establishes a new pattern, where each test can set up fixtures
in theor own way (for the sake of brevity), but the test is always driven
by the top-level validation call. This exposed a number of bugs where
the validation functions were not wired up correctly.

In the future, this can be improved by updating the tests to supply
specific expecations on the returned errors rather than just the error
count.

Which issue(s) this PR fixes:

N/A

Does this PR introduce a user-facing change?:

NONE

The HTTPRoute validation tests were directly calling internal API
functions to try to pinpoint the set of tests that they expected to
be run. This is a risky pattern, because there's nothing that ensures
that the internal functions are actually wired up to the validation
logic correctly.

This change establishes a new pattern, where each test can set up fixtures
in theor own way (for the sake of brevity), but the test is always driven
by the top-level validation call. This exposed a number of bugs where
the validation functions were not wired up correctly.

In the future, this can be improved by updating the tests to supply
specific expecations on the returned errors rather than just the error
count.

Signed-off-by: James Peach <[email protected]>
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 21, 2021
@jpeach jpeach requested a review from hbagdi December 21, 2021 00:05
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jpeach

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 Dec 21, 2021
@robscott
Copy link
Member

Thanks @jpeach! These are some great improvements.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 21, 2021
@k8s-ci-robot k8s-ci-robot merged commit 103153b into kubernetes-sigs:master Dec 21, 2021
@jpeach jpeach deleted the fix-http-route-validation branch December 21, 2021 23:34
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. kind/bug Categorizes issue or PR as related to a bug. 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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants