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

Support skip-tests option to skip some specific tests in alpha or beta features #184

Merged
merged 3 commits into from
Sep 29, 2020

Conversation

nak3
Copy link
Contributor

@nak3 nak3 commented Sep 23, 2020

Currently Alpha or Beta conformance tests must be implemented when we enabled the flag.
This patch allows users to skip one or some specific tests in alpha or beta features.

Fixes #183

@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 23, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Sep 23, 2020
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 23, 2020
@codecov
Copy link

codecov bot commented Sep 23, 2020

Codecov Report

Merging #184 into master will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #184      +/-   ##
==========================================
+ Coverage   94.45%   94.49%   +0.04%     
==========================================
  Files          34       35       +1     
  Lines         685      690       +5     
==========================================
+ Hits          647      652       +5     
  Misses         27       27              
  Partials       11       11              
Impacted Files Coverage Δ
pkg/status/status.go 97.29% <0.00%> (ø)
pkg/testing/status/fake.go 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a71b40c...e21641f. Read the comment docs.

@dprotaso
Copy link
Member

/lgtm

I'll add this requirement to my over-arching conformance improvements issue: knative/pkg#1563

Also go test -run is a bit clunky when skipping tests so I made this issue: golang/go#41583

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 23, 2020
Comment on lines 70 to 71
delete(alphaTests, name)
delete(betaTests, name)
Copy link
Member

Choose a reason for hiding this comment

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

It would be good to create a set of skipped test names and invoke t.Skip() so you get some output that a test was skipped

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is nice idea but t.Skip() calls against "root" test 😢. So It outputs SKIP: TestIngressConformance even though each conformance test outputs PASS like this:

--- SKIP: TestIngressConformance (0.00s)
    --- PASS: TestIngressConformance/headers/tags (8.02s)
        --- PASS: TestIngressConformance/headers/tags/matching_tag_header (1.29s)
        --- PASS: TestIngressConformance/headers/tags/no_tag_header (0.32s)
        --- PASS: TestIngressConformance/headers/tags/empty_tag_header (0.12s)
        --- PASS: TestIngressConformance/headers/tags/non-matching_tag_header (0.11s)

It is strange... So I think we should avoid to call t.Skip in run.go

Copy link
Member

@dprotaso dprotaso Sep 23, 2020

Choose a reason for hiding this comment

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

You could artificially call skip on the subtest - ie.

if test.ServingFlags.EnableAlphaFeatures {
  for name, test := range alphaTests {
   if skipTest(name) {
    t.Run(name, func(t *t.testing.T) { t.Skip() }
    continue
  }
   t.Run(name, test)
  }
}

Would that give the desired output we want?

Copy link

Choose a reason for hiding this comment

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

Every test calls test.Setup(t), doesn't it? How about putting it in there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Updated. The current result shows like this:

=== RUN   TestIngressConformance/host-rewrite
    TestIngressConformance/host-rewrite: run.go:107: Skipping the test in skip-test flag

   ... 

--- PASS: TestIngressConformance (0.00s)
    --- SKIP: TestIngressConformance/host-rewrite (0.00s)
    --- PASS: TestIngressConformance/headers/tags (15.67s)
        --- PASS: TestIngressConformance/headers/tags/matching_tag_header (0.61s)
        --- PASS: TestIngressConformance/headers/tags/no_tag_header (0.11s)
        --- PASS: TestIngressConformance/headers/tags/empty_tag_header (0.10s)
        --- PASS: TestIngressConformance/headers/tags/non-matching_tag_header (0.21s)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@coryrc Thank you. But Setup is a function to setup test client. I feel it is a little bit weird that we put the Skip logic there. Let's go on Dave's suggestion.

@nak3
Copy link
Contributor Author

nak3 commented Sep 23, 2020

/hold

@davetropeano Thank you for the review!
/cc @tcnghia @mattmoor @ZhiminXiang Could you also please take a look? knative-extensions/net-kourier#204 verified it.

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 23, 2020
@nak3 nak3 changed the title WIP - Support skip-tests option to skip some specific tests in alpha or beta features Support skip-tests option to skip some specific tests in alpha or beta features Sep 23, 2020
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 23, 2020
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 24, 2020
@dprotaso
Copy link
Member

/lgtm

leaving for others to review & unhold

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 24, 2020
@dprotaso
Copy link
Member

cc @ZhiminXiang @JRBANCEL @tcnghia

@JRBANCEL
Copy link
Contributor

It seems fine, albeit a bit convoluted and disappointing we can't rely on the standard Go constructs to do this.

@dprotaso
Copy link
Member

dprotaso commented Sep 29, 2020

It seems fine, albeit a bit convoluted and disappointing we can't rely on the standard Go constructs to do this.

I opened an issue - golang/go#41583 - give it some emojis ;)

Copy link
Contributor

@tcnghia tcnghia left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nak3, tcnghia

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

@dprotaso
Copy link
Member

/hold cancel

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 29, 2020
@knative-prow-robot knative-prow-robot merged commit 7ade8f3 into knative:master Sep 29, 2020
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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"--enable-alpha" option must implement all alpha features
7 participants