Commit ad84a040 authored by Mahmood Ali's avatar Mahmood Ali
Browse files

some fixes

parent 3be8c006
Showing with 24 additions and 16 deletions
+24 -16
......@@ -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 terminal size", "error", err, "value", string(frame.Data))
continue
}
a.c.logger.Warn("resized terminal", "value", string(frame.Data))
......
......@@ -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)
}
}
}()
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment