Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add bootstrap fixture for bootstrap tests #8781

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

Merged
merged 43 commits into from
Sep 1, 2023
Merged

Add bootstrap fixture for bootstrap tests #8781

merged 43 commits into from
Sep 1, 2023

Conversation

simonrw
Copy link
Contributor

@simonrw simonrw commented Jul 31, 2023

Add a fixture (and example tests) for black-box testing the LS container. Particularly: starting the container with different configurations and ensuring that it behaves as expected.

This fixture will be useful for:

  • cli startup tests
  • hypercorn configuration tests
  • environment configuration tests
  • DNS tests
  • persistence tests
  • startup script tests

@simonrw simonrw added the semver: patch Non-breaking changes which can be included in patch releases label Jul 31, 2023
@simonrw simonrw self-assigned this Jul 31, 2023
@github-actions
Copy link

github-actions bot commented Jul 31, 2023

LocalStack Community integration with Pro

       2 files         2 suites   1h 27m 26s ⏱️
2 152 tests 1 676 ✔️ 476 💤 0
2 153 runs  1 676 ✔️ 477 💤 0

Results for commit 4dd1f91.

♻️ This comment has been updated with latest results.

@simonrw simonrw force-pushed the bootstrap-fixture branch from f83464f to 48887a4 Compare August 1, 2023 18:16
@coveralls
Copy link

coveralls commented Aug 2, 2023

Coverage Status

coverage: 80.365% (-0.07%) from 80.436% when pulling 9bc8ce1 on bootstrap-fixture into 5eba678 on master.

@simonrw simonrw force-pushed the bootstrap-fixture branch 2 times, most recently from bca3962 to e768840 Compare August 15, 2023 14:22
@simonrw simonrw force-pushed the bootstrap-fixture branch 3 times, most recently from a461ee0 to 3aee5e6 Compare August 18, 2023 15:40
@simonrw simonrw changed the base branch from master to bootstrap-ci August 18, 2023 17:08
@simonrw simonrw force-pushed the bootstrap-fixture branch 4 times, most recently from 6ba7e0c to 62108a7 Compare August 23, 2023 14:56
@simonrw simonrw changed the base branch from bootstrap-ci to master August 23, 2023 14:57
@simonrw simonrw force-pushed the bootstrap-fixture branch 2 times, most recently from d4082e5 to 09d4b8b Compare August 24, 2023 15:19
@simonrw simonrw added semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases and removed semver: patch Non-breaking changes which can be included in patch releases labels Aug 24, 2023
@simonrw simonrw marked this pull request as ready for review August 24, 2023 17:40
@thrau thrau force-pushed the bootstrap-fixture branch from 90200c3 to c9617c9 Compare August 28, 2023 10:28
@simonrw simonrw force-pushed the bootstrap-fixture branch from 3f80d28 to 02ffe32 Compare August 29, 2023 14:20
@simonrw simonrw requested a review from alexrashed as a code owner August 29, 2023 14:47
Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

Great set of refactorings! I have a few comments which are mostly minor. I wanted to just clarify where we stand on the issue of passing ContainerConfiguration to the hooks or rather stick with the Container. Should be reconciled with #8890

Comment on lines +548 to +549
if not isinstance(self.container, RunningContainer):
raise ValueError(f"Container {self.container} not started")
Copy link
Member

Choose a reason for hiding this comment

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

this should be done by overriding the shutdown method otherwise the server will be in a wonky state (see the shutdown method implementation)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've pulled the check outside the do_shutdown method so we dont mess with the threading.event` variables: f341355 - is that what you were getting at?

@simonrw simonrw requested a review from thrau August 31, 2023 16:46
Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

nice job @simonrw can't wait to start using this in #8994 🚀

def _wait_for(container: RunningContainer, timeout: float | None = None):
container.wait_until_ready(timeout)

poll_condition(lambda: constants.READY_MARKER_OUTPUT in container.get_logs().splitlines())
Copy link
Member

Choose a reason for hiding this comment

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

should we add the timeout here as well just to be sure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot, thanks will do 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants