Closed e4t closed 6 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 viapodman 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
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 viapodman 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.
Fails at the moment:
this is fixed now (again)
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 viapodman 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.