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: parrallel tests #689

Merged
merged 11 commits into from
Jun 14, 2024
Merged

refactor: parrallel tests #689

merged 11 commits into from
Jun 14, 2024

Conversation

KevFan
Copy link
Contributor

@KevFan KevFan commented Jun 5, 2024

Description

Run integration tests concurrently where possible. Tests that cannot / may affect the stablility of other tests are kept running serially.

Independant test suites are run serially, but each test suites runs their tests in parallel where possible

The following changes were introduced generally:

  • Refactored Bare k8s tests and Gateway API k8s to run tests concurrently
  • Controller integration tests were moved to their own packages under tests/common/x from controllers, each now having their own test suites
    • There were multiple reason for this:
      • Allows controller test suite to define their own BeforeSuite/AfterSuite (e.g. some require a Kuadrant installation, others do not)
      • As we only support singular kuadrant instance installed, it was better to seperate them out to their own suites as each suite is run serially
      • There was a cyclic import issue with common test suite code setup if instead we separated the controllers into their packages instead (e.g. controllers/ratelimit). This is doable if we can live with duplicate test suite code
  • Opted to not wait Kuadrant installation to have a Ready in the CR
    • This further reduces the time needed to run tests (about a minute or 2)
    • As a consequence, some tests code now need to be wrapped in an Eventually block
  • Sorted the order of policies by their accpeted status also for TargetStatusController
    • Some tests were occasionally flaky as the order of the policies can potentially be different with each test run

Tests now complete ~6.5 - 8 mins (previously took ~26 mins)

image

Verification

Passing workflow should be sufficient.

But if you want to try out running the integration tests:

  • make local-env-setup test-integration

@KevFan KevFan force-pushed the parrallel-tests-2 branch 8 times, most recently from 31176e7 to 88e5329 Compare June 11, 2024 18:29
@KevFan KevFan self-assigned this Jun 12, 2024
@KevFan KevFan added kind/enhancement New feature or request size/medium area/tests Changes to tests only labels Jun 12, 2024
@KevFan KevFan marked this pull request as ready for review June 12, 2024 08:30
@KevFan KevFan requested a review from a team as a code owner June 12, 2024 08:30
@KevFan KevFan changed the title [wip] refactor: parrallel tests refactor: parrallel tests Jun 12, 2024
@eguzki
Copy link
Contributor

eguzki commented Jun 12, 2024

great job 🏅

other than few comments about small issues, this LGTM.

@eguzki
Copy link
Contributor

eguzki commented Jun 12, 2024

all integration tests working locally as verification step

p1Status := meta.IsStatusConditionTrue(a[i].GetStatus().GetConditions(), string(gatewayapiv1alpha2.PolicyConditionAccepted))
p2Status := meta.IsStatusConditionTrue(a[j].GetStatus().GetConditions(), string(gatewayapiv1alpha2.PolicyConditionAccepted))
if p1Status != p2Status {
return p1Status
Copy link
Contributor

Choose a reason for hiding this comment

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

nice! I would also do the same.

tests/gatewayapi/suite_test.go Show resolved Hide resolved
tests/common/ratelimit/suite_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@eguzki eguzki left a comment

Choose a reason for hiding this comment

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

LGTM

…one + timeouts

Since Kuadrant/dns-operator#156 was merged, dnsrecords with finizalers are left behind as ManagedZone was deleted causing the test namespaces to never be fully deleted.

Additionally use SpecContext and add timeouts for context so problematic tests terminate earlier
@KevFan KevFan merged commit a76e4dc into Kuadrant:main Jun 14, 2024
18 checks passed
dlaw4608 pushed a commit to dlaw4608/kuadrant-operator that referenced this pull request Jun 17, 2024
* make: concurrent tests flags

* refactor: concurrent bare k8s tests

* refactor: concurrent gateway api k8s tests

* refactor: concurrent istio tests

* refactor: test packages for base concurrent integration tests

* refactor: do not wait kuadrant to be ready for integration tests

* fix: sort policy by kind, creation, condition for target status

* refactor: separate out serial tests that can affect other tests

* harden: RLP integration test updates & sort by PolicyByTargetRefKindAndAcceptedStatus tests

* refactor: rename ratelimit test package to ratelimitpolicy

* fix: wait for dnsrecords to finish deleting before deleting managed zone + timeouts

Since Kuadrant/dns-operator#156 was merged, dnsrecords with finizalers are left behind as ManagedZone was deleted causing the test namespaces to never be fully deleted.

Additionally use SpecContext and add timeouts for context so problematic tests terminate earlier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tests Changes to tests only kind/enhancement New feature or request size/medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants