export: use io.Writer instead of file

This allows use to use STDOUT directly without having to call open
again, also this makes the export API endpoint much more performant
since it no longer needs to copy to a temp file.
I noticed that there was no export API test so I added one.

And lastly opening /dev/stdout will not work on windows.

Fixes #16870

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2022-12-19 19:45:06 +01:00
parent 56982a9236
commit 3ac5d10098
7 changed files with 37 additions and 47 deletions

View File

@@ -51,6 +51,13 @@ like "$output" ".*merged" "Check container mount"
# Unmount the container
t POST libpod/containers/foo/unmount 204
# export the container fs to tarball
t GET libpod/containers/foo/export 200
like "$(<$WORKDIR/curl.headers.out)" ".*"Content-Type\: application/x-tar".*"
tar_tf=$(tar tf $WORKDIR/curl.result.out)
like "$tar_tf" ".*bin/cat.*" "fetched tarball: contains bin/cat path"
t DELETE libpod/containers/foo?force=true 200
# Create 3 stopped containers to test containers prune