SUSE / BCI-tests

This repository contains the tests for the SUSE Base Container Images
Apache License 2.0
10 stars 22 forks source link

Add tests for the Spack container #450

Closed e4t closed 6 months ago

e4t commented 7 months ago

This is an initial implementation.

Unfortunately, a lot of the pytest_container 'goodness' was not usable to test the Spack container:

In order to test whether sending a Spack command directly to the container works, it needs to be launched: podman run --rm <spack_container> <spack_command> However, when running: container.connection.check_output() a command will be sent to a via podman exec <containerID> sh -c ... which will use not be able to run a Spack command.

Furthermore, we cannot use the MultiStageBuild.build() interface as the simplistic substitue() replacement will choke on '$..' shell constructs.

I'd suggest to merge this test into a separate branch and address issues there before merging to main.

dirkmueller commented 7 months ago

In order to test whether sending a Spack command directly to the container works, it needs to be launched: podman run --rm <spack_container> <spack_command> However, when running: container.connection.check_output() a command will be sent to a via podman exec <containerID> sh -c ... which will use not be able to run a Spack command.

not a great way of doing it, but you can copy the method from here:

https://github.com/SUSE/BCI-tests/blob/main/tests/test_helm.py#L12

e4t commented 7 months ago

In order to test whether sending a Spack command directly to the container works, it needs to be launched: podman run --rm <spack_container> <spack_command> However, when running: container.connection.check_output() a command will be sent to a via podman exec <containerID> sh -c ... which will use not be able to run a Spack command.

not a great way of doing it, but you can copy the method from here:

https://github.com/SUSE/BCI-tests/blob/main/tests/test_helm.py#L12

not sure if you've seen the patch, but this was pretty much what I did: https://github.com/e4t/BCI-tests/blob/238d877309efb46d044da5ec0e9cf9554deb0cc6/tests/test_spack.py#L60-L65 and: https://github.com/e4t/BCI-tests/blob/238d877309efb46d044da5ec0e9cf9554deb0cc6/tests/test_spack.py#L99-L106 The difference being that this code uses check_output() while I use run_expect() which gives me a finer control over the container command return value: check_output() accepts 0 and 1.

dirkmueller commented 6 months ago

Fails at the moment:

this is fixed now (again)