containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.96k stars 2.43k forks source link

`image scp` does not have many tests #24297

Open zackattackz opened 1 month ago

zackattackz commented 1 month ago

Currently the image scp command does not have comprehensive test coverage.

As far as I have seen there is test/e2e/image_scp_test.go and pkg/domain/utils/scp_test.go, but even both of these do not contain much.

The e2e test says it is not possible to make an ssh connection (I would guess because of limitations of the CI environment?) so it just does some basic testing.

It doesn't look like there are any API tests or system tests. There is this ssh test for a similar feature, which seems to indicate that there is not any ssh functionality in the test environment. So I'd imagine the same would apply to any potential system tests of image scp

I'd be interested in working on some test cases across image scp, but because of the CI limitation I'm not sure how feasible it would be.

I could see an alternative of creating a mock ssh implementation that would just record all the commands/files that image scp sends to it, which could be checked to verify expected behavior in a test. This could work well for unit tests, but I'm not sure if that would be great for an integration test because it wouldn't actually integrate with SSH (though it could still be better than nothing I think?).

This mock could be created in c/common/ssh, the ssh package used by image scp.

Please let me know any thoughts!

rhatdan commented 1 month ago

Thanks the added tests would be great.

We could setup privileged containers with sshd running in them and then allow them to act as a server.

Then copy images back and forth between them.

zackattackz commented 1 month ago

That sounds like it should work, good idea. You think I could just start the sshd container(s) in the setup for the scp e2e test? Would probably need a new libpod image like fedora_podman but with sshd installed as well. I could just use a placeholder URL for now to draft the setup code.

github-actions[bot] commented 1 week ago

A friendly reminder that this issue had no activity for 30 days.