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

libcnb-test: Refactor the API for starting containers #469

Merged
merged 3 commits into from
Jul 19, 2022

Conversation

edmorley
Copy link
Member

Previously container configuration was specified using a builder-style API, which was inconsistent with the API for TestRunner::run_test, and also slightly confusing at first glance (eg: for TestContext::prepare_container what does it mean to "prepare" a container?)

Now, a new TestContext::start_container takes a ContainerConfig argument along with the closure, similar to TestRunner::run_test and TestConfig.

In addition, a new convenience function for running a shell script (a common use-case) has been added (TestContext::run_shell_command) which handles more of the boilerplate than PrepareContainerContext::start_with_shell_command used to. In the future, this function will also check the exit status of the container (#446).

GUS-W-11415596.

@edmorley edmorley self-assigned this Jul 18, 2022
@edmorley edmorley force-pushed the edmorley/container-config branch from 5f7c6e1 to f17a434 Compare July 18, 2022 16:13
@edmorley edmorley marked this pull request as ready for review July 18, 2022 16:18
@edmorley edmorley requested a review from a team as a code owner July 18, 2022 16:18
@edmorley edmorley force-pushed the edmorley/container-config branch from f17a434 to fa415d8 Compare July 18, 2022 16:25
edmorley added 2 commits July 19, 2022 07:48
Previously container configuration was specified using a builder-style API,
which was inconsistent with the API for `TestRunner::run_test`, and also
slightly confusing at first glance (eg: for `TestContext::prepare_container`
what does it mean to "prepare" a container?)

Now, a new `TestContext::start_container` takes a `ContainerConfig`
argument along with the closure, similar to `TestRunner::run_test`
and `TestConfig`.

In addition, a new convenience function for running a shell script (a
common use-case) has been added (`TestContext::run_shell_command`)
which handles more of the boilerplate than 
`PrepareContainerContext::start_with_shell_command` used to. In the
future, this function will also check the exit status of the container (#446).

GUS-W-11415596.
@edmorley edmorley force-pushed the edmorley/container-config branch from fa415d8 to f70a89a Compare July 19, 2022 06:58
@edmorley edmorley enabled auto-merge (squash) July 19, 2022 07:21
@edmorley edmorley merged commit b79b953 into main Jul 19, 2022
@edmorley edmorley deleted the edmorley/container-config branch July 19, 2022 07:24
@edmorley edmorley removed the examples label Jul 19, 2022
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.

2 participants