Skip to content

💚 Use a unique registry for every test#143

Closed
randycoulman wants to merge 3 commits intomainfrom
unique-registry-per-test
Closed

💚 Use a unique registry for every test#143
randycoulman wants to merge 3 commits intomainfrom
unique-registry-per-test

Conversation

@randycoulman
Copy link
Copy Markdown
Collaborator

@randycoulman randycoulman commented Oct 30, 2024

Describe the purpose of your pull request

In order to fix the frequently-failing tests, this takes a different approach in addition to running many of the tests synchronously.

It seems as though our ConfigCat instances aren't fully shutting down and removing themselves from the Registry before the next test starts, even though they should be doing that.

Instead, we start a uniquely-named Registry for each test, injecting it into the code using the ProcessTree library.

We allow tests to start their own Registry and pass it into the start_config_cat helper function for the one that needs to refer to the exact same registry.

To make this cleaner, we extract a via_tuple helper function into a new ConfigCat.Registry module so that we can localize the lookup of the registry to use.

This is an alternative to #142.

Related issues (only if applicable)

Provide links to issues relating to this pull request

Requirement checklist (only if applicable)

  • I have covered the applied changes with automated tests.
  • I have executed the full automated test set against my changes.
  • I have validated my changes against all supported platform versions.
  • I have read and accepted the contribution agreement.

Moves all of the via_tuple construction to a single place to make it easier to use a per-process Registry in tests.
Start a uniquely-named Registry for each test, injecting it into the code using the [ProcessTree](https://hexdocs.pm/process_tree/ProcessTree.html) library.

Allow tests to start their own Registry and pass it into the `start_config_cat` helper function for the one that needs to refer to the exact same registry.
@randycoulman randycoulman marked this pull request as ready for review October 30, 2024 05:45
@randycoulman randycoulman requested a review from a team as a code owner October 30, 2024 05:45
@randycoulman randycoulman requested a review from kp-cat October 30, 2024 05:45
@randycoulman randycoulman mentioned this pull request Oct 30, 2024
4 tasks
@kp-cat
Copy link
Copy Markdown
Member

kp-cat commented Nov 4, 2024

Hey @randycoulman,
Thanks for the PR. Finally, we accept the other PR (--max-cases 1) because we would like to avoid introducing extra dependencies.

@kp-cat kp-cat closed this Nov 4, 2024
@randycoulman randycoulman deleted the unique-registry-per-test branch November 5, 2024 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants