Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
503b91cc
Commit
503b91cc
authored
6 years ago
by
Mahmood Ali
Browse files
Options
Download
Email Patches
Plain Diff
docker minor changes
parent
fe57454f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
drivers/docker/driver.go
+0
-2
drivers/docker/driver.go
drivers/docker/driver_test.go
+0
-29
drivers/docker/driver_test.go
drivers/docker/driver_unix_test.go
+29
-0
drivers/docker/driver_unix_test.go
plugins/drivers/testutils/exec_testing.go
+20
-5
plugins/drivers/testutils/exec_testing.go
with
49 additions
and
36 deletions
+49
-36
drivers/docker/driver.go
+
0
-
2
View file @
503b91cc
...
...
@@ -1209,8 +1209,6 @@ func (d *Driver) ExecTaskStreaming(ctx context.Context, taskID string, opts driv
done
:=
make
(
chan
interface
{})
defer
close
(
done
)
d
.
logger
.
Warn
(
"exectask is called"
,
"opts"
,
fmt
.
Sprintf
(
"%#v"
,
opts
))
h
,
ok
:=
d
.
tasks
.
Get
(
taskID
)
if
!
ok
{
return
nil
,
drivers
.
ErrTaskNotFound
...
...
This diff is collapsed.
Click to expand it.
drivers/docker/driver_test.go
+
0
-
29
View file @
503b91cc
...
...
@@ -2077,32 +2077,3 @@ func waitForExist(t *testing.T, client *docker.Client, containerID string) {
require
.
NoError
(
t
,
err
)
})
}
func
TestDockerExecTaskStreaming
(
t
*
testing
.
T
)
{
if
!
tu
.
IsCI
()
{
t
.
Parallel
()
}
testutil
.
DockerCompatible
(
t
)
taskCfg
:=
newTaskConfig
(
""
,
[]
string
{
"/bin/sleep"
,
"1000"
})
task
:=
&
drivers
.
TaskConfig
{
ID
:
uuid
.
Generate
(),
Name
:
"nc-demo"
,
AllocID
:
uuid
.
Generate
(),
Resources
:
basicResources
,
}
require
.
NoError
(
t
,
task
.
EncodeConcreteDriverConfig
(
&
taskCfg
))
d
:=
dockerDriverHarness
(
t
,
nil
)
cleanup
:=
d
.
MkAllocDir
(
task
,
true
)
defer
cleanup
()
copyImage
(
t
,
task
.
TaskDir
(),
"busybox.tar"
)
_
,
_
,
err
:=
d
.
StartTask
(
task
)
require
.
NoError
(
t
,
err
)
defer
d
.
DestroyTask
(
task
.
ID
,
true
)
dtestutil
.
ExecTaskStreamingConformanceTests
(
t
,
d
,
task
.
ID
)
}
This diff is collapsed.
Click to expand it.
drivers/docker/driver_unix_test.go
+
29
-
0
View file @
503b91cc
...
...
@@ -761,3 +761,32 @@ func copyFile(src, dst string, t *testing.T) {
t
.
Fatalf
(
"copying %v -> %v failed: %v"
,
src
,
dst
,
err
)
}
}
func
TestDockerExecTaskStreaming
(
t
*
testing
.
T
)
{
if
!
tu
.
IsCI
()
{
t
.
Parallel
()
}
testutil
.
DockerCompatible
(
t
)
taskCfg
:=
newTaskConfig
(
""
,
[]
string
{
"/bin/sleep"
,
"1000"
})
task
:=
&
drivers
.
TaskConfig
{
ID
:
uuid
.
Generate
(),
Name
:
"nc-demo"
,
AllocID
:
uuid
.
Generate
(),
Resources
:
basicResources
,
}
require
.
NoError
(
t
,
task
.
EncodeConcreteDriverConfig
(
&
taskCfg
))
d
:=
dockerDriverHarness
(
t
,
nil
)
cleanup
:=
d
.
MkAllocDir
(
task
,
true
)
defer
cleanup
()
copyImage
(
t
,
task
.
TaskDir
(),
"busybox.tar"
)
_
,
_
,
err
:=
d
.
StartTask
(
task
)
require
.
NoError
(
t
,
err
)
defer
d
.
DestroyTask
(
task
.
ID
,
true
)
dtestutils
.
ExecTaskStreamingConformanceTests
(
t
,
d
,
task
.
ID
)
}
This diff is collapsed.
Click to expand it.
plugins/drivers/testutils/exec_testing.go
+
20
-
5
View file @
503b91cc
...
...
@@ -35,7 +35,7 @@ func ExecTaskStreamingBasicResponses(t *testing.T, driver *DriverHarness, taskID
customizeFn
func
(
*
drivers
.
ExecOptions
,
chan
drivers
.
TerminalSize
)
}{
{
name
:
"
basic non tty
"
,
name
:
"
notty: basic
"
,
command
:
"echo hello stdout; echo hello stderr >&2; exit 43"
,
tty
:
false
,
stdout
:
"hello stdout
\n
"
,
...
...
@@ -43,27 +43,42 @@ func ExecTaskStreamingBasicResponses(t *testing.T, driver *DriverHarness, taskID
exitCode
:
43
,
},
{
name
:
"streaming
non tty
"
,
name
:
"
notty:
streaming"
,
command
:
"for n in 1 2 3; do echo $n; sleep 1; done"
,
tty
:
false
,
stdout
:
"1
\n
2
\n
3
\n
"
,
exitCode
:
0
,
},
{
name
:
"stty check
non tty
"
,
command
:
"
sleep 0.1;
stty size"
,
name
:
"
ntty:
stty check"
,
command
:
"stty size"
,
tty
:
false
,
stderr
:
"stty: standard input: Inappropriate ioctl for device
\n
"
,
exitCode
:
1
,
},
{
name
:
"stdin passing
non tty
"
,
name
:
"
notty:
stdin passing"
,
command
:
"echo hello from command; cat"
,
tty
:
false
,
stdin
:
"hello from stdin
\n
"
,
stdout
:
"hello from command
\n
hello from stdin
\n
"
,
exitCode
:
0
,
},
{
name
:
"notty: stdin passing"
,
command
:
"echo hello from command; cat"
,
tty
:
false
,
stdin
:
"hello from stdin
\n
"
,
stdout
:
"hello from command
\n
hello from stdin
\n
"
,
exitCode
:
0
,
},
{
name
:
"notty: children processes"
,
command
:
"(( sleep 6; echo from background ) & ); echo from main; exec sleep 1"
,
tty
:
false
,
stdout
:
"hello from command
\n
hello from stdin
\n
"
,
exitCode
:
0
,
},
}
for
_
,
c
:=
range
cases
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help