
For unit tests, this mocks the runners Execute method with a customizable function that operates on the request, streams and exit channel to simulate a real execution. End-to-end tests are moved to the tests/e2e_tests folder. The tests folder allows us to have shared helper functions for all tests in a separate package (tests) that is not included in the non-test build. This also adds one second of delay before each end-to-end test case by using the TestSetup method of suite. By slowing down test execution, this gives Nomad time to create new allocations when a test requested a runner. Another solution could be to increase the scale of the job to have enough allocations for all end-to-end tests. Co-authored-by: Maximilian Paß <maximilian.pass@student.hpi.uni-potsdam.de>
94 lines
1.9 KiB
Go
94 lines
1.9 KiB
Go
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
|
|
|
|
package api
|
|
|
|
import (
|
|
io "io"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// webSocketConnectionMock is an autogenerated mock type for the webSocketConnection type
|
|
type webSocketConnectionMock struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Close provides a mock function with given fields:
|
|
func (_m *webSocketConnectionMock) Close() 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
|
|
}
|
|
|
|
// CloseHandler provides a mock function with given fields:
|
|
func (_m *webSocketConnectionMock) CloseHandler() func(int, string) error {
|
|
ret := _m.Called()
|
|
|
|
var r0 func(int, string) error
|
|
if rf, ok := ret.Get(0).(func() func(int, string) error); ok {
|
|
r0 = rf()
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(func(int, string) error)
|
|
}
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// NextReader provides a mock function with given fields:
|
|
func (_m *webSocketConnectionMock) NextReader() (int, io.Reader, error) {
|
|
ret := _m.Called()
|
|
|
|
var r0 int
|
|
if rf, ok := ret.Get(0).(func() int); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(int)
|
|
}
|
|
|
|
var r1 io.Reader
|
|
if rf, ok := ret.Get(1).(func() io.Reader); ok {
|
|
r1 = rf()
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).(io.Reader)
|
|
}
|
|
}
|
|
|
|
var r2 error
|
|
if rf, ok := ret.Get(2).(func() error); ok {
|
|
r2 = rf()
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// SetCloseHandler provides a mock function with given fields: h
|
|
func (_m *webSocketConnectionMock) SetCloseHandler(h func(int, string) error) {
|
|
_m.Called(h)
|
|
}
|
|
|
|
// WriteMessage provides a mock function with given fields: messageType, data
|
|
func (_m *webSocketConnectionMock) WriteMessage(messageType int, data []byte) error {
|
|
ret := _m.Called(messageType, data)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(int, []byte) error); ok {
|
|
r0 = rf(messageType, data)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|