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

Question: is it possible to run a container as an executable in an sh_binary or sh_test? #103

Closed
njlr opened this issue Mar 16, 2023 · 4 comments

Comments

@njlr
Copy link

njlr commented Mar 16, 2023

I was wondering if it possible to run a container_image (using the Bazel configured toolchain) inside of an sh_binary or sh_test? This would be a powerful feature, for example to test code that only works inside of a particular container.

If it is possible, is there an example of this?

@thesayyn
Copy link
Collaborator

Do you mean loading the oci_image target into the daemon and asserting its behavior with a bash test?

@njlr
Copy link
Author

njlr commented Mar 16, 2023

Do you mean loading the oci_image target into the daemon and asserting its behavior with a bash test?

Yes. Checking the behavior would probably mean asserting a particular exit code.

@thesayyn
Copy link
Collaborator

We have structure_test for that.

structure_test(
name = "test",
config = ["test.yaml"],
image = ":image",
)
which uses https://github.com/GoogleContainerTools/container-structure-test under the hood

@njlr
Copy link
Author

njlr commented Mar 16, 2023

Ah thank you. It sounds like I am looking for commandTests.

@njlr njlr closed this as completed Mar 16, 2023
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

No branches or pull requests

2 participants