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

Refactor integration tests #5572

Merged
merged 5 commits into from
Sep 30, 2021
Merged

Refactor integration tests #5572

merged 5 commits into from
Sep 30, 2021

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Sep 7, 2021

Description

Refactor integration tests using sigs.k8s.io/e2e-framework to simplify the setup and definition and cleanup of the test cases.

Related Issue(s)

N/A

How to test

cd test && go test -v ./...

or cd test && go test -v ./... -args -namespace <some namespace> to use a different namespace from the current one in the kubeconfig context

Release Notes

Refactor integration tests using [sigs.k8s.io/e2e-framework](https://sigs.k8s.io/e2e-framework)

TODO:

  • flag to filter tests to run
  • timeouts per test?
  • multiple packages
  • add checks before running the tests (check gitpod pods are running)
  • improve cleanup (closer)

@codecov
Copy link

codecov bot commented Sep 7, 2021

Codecov Report

Merging #5572 (a862413) into main (da1919f) will decrease coverage by 0.53%.
The diff coverage is 100.00%.

❗ Current head a862413 differs from pull request most recent head f165e30. Consider uploading reports for the commit f165e30 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5572      +/-   ##
==========================================
- Coverage   38.35%   37.81%   -0.54%     
==========================================
  Files          15       16       +1     
  Lines        3872     4152     +280     
==========================================
+ Hits         1485     1570      +85     
- Misses       2264     2455     +191     
- Partials      123      127       +4     
Flag Coverage Δ
components-local-app-app-linux ?
components-local-app-app-windows ?
components-supervisor-app 37.81% <100.00%> (?)
components-ws-manager-app ?

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

Impacted Files Coverage Δ
components/supervisor/pkg/supervisor/tasks.go 57.43% <100.00%> (ø)
...-manager/pkg/manager/internal/workpool/workpool.go
components/ws-manager/pkg/manager/create.go
components/ws-manager/pkg/manager/manager_ee.go
components/ws-manager/pkg/clock/clock.go
...omponents/ws-manager/pkg/manager/pod_controller.go
components/ws-manager/pkg/manager/monitor.go
...s/ws-manager/pkg/manager/internal/grpcpool/pool.go
components/ws-manager/pkg/manager/metrics.go
components/ws-manager/pkg/manager/status.go
... and 21 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 da1919f...f165e30. Read the comment docs.

@aledbf aledbf force-pushed the aledbf/integration branch 3 times, most recently from 3b25901 to 2c39d87 Compare September 7, 2021 18:30
@aledbf aledbf force-pushed the aledbf/integration branch 3 times, most recently from 90b08c4 to 2361e28 Compare September 7, 2021 23:34
@aledbf
Copy link
Member Author

aledbf commented Sep 8, 2021

/werft run

👍 started the job as gitpod-build-aledbf-integration.45

@aledbf
Copy link
Member Author

aledbf commented Sep 8, 2021

/werft run

👍 started the job as gitpod-build-aledbf-integration.47

@aledbf
Copy link
Member Author

aledbf commented Sep 8, 2021

/werft run

👍 started the job as gitpod-build-aledbf-integration.51

@csweichel
Copy link
Contributor

csweichel commented Sep 9, 2021

  • 👍 I like the way the e2e framework works, that it's just a thin layer on top of testing and doesn't shift to a different paradigm (think BDD with ginko)
  • 👍 The removal of the integration test struct makes sense and makes the setup/teardown more explicit. That was a concept that didn't really work before
  • 👍 Propagating state through context feels close to home
  • 👎 All tests are now robed into the main package which is a bit messy. It'd be great if we could split that up again

Overall I think this approach makes sense. I'm looking forward to see how we can filter for the labels and features once that bit is merged in the e2e testing framework.

@aledbf
Copy link
Member Author

aledbf commented Sep 9, 2021

All tests are now robed into the main package which is a bit messy. It'd be great if we could split that up again

Agree 💯

I'm looking forward to see how we can filter for the labels and features once that bit is merged in the e2e testing framework.

The WIP of such feature is here kubernetes-sigs/e2e-framework#48

@csweichel
Copy link
Contributor

The WIP of such feature is here kubernetes-sigs/e2e-framework#48

Looks like we can already make use of the labels using --labels. I reckon in some future change we can use the changeset to determine the set of tests we need to execute, and filter them based on the labels. Also, we could add something like a smoketest label useful for testing the most basic functionality.

@aledbf aledbf force-pushed the aledbf/integration branch 2 times, most recently from 23b3ee5 to 2531b8c Compare September 16, 2021 14:02
Copy link
Contributor

@rl-gitpod rl-gitpod left a comment

Choose a reason for hiding this comment

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

+1 this is a big improvement. 100% agree with Chris on the pros/cons.

Note that I've made changes to the tests here that will need to be merged once it is approved. More than happy to do that if it helps.

test/pkg/integration/context/context.go Outdated Show resolved Hide resolved
test/pkg/integration/setup.go Outdated Show resolved Hide resolved

type workspaceKey struct{}

func GetComponentAPI(ctx context.Context) *integration.ComponentAPI {
Copy link
Contributor

Choose a reason for hiding this comment

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

/nit

Maybe 'MustGet*' variants to make the calling code a touch more explicit?

},
}

uploadUrlRequest := features.New("UploadUrlRequest").
Copy link
Contributor

Choose a reason for hiding this comment

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

There is some variability in the feature naming throughout this PR and given they can be used to filter tests we should standardise on feature naming, i.e. camelcase (or not), spaces Y/N, should they always start with the package to allow grouping, etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's one the missing definitions

test/tests/components/database/db_test.go Outdated Show resolved Hide resolved
test/tests/components/database/db_test.go Outdated Show resolved Hide resolved
test/tests/components/ws-manager/content_test.go Outdated Show resolved Hide resolved
@aledbf
Copy link
Member Author

aledbf commented Sep 17, 2021

Note that I've made changes to the tests here that will need to be merged once it is approved. More than happy to do that if it helps.

Yes, the idea is to merge any pending PR that changes integration tests before this one.

@aledbf
Copy link
Member Author

aledbf commented Sep 29, 2021

/werft run

👍 started the job as gitpod-build-aledbf-integration.81

@aledbf aledbf force-pushed the aledbf/integration branch 3 times, most recently from 36d1a99 to bd753e5 Compare September 30, 2021 01:18
@aledbf
Copy link
Member Author

aledbf commented Sep 30, 2021

/werft run

👍 started the job as gitpod-build-aledbf-integration.89

@aledbf
Copy link
Member Author

aledbf commented Sep 30, 2021

/hold cancel

@csweichel
Copy link
Contributor

/lgtm

@roboquat
Copy link
Contributor

LGTM label has been added.

Git tree hash: 987aadbdffa8a7560ddc52ca8cd771669c2d853e

@csweichel
Copy link
Contributor

/lgtm
/approve no-issue

@roboquat roboquat added the lgtm label Sep 30, 2021
@roboquat
Copy link
Contributor

LGTM label has been added.

Git tree hash: 987aadbdffa8a7560ddc52ca8cd771669c2d853e

@corneliusludmann
Copy link
Contributor

/approve no-issue

@jankeromnes
Copy link
Contributor

Already green-lit and approved multiple times, and a quick glance revealed no obvious problems. Thanks! Rubber-stamping.

/approve no-issue

@roboquat
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: corneliusludmann, csweichel, jankeromnes

Associated issue requirement bypassed by: corneliusludmann, csweichel, jankeromnes

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

@roboquat roboquat merged commit d862429 into main Sep 30, 2021
@roboquat roboquat deleted the aledbf/integration branch September 30, 2021 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants