Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
ad84a040
Commit
ad84a040
authored
6 years ago
by
Mahmood Ali
Browse files
Options
Download
Email Patches
Plain Diff
some fixes
parent
3be8c006
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/alloc_endpoint.go
+1
-2
client/alloc_endpoint.go
drivers/docker/driver.go
+1
-1
drivers/docker/driver.go
plugins/drivers/testutils/testing.go
+22
-13
plugins/drivers/testutils/testing.go
with
24 additions
and
16 deletions
+24
-16
client/alloc_endpoint.go
+
1
-
2
View file @
ad84a040
...
...
@@ -206,7 +206,6 @@ func (a *Allocations) Exec(conn io.ReadWriteCloser) {
a
.
c
.
logger
.
Warn
(
"received unexpected error"
,
"error"
,
err
)
break
}
a
.
c
.
logger
.
Warn
(
"received input"
,
"input"
,
fmt
.
Sprintf
(
"%#v"
,
frame
),
"error"
,
err
)
switch
{
case
frame
.
File
==
"stdin"
:
inWriter
.
Write
(
frame
.
Data
)
...
...
@@ -214,7 +213,7 @@ func (a *Allocations) Exec(conn io.ReadWriteCloser) {
t
:=
drivers
.
TerminalSize
{}
err
:=
json
.
Unmarshal
(
frame
.
Data
,
&
t
)
if
err
!=
nil
{
a
.
c
.
logger
.
Warn
(
"failed to deserialize termina size"
,
"error"
,
err
,
"value"
,
string
(
frame
.
Data
))
a
.
c
.
logger
.
Warn
(
"failed to deserialize termina
l
size"
,
"error"
,
err
,
"value"
,
string
(
frame
.
Data
))
continue
}
a
.
c
.
logger
.
Warn
(
"resized terminal"
,
"value"
,
string
(
frame
.
Data
))
...
...
This diff is collapsed.
Click to expand it.
drivers/docker/driver.go
+
1
-
1
View file @
ad84a040
...
...
@@ -1239,7 +1239,7 @@ func (d *Driver) ExecTaskStreaming(ctx context.Context, taskID string, execOpts
return
case
s
:=
<-
resizeCh
:
d
.
logger
.
Info
(
"delect resize"
,
"size"
,
s
)
client
.
ResizeExecTTY
(
exec
.
ID
,
int
(
s
.
Height
)
,
int
(
s
.
Width
)
)
client
.
ResizeExecTTY
(
exec
.
ID
,
s
.
Height
,
s
.
Width
)
}
}
}()
...
...
This diff is collapsed.
Click to expand it.
plugins/drivers/testutils/testing.go
+
22
-
13
View file @
ad84a040
...
...
@@ -3,6 +3,7 @@ package testutils
import
(
"context"
"fmt"
"io"
"io/ioutil"
"path/filepath"
"runtime"
...
...
@@ -181,19 +182,21 @@ func (h *DriverHarness) WaitUntilStarted(taskID string, timeout time.Duration) e
// is passed through the base plugin layer.
type
MockDriver
struct
{
base
.
MockPlugin
TaskConfigSchemaF
func
()
(
*
hclspec
.
Spec
,
error
)
FingerprintF
func
(
context
.
Context
)
(
<-
chan
*
drivers
.
Fingerprint
,
error
)
CapabilitiesF
func
()
(
*
drivers
.
Capabilities
,
error
)
RecoverTaskF
func
(
*
drivers
.
TaskHandle
)
error
StartTaskF
func
(
*
drivers
.
TaskConfig
)
(
*
drivers
.
TaskHandle
,
*
drivers
.
DriverNetwork
,
error
)
WaitTaskF
func
(
context
.
Context
,
string
)
(
<-
chan
*
drivers
.
ExitResult
,
error
)
StopTaskF
func
(
string
,
time
.
Duration
,
string
)
error
DestroyTaskF
func
(
string
,
bool
)
error
InspectTaskF
func
(
string
)
(
*
drivers
.
TaskStatus
,
error
)
TaskStatsF
func
(
context
.
Context
,
string
,
time
.
Duration
)
(
<-
chan
*
drivers
.
TaskResourceUsage
,
error
)
TaskEventsF
func
(
context
.
Context
)
(
<-
chan
*
drivers
.
TaskEvent
,
error
)
SignalTaskF
func
(
string
,
string
)
error
ExecTaskF
func
(
string
,
[]
string
,
time
.
Duration
)
(
*
drivers
.
ExecTaskResult
,
error
)
TaskConfigSchemaF
func
()
(
*
hclspec
.
Spec
,
error
)
FingerprintF
func
(
context
.
Context
)
(
<-
chan
*
drivers
.
Fingerprint
,
error
)
CapabilitiesF
func
()
(
*
drivers
.
Capabilities
,
error
)
RecoverTaskF
func
(
*
drivers
.
TaskHandle
)
error
StartTaskF
func
(
*
drivers
.
TaskConfig
)
(
*
drivers
.
TaskHandle
,
*
drivers
.
DriverNetwork
,
error
)
WaitTaskF
func
(
context
.
Context
,
string
)
(
<-
chan
*
drivers
.
ExitResult
,
error
)
StopTaskF
func
(
string
,
time
.
Duration
,
string
)
error
DestroyTaskF
func
(
string
,
bool
)
error
InspectTaskF
func
(
string
)
(
*
drivers
.
TaskStatus
,
error
)
TaskStatsF
func
(
context
.
Context
,
string
,
time
.
Duration
)
(
<-
chan
*
drivers
.
TaskResourceUsage
,
error
)
TaskEventsF
func
(
context
.
Context
)
(
<-
chan
*
drivers
.
TaskEvent
,
error
)
SignalTaskF
func
(
string
,
string
)
error
ExecTaskF
func
(
string
,
[]
string
,
time
.
Duration
)
(
*
drivers
.
ExecTaskResult
,
error
)
ExecTaskStreamingF
func
(
context
.
Context
,
string
,
drivers
.
ExecOptions
,
io
.
Reader
,
io
.
Writer
,
io
.
Writer
,
<-
chan
drivers
.
TerminalSize
)
(
*
drivers
.
ExitResult
,
error
)
}
func
(
d
*
MockDriver
)
TaskConfigSchema
()
(
*
hclspec
.
Spec
,
error
)
{
return
d
.
TaskConfigSchemaF
()
}
...
...
@@ -230,6 +233,12 @@ func (d *MockDriver) ExecTask(taskID string, cmd []string, timeout time.Duration
return
d
.
ExecTaskF
(
taskID
,
cmd
,
timeout
)
}
func
(
d
*
MockDriver
)
ExecTaskStreaming
(
ctx
context
.
Context
,
taskID
string
,
execOpts
drivers
.
ExecOptions
,
stdin
io
.
Reader
,
stdout
,
stderr
io
.
Writer
,
resizeCh
<-
chan
drivers
.
TerminalSize
)
(
*
drivers
.
ExitResult
,
error
)
{
return
d
.
ExecTaskStreamingF
(
ctx
,
taskID
,
execOpts
,
stdin
,
stdout
,
stderr
,
resizeCh
)
}
// SetEnvvars sets path and host env vars depending on the FS isolation used.
func
SetEnvvars
(
envBuilder
*
taskenv
.
Builder
,
fsi
drivers
.
FSIsolation
,
taskDir
*
allocdir
.
TaskDir
,
conf
*
config
.
Config
)
{
// Set driver-specific environment variables
...
...
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