FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docker/integration-cli/docker_cli_save_load_unix_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_save_load_unix_test.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (47 loc) · 1.68 KB
Breadcrumbs
docker
/
integration-cli
/
docker_cli_save_load_unix_test.go
Copy path
File metadata and controls
66 lines (47 loc) · 1.68 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
59
60
61
62
63
64
65
66
// +build !windows
package
main
import
(
"io/ioutil"
"os"
"os/exec"
"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check"
"github.com/kr/pty"
)
// save a repo and try to load it using stdout
func
(
s
*
DockerSuite
)
TestSaveAndLoadRepoStdout
(
c
*
check.
C
) {
name
:=
"test-save-and-load-repo-stdout"
dockerCmd
(
c
,
"run"
,
"--name"
,
name
,
"busybox"
,
"true"
)
repoName
:=
"foobar-save-load-test"
out
,
_
:=
dockerCmd
(
c
,
"commit"
,
name
,
repoName
)
before
,
_
:=
dockerCmd
(
c
,
"inspect"
,
repoName
)
tmpFile
,
err
:=
ioutil
.
TempFile
(
""
,
"foobar-save-load-test.tar"
)
c
.
Assert
(
err
,
check
.
IsNil
)
defer
os
.
Remove
(
tmpFile
.
Name
())
saveCmd
:=
exec
.
Command
(
dockerBinary
,
"save"
,
repoName
)
saveCmd
.
Stdout
=
tmpFile
_
,
err
=
runCommand
(
saveCmd
)
c
.
Assert
(
err
,
check
.
IsNil
)
tmpFile
,
err
=
os
.
Open
(
tmpFile
.
Name
())
c
.
Assert
(
err
,
check
.
IsNil
)
deleteImages
(
repoName
)
loadCmd
:=
exec
.
Command
(
dockerBinary
,
"load"
)
loadCmd
.
Stdin
=
tmpFile
out
,
_
,
err
=
runCommandWithOutput
(
loadCmd
)
c
.
Assert
(
err
,
check
.
IsNil
,
check
.
Commentf
(
out
))
after
,
_
:=
dockerCmd
(
c
,
"inspect"
,
repoName
)
c
.
Assert
(
before
,
check
.
Equals
,
after
)
//inspect is not the same after a save / load
deleteImages
(
repoName
)
pty
,
tty
,
err
:=
pty
.
Open
()
c
.
Assert
(
err
,
check
.
IsNil
)
cmd
:=
exec
.
Command
(
dockerBinary
,
"save"
,
repoName
)
cmd
.
Stdin
=
tty
cmd
.
Stdout
=
tty
cmd
.
Stderr
=
tty
c
.
Assert
(
cmd
.
Start
(),
check
.
IsNil
)
c
.
Assert
(
cmd
.
Wait
(),
check
.
NotNil
)
//did not break writing to a TTY
buf
:=
make
([]
byte
,
1024
)
n
,
err
:=
pty
.
Read
(
buf
)
c
.
Assert
(
err
,
check
.
IsNil
)
//could not read tty output
c
.
Assert
(
string
(
buf
[:
n
]),
checker
.
Contains
,
"Cowardly refusing"
,
check
.
Commentf
(
"help output is not being yielded"
,
out
))
}
Back
|
FazBrowse Home
|
New Git URL