FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docker/integration-cli/docker_cli_export_import_test.go at master · Eagle-X/docker · GitHub
Eagle-X
/
docker
Public
forked from
moby/moby
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
docker
/
integration-cli
/
docker_cli_export_import_test.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (46 loc) · 1.62 KB
Breadcrumbs
docker
/
integration-cli
/
docker_cli_export_import_test.go
Copy path
File metadata and controls
58 lines (46 loc) · 1.62 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package
main
import
(
"os"
"os/exec"
"strings"
"github.com/go-check/check"
)
// export an image and try to import it into a new one
func
(
s
*
DockerSuite
)
TestExportContainerAndImportImage
(
c
*
check.
C
) {
testRequires
(
c
,
DaemonIsLinux
)
containerID
:=
"testexportcontainerandimportimage"
dockerCmd
(
c
,
"run"
,
"--name"
,
containerID
,
"busybox"
,
"true"
)
out
,
_
:=
dockerCmd
(
c
,
"export"
,
containerID
)
importCmd
:=
exec
.
Command
(
dockerBinary
,
"import"
,
"-"
,
"repo/testexp:v1"
)
importCmd
.
Stdin
=
strings
.
NewReader
(
out
)
out
,
_
,
err
:=
runCommandWithOutput
(
importCmd
)
if
err
!=
nil
{
c
.
Fatalf
(
"failed to import image: %s, %v"
,
out
,
err
)
}
cleanedImageID
:=
strings
.
TrimSpace
(
out
)
if
cleanedImageID
==
""
{
c
.
Fatalf
(
"output should have been an image id, got: %s"
,
out
)
}
}
// Used to test output flag in the export command
func
(
s
*
DockerSuite
)
TestExportContainerWithOutputAndImportImage
(
c
*
check.
C
) {
testRequires
(
c
,
DaemonIsLinux
)
containerID
:=
"testexportcontainerwithoutputandimportimage"
dockerCmd
(
c
,
"run"
,
"--name"
,
containerID
,
"busybox"
,
"true"
)
dockerCmd
(
c
,
"export"
,
"--output=testexp.tar"
,
containerID
)
defer
os
.
Remove
(
"testexp.tar"
)
out
,
_
,
err
:=
runCommandWithOutput
(
exec
.
Command
(
"cat"
,
"testexp.tar"
))
if
err
!=
nil
{
c
.
Fatal
(
out
,
err
)
}
importCmd
:=
exec
.
Command
(
dockerBinary
,
"import"
,
"-"
,
"repo/testexp:v1"
)
importCmd
.
Stdin
=
strings
.
NewReader
(
out
)
out
,
_
,
err
=
runCommandWithOutput
(
importCmd
)
if
err
!=
nil
{
c
.
Fatalf
(
"failed to import image: %s, %v"
,
out
,
err
)
}
cleanedImageID
:=
strings
.
TrimSpace
(
out
)
if
cleanedImageID
==
""
{
c
.
Fatalf
(
"output should have been an image id, got: %s"
,
out
)
}
}
Back
|
FazBrowse Home
|
New Git URL