FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docker/integration-cli/docker_cli_version_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_version_test.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (54 loc) · 1.54 KB
Breadcrumbs
docker
/
integration-cli
/
docker_cli_version_test.go
Copy path
File metadata and controls
63 lines (54 loc) · 1.54 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
package
main
import
(
"strings"
"github.com/go-check/check"
)
// ensure docker version works
func
(
s
*
DockerSuite
)
TestVersionEnsureSucceeds
(
c
*
check.
C
) {
out
,
_
:=
dockerCmd
(
c
,
"version"
)
stringsToCheck
:=
map
[
string
]
int
{
"Client:"
:
1
,
"Server:"
:
1
,
" Version:"
:
2
,
" API version:"
:
2
,
" Go version:"
:
2
,
" Git commit:"
:
2
,
" OS/Arch:"
:
2
,
" Built:"
:
2
,
}
for
k
,
v
:=
range
stringsToCheck
{
if
strings
.
Count
(
out
,
k
)
!=
v
{
c
.
Errorf
(
"%v expected %d instances found %d"
,
k
,
v
,
strings
.
Count
(
out
,
k
))
}
}
}
// ensure the Windows daemon return the correct platform string
func
(
s
*
DockerSuite
)
TestVersionPlatform_w
(
c
*
check.
C
) {
testRequires
(
c
,
DaemonIsWindows
)
testVersionPlatform
(
c
,
"windows/amd64"
)
}
// ensure the Linux daemon return the correct platform string
func
(
s
*
DockerSuite
)
TestVersionPlatform_l
(
c
*
check.
C
) {
testRequires
(
c
,
DaemonIsLinux
)
testVersionPlatform
(
c
,
"linux/amd64"
)
}
func
testVersionPlatform
(
c
*
check.
C
,
platform
string
) {
out
,
_
:=
dockerCmd
(
c
,
"version"
)
expected
:=
"OS/Arch: "
+
platform
split
:=
strings
.
Split
(
out
,
"
\n
"
)
if
len
(
split
)
<
14
{
// To avoid invalid indexing in loop below
c
.
Errorf
(
"got %d lines from version"
,
len
(
split
))
}
// Verify the second 'OS/Arch' matches the platform. Experimental has
// more lines of output than 'regular'
bFound
:=
false
for
i
:=
14
;
i
<
len
(
split
);
i
++
{
if
strings
.
Contains
(
split
[
i
],
expected
) {
bFound
=
true
break
}
}
if
!
bFound
{
c
.
Errorf
(
"Could not find server '%s' in '%s'"
,
expected
,
out
)
}
}
Back
|
FazBrowse Home
|
New Git URL