
When the context passed to Nomad Allocation Exec is cancelled, the process is not terminated. Instead, just the WebSocket connection is closed. In order to terminate long-running processes, a special character is injected into the standard input stream. This character is parsed by the tty line discipline (tty has to be true). The line discipline sends a SIGQUIT signal to the process, terminating it and producing a core dump (in a file called 'core'). The SIGQUIT signal can be caught but isn't by default, which is why the runner is destroyed if the program does not terminate during a grace period after the signal was sent.
160 lines
3.6 KiB
Go
160 lines
3.6 KiB
Go
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
|
|
|
|
package runner
|
|
|
|
import (
|
|
context "context"
|
|
io "io"
|
|
|
|
dto "gitlab.hpi.de/codeocean/codemoon/poseidon/pkg/dto"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
time "time"
|
|
)
|
|
|
|
// RunnerMock is an autogenerated mock type for the Runner type
|
|
type RunnerMock struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Add provides a mock function with given fields: id, executionRequest
|
|
func (_m *RunnerMock) Add(id ExecutionID, executionRequest *dto.ExecutionRequest) {
|
|
_m.Called(id, executionRequest)
|
|
}
|
|
|
|
// Destroy provides a mock function with given fields:
|
|
func (_m *RunnerMock) Destroy() error {
|
|
ret := _m.Called()
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func() error); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// ExecuteInteractively provides a mock function with given fields: request, stdin, stdout, stderr
|
|
func (_m *RunnerMock) ExecuteInteractively(request *dto.ExecutionRequest, stdin io.ReadWriter, stdout io.Writer, stderr io.Writer) (<-chan ExitInfo, context.CancelFunc) {
|
|
ret := _m.Called(request, stdin, stdout, stderr)
|
|
|
|
var r0 <-chan ExitInfo
|
|
if rf, ok := ret.Get(0).(func(*dto.ExecutionRequest, io.ReadWriter, io.Writer, io.Writer) <-chan ExitInfo); ok {
|
|
r0 = rf(request, stdin, stdout, stderr)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(<-chan ExitInfo)
|
|
}
|
|
}
|
|
|
|
var r1 context.CancelFunc
|
|
if rf, ok := ret.Get(1).(func(*dto.ExecutionRequest, io.ReadWriter, io.Writer, io.Writer) context.CancelFunc); ok {
|
|
r1 = rf(request, stdin, stdout, stderr)
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).(context.CancelFunc)
|
|
}
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ID provides a mock function with given fields:
|
|
func (_m *RunnerMock) ID() string {
|
|
ret := _m.Called()
|
|
|
|
var r0 string
|
|
if rf, ok := ret.Get(0).(func() string); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// MappedPorts provides a mock function with given fields:
|
|
func (_m *RunnerMock) MappedPorts() []*dto.MappedPort {
|
|
ret := _m.Called()
|
|
|
|
var r0 []*dto.MappedPort
|
|
if rf, ok := ret.Get(0).(func() []*dto.MappedPort); ok {
|
|
r0 = rf()
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*dto.MappedPort)
|
|
}
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Pop provides a mock function with given fields: id
|
|
func (_m *RunnerMock) Pop(id ExecutionID) (*dto.ExecutionRequest, bool) {
|
|
ret := _m.Called(id)
|
|
|
|
var r0 *dto.ExecutionRequest
|
|
if rf, ok := ret.Get(0).(func(ExecutionID) *dto.ExecutionRequest); ok {
|
|
r0 = rf(id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*dto.ExecutionRequest)
|
|
}
|
|
}
|
|
|
|
var r1 bool
|
|
if rf, ok := ret.Get(1).(func(ExecutionID) bool); ok {
|
|
r1 = rf(id)
|
|
} else {
|
|
r1 = ret.Get(1).(bool)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ResetTimeout provides a mock function with given fields:
|
|
func (_m *RunnerMock) ResetTimeout() {
|
|
_m.Called()
|
|
}
|
|
|
|
// SetupTimeout provides a mock function with given fields: duration
|
|
func (_m *RunnerMock) SetupTimeout(duration time.Duration) {
|
|
_m.Called(duration)
|
|
}
|
|
|
|
// StopTimeout provides a mock function with given fields:
|
|
func (_m *RunnerMock) StopTimeout() {
|
|
_m.Called()
|
|
}
|
|
|
|
// TimeoutPassed provides a mock function with given fields:
|
|
func (_m *RunnerMock) TimeoutPassed() bool {
|
|
ret := _m.Called()
|
|
|
|
var r0 bool
|
|
if rf, ok := ret.Get(0).(func() bool); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateFileSystem provides a mock function with given fields: request
|
|
func (_m *RunnerMock) UpdateFileSystem(request *dto.UpdateFileSystemRequest) error {
|
|
ret := _m.Called(request)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(*dto.UpdateFileSystemRequest) error); ok {
|
|
r0 = rf(request)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|