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: Run tests as sub-tests #242

Merged
merged 3 commits into from
Feb 3, 2021
Merged

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Jan 28, 2021

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Currently, the tests e2e are being from a single TestSuite which
iterates through the test definitions calling their respective
functions.

However, if one of these definitions were to fail, the error is reported
towards the upper TestSuite test.

This uses testify's Suite object ability to run sub-tests (similar to
what testing.T provides) and instead uses that.

This way, any errors coming from a sub-test will be reported for that
sub-test and it'll be easier to debug.

Does this PR have test?

N/A

Special notes for your reviewer:

One thing to note is that given our usage of testify's Suite, we
aren't able to do parallel testing in our e2e tests. In order to enable
this, we'd need to move away from the Suite object or use a different
framework.

See stretchr/testify#187

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 28, 2021
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 28, 2021
@codecov-io
Copy link

codecov-io commented Jan 28, 2021

Codecov Report

Merging #242 (3d41bb7) into master (6de296f) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #242   +/-   ##
=======================================
  Coverage   30.25%   30.25%           
=======================================
  Files           5        5           
  Lines         476      476           
=======================================
  Hits          144      144           
  Misses        315      315           
  Partials       17       17           
Flag Coverage Δ
unittests 30.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


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 6de296f...3d41bb7. Read the comment docs.

@JAORMX JAORMX force-pushed the sub-tests branch 3 times, most recently from cd64c5b to 6bb856f Compare January 28, 2021 08:09
@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 Jan 28, 2021
@JAORMX
Copy link
Contributor Author

JAORMX commented Jan 28, 2021

/retest

1 similar comment
@JAORMX
Copy link
Contributor Author

JAORMX commented Jan 28, 2021

/retest

Comment on lines +74 to +75
// We're unable to use parallel tests because of our usage of testify/suite.
// See https://github.com/stretchr/testify/issues/187
//
// nolint:paralleltest
Copy link
Member

Choose a reason for hiding this comment

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

Ah… 🙁

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we would want parallel tests anyway, since these are integration tests making changes to a live system, if they were run in parallel they might interfere with each other.

@naveensrinivasan
Copy link
Contributor

@JAORMX: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-security-profiles-operator-test-e2e 4255c25 link /test pull-security-profiles-operator-test-e2e
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Running into the same error Expected nil, but got: command /usr/local/bin/kubectl -n security-profiles-operator wait --for condition=ready pod -l app=spod did not succeed: error: no matching resources found

@JAORMX JAORMX force-pushed the sub-tests branch 2 times, most recently from 9ccfeb8 to e593b14 Compare January 29, 2021 14:04
@JAORMX
Copy link
Contributor Author

JAORMX commented Jan 30, 2021

/retest

Copy link
Member

@pjbgf pjbgf left a comment

Choose a reason for hiding this comment

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

Nice one @JAORMX! This will make it easier for contributors to understand the source of errors. 👍

The issue about being unable to run parallel tests we can resolve on another PR. Holding for any extra thoughts from @saschagrunert

/lgtm
/hold

@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 Feb 1, 2021
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 1, 2021
@pjbgf
Copy link
Member

pjbgf commented Feb 1, 2021

Assuming the issue on the E2E tests was resolved by #252

/test pull-security-profiles-operator-test-e2e

@saschagrunert
Copy link
Member

Looks like the test failure is not transient:
/retest

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 2, 2021
@JAORMX JAORMX force-pushed the sub-tests branch 2 times, most recently from 57f1af7 to d5cdb72 Compare February 3, 2021 08:20
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 3, 2021
@JAORMX
Copy link
Contributor Author

JAORMX commented Feb 3, 2021

I removed the per-section "Run" statements, and limited this PR to only the actual sub-tests. Let's see if this works better in CI.

@saschagrunert
Copy link
Member

/retest

Currently, the tests e2e are being from a single `TestSuite` which
iterates through the test definitions calling their respective
functions.

However, if one of these definitions were to fail, the error is reported
towards the upper `TestSuite` test.

This uses testify's `Suite` object ability to run sub-tests (similar to
what `testing.T` provides) and instead uses that.

This way, any errors coming from a sub-test will be reported for that
sub-test and it'll be easier to debug.

One thing to note is that given our usage of testify's `Suite`, we
aren't able to do parallel testing in our e2e tests. In order to enable
this, we'd need to move away from the `Suite` object or use a different
framework.

Signed-off-by: Juan Antonio Osorio Robles <[email protected]>
@JAORMX
Copy link
Contributor Author

JAORMX commented Feb 3, 2021

/test pull-security-profiles-operator-test-e2e

We don't support parallelization there yet anyway.

Signed-off-by: Juan Antonio Osorio Robles <[email protected]>
It was not working in the namespace tests.

Signed-off-by: Juan Antonio Osorio Robles <[email protected]>
Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JAORMX, pjbgf, saschagrunert

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:
  • OWNERS [pjbgf,saschagrunert]

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

@saschagrunert
Copy link
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 3, 2021
@k8s-ci-robot k8s-ci-robot merged commit 5680077 into kubernetes-sigs:master Feb 3, 2021
@JAORMX JAORMX deleted the sub-tests branch February 3, 2021 12:51
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/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. release-note-none Denotes a PR that doesn't merit a release note. 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.

7 participants