diff --git a/.gitignore b/.gitignore index 6211698d..c40fc773 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .blobs/ blobs/ .dev_builds/ +/.vscode/ dev_releases/ config/dev.yml config/private.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8ec91023..2bad4b1e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,7 +33,7 @@ repositories: 3. All contributions must be sent using GitHub pull requests as they create a nice audit trail and structured approach. - + The originating github user has to either have a github id on-file with the list of approved users that have signed the CLA or they can be a public "member" of a GitHub organization for a group that has signed the corporate @@ -41,15 +41,15 @@ repositories: having to tell us when someone joins/leaves an organization. By removing a user from an organization's GitHub account, their new contributions are no longer approved because they are no longer covered under a CLA. - + If a contribution is deemed to be covered by an existing CLA, then it is analyzed for engineering quality and product fit before merging it. - + If a contribution is not covered by the CLA, then the automated CLA system notifies the submitter politely that we cannot identify their CLA and ask them to sign either an individual or corporate CLA. This happens automatically as a comment on pull requests. - + When the project receives a new CLA, it is recorded in the project records, the CLA is added to the database for the automated system uses, then we manually make the Pull Request as having a CLA on-file. @@ -94,3 +94,22 @@ The other dependencies are updated manually using their distributables (be that source code or, in the case of libseccomp, the amended source code from their GitHub release). We have an RSS bot in Slack watching these releases so that we can respond to them quickly. + +## Re-generating mocks + +1. Install the `mockgen` utility +```bash +go install github.com/golang/mock/mockgen@v1.6.0 +``` + +2. For example, if you need to re-generate the runC lifecycle mocks, the +result is a concatenation of some commented license header with the result of +some `mockgen` invocation. This can be done as follows: +```bash +cd src +cat \ + <(sed -e 's|^|// |' -e 's/ $//' bpm/runc/lifecycle/mock_lifecycle/header.txt) \ + <(echo) \ + <(mockgen -source=bpm/runc/lifecycle/lifecycle.go) \ + > bpm/runc/lifecycle/mock_lifecycle/mocks.go +``` diff --git a/docs/config.md b/docs/config.md index 747eaef2..91bd097b 100644 --- a/docs/config.md +++ b/docs/config.md @@ -48,6 +48,7 @@ directory of your job. | `persistent_disk` | boolean | No | Whether or not an persistent disk should be mounted into the container at `/var/vcap/store/JOB`. | | `additional_volumes` | volume[] | No | A list of additional volumes to mount inside this process. The paths which can be used are restricted (see volume note below). | | `unsafe` | unsafe | No | The unsafe configuration for this process (see below). | +| `shutdown_signal` | string | No | The first signal to send to the process when trying to shut it down. Can be either `TERM` or `INT`. Defaults to `TERM`. | [capabilities]: http://man7.org/linux/man-pages/man7/capabilities.7.html diff --git a/src/bpm/commands/stop.go b/src/bpm/commands/stop.go index b2de9a24..77b5b06b 100644 --- a/src/bpm/commands/stop.go +++ b/src/bpm/commands/stop.go @@ -61,6 +61,18 @@ func stop(cmd *cobra.Command, _ []string) error { logger.Info("starting") defer logger.Info("complete") + jobCfg, err := bpmCfg.ParseJobConfig() + if err != nil { + logger.Error("failed-to-parse-config", err) + return fmt.Errorf("failed to parse job configuration: %s", err) + } + + procCfg, err := processByNameFromJobConfig(jobCfg, procName) + if err != nil { + logger.Error("process-not-defined", err) + return fmt.Errorf("process %q not present in job configuration (%s)", procName, bpmCfg.JobConfig()) + } + runcLifecycle, err := newRuncLifecycle() if err != nil { return err @@ -74,7 +86,7 @@ func stop(cmd *cobra.Command, _ []string) error { return fmt.Errorf("failed to get job-process status: %s", err) } - if err := runcLifecycle.StopProcess(logger, bpmCfg, DefaultStopTimeout); err != nil { + if err := runcLifecycle.StopProcess(logger, bpmCfg, procCfg, DefaultStopTimeout); err != nil { logger.Error("failed-to-stop", err) } diff --git a/src/bpm/config/job_config.go b/src/bpm/config/job_config.go index 9509f16b..35371328 100644 --- a/src/bpm/config/job_config.go +++ b/src/bpm/config/job_config.go @@ -25,6 +25,7 @@ import ( yaml "gopkg.in/yaml.v2" "bpm/bosh" + "bpm/runc/client" ) type JobConfig struct { @@ -44,6 +45,7 @@ type ProcessConfig struct { PersistentDisk bool `yaml:"persistent_disk"` WorkDir string `yaml:"workdir"` Unsafe *Unsafe `yaml:"unsafe"` + ShutdownSignal string `yaml:"shutdown_signal"` } type Limits struct { @@ -127,9 +129,24 @@ func (c *ProcessConfig) Validate(boshEnv *bosh.Env, defaultVolumes []string) err } } + if c.ShutdownSignal != "" && c.ShutdownSignal != "TERM" && c.ShutdownSignal != "INT" { + return fmt.Errorf( + "shutdown signal should either be 'TERM' or 'INT' (or left unspecified), but got '%s'", + c.ShutdownSignal) + } + return nil } +func (c *ProcessConfig) ParseShutdownSignal() client.Signal { + switch c.ShutdownSignal { + case "INT": + return client.Int + default: + return client.Term + } +} + func (c *ProcessConfig) AddVolumes( volumes []string, boshEnv *bosh.Env, diff --git a/src/bpm/integration/bash_test.go b/src/bpm/integration/bash_test.go index 069dc0e8..f1f0a33f 100644 --- a/src/bpm/integration/bash_test.go +++ b/src/bpm/integration/bash_test.go @@ -20,7 +20,8 @@ import ( ) func defaultBash(path string) string { - return fmt.Sprintf(`trap "echo 'Received a Signal' && kill -9 $child" SIGTERM; + return fmt.Sprintf(`trap "echo 'Received a TERM signal' && kill -9 $child" SIGTERM; +trap "echo 'Received an INT signal' && kill -9 $child" SIGINT; echo $LANG; echo "Logging to STDOUT"; echo "Logging to STDERR" 1>&2; diff --git a/src/bpm/integration/stop_test.go b/src/bpm/integration/stop_test.go index 08e5dab3..3e54969a 100644 --- a/src/bpm/integration/stop_test.go +++ b/src/bpm/integration/stop_test.go @@ -92,7 +92,7 @@ var _ = Describe("stop", func() { <-session.Exited Expect(session).To(gexec.Exit(0)) - Eventually(fileContents(stdout)).Should(ContainSubstring("Received a Signal")) + Eventually(fileContents(stdout)).Should(ContainSubstring("Received a TERM signal")) }) It("removes the pid file", func() { @@ -111,7 +111,8 @@ var _ = Describe("stop", func() { <-session.Exited Expect(session).To(gexec.Exit(0)) - Expect(runcCommand(runcRoot, "state", containerID).Run()).To(HaveOccurred()) + nonexistentContainerErr := runcCommand(runcRoot, "state", containerID).Run() + Expect(nonexistentContainerErr).To(HaveOccurred()) }) It("removes the bundle directory", func() { @@ -173,12 +174,12 @@ var _ = Describe("stop", func() { }) }) - Context("when the job-process doesn't not exist", func() { + Context("when the job-process doesn't not exist and has no config", func() { BeforeEach(func() { bpmLog = filepath.Join(boshRoot, "sys", "log", "non-existent", "bpm.log") }) - It("ignores that and is successful", func() { + It("complaints that the config cannot be found", func() { command := exec.Command(bpmPath, "stop", "non-existent") command.Env = append(command.Env, fmt.Sprintf("BPM_BOSH_ROOT=%s", boshRoot)) @@ -186,8 +187,24 @@ var _ = Describe("stop", func() { Expect(err).ShouldNot(HaveOccurred()) <-session.Exited + Expect(session).To(gexec.Exit(1)) + Expect(fileContents(bpmLog)()).To(ContainSubstring("failed-to-parse-config")) + Expect(fileContents(bpmLog)()).To(ContainSubstring("no such file or directory")) + }) + }) + + Context("when the shutdown signal is SIGINT", func() { + BeforeEach(func() { + cfg.Processes[0].ShutdownSignal = "INT" + }) + + It("signals the container with a SIGINT", func() { + session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter) + Expect(err).ToNot(HaveOccurred()) + <-session.Exited Expect(session).To(gexec.Exit(0)) - Expect(fileContents(bpmLog)()).To(ContainSubstring("job-already-stopped")) + + Eventually(fileContents(stdout)).Should(ContainSubstring("Received an INT signal")) }) }) }) diff --git a/src/bpm/runc/client/client.go b/src/bpm/runc/client/client.go index 38f69358..eb668568 100644 --- a/src/bpm/runc/client/client.go +++ b/src/bpm/runc/client/client.go @@ -33,6 +33,7 @@ type Signal int const ( Term Signal = iota Quit + Int ) func (s Signal) String() string { @@ -41,6 +42,8 @@ func (s Signal) String() string { return "TERM" case Quit: return "QUIT" + case Int: + return "INT" default: return "unknown" } diff --git a/src/bpm/runc/lifecycle/lifecycle.go b/src/bpm/runc/lifecycle/lifecycle.go index 5b5bf013..a430755d 100644 --- a/src/bpm/runc/lifecycle/lifecycle.go +++ b/src/bpm/runc/lifecycle/lifecycle.go @@ -231,8 +231,8 @@ func (j *RuncLifecycle) ListProcesses() ([]*models.Process, error) { return processes, nil } -func (j *RuncLifecycle) StopProcess(logger lager.Logger, cfg *config.BPMConfig, exitTimeout time.Duration) error { - err := j.runcClient.SignalContainer(cfg.ContainerID(), client.Term) +func (j *RuncLifecycle) StopProcess(logger lager.Logger, cfg *config.BPMConfig, procCfg *config.ProcessConfig, exitTimeout time.Duration) error { + err := j.runcClient.SignalContainer(cfg.ContainerID(), procCfg.ParseShutdownSignal()) if err != nil { return err } diff --git a/src/bpm/runc/lifecycle/lifecycle_test.go b/src/bpm/runc/lifecycle/lifecycle_test.go index 2a117d09..05889259 100644 --- a/src/bpm/runc/lifecycle/lifecycle_test.go +++ b/src/bpm/runc/lifecycle/lifecycle_test.go @@ -462,10 +462,34 @@ var _ = Describe("RuncJobLifecycle", func() { Times(1) setupMockDefaults() - err := runcLifecycle.StopProcess(logger, bpmCfg, exitTimeout) + err := runcLifecycle.StopProcess(logger, bpmCfg, procCfg, exitTimeout) Expect(err).ToNot(HaveOccurred()) }) + Context("when the shutdown signal is SIGINT", func() { + BeforeEach(func() { + procCfg.ShutdownSignal = "INT" + }) + + It("stops the container with an interrupt signal", func() { + fakeRuncClient. + EXPECT(). + ContainerState(expectedContainerID). + Return(&specs.State{ + Status: "stopped", + }, nil) + + fakeRuncClient. + EXPECT(). + SignalContainer(expectedContainerID, client.Int). + Times(1) + + setupMockDefaults() + err := runcLifecycle.StopProcess(logger, bpmCfg, procCfg, exitTimeout) + Expect(err).ToNot(HaveOccurred()) + }) + }) + Context("when the container does not stop immediately", func() { It("polls the container state every second until it stops", func() { gomock.InOrder( @@ -499,7 +523,7 @@ var _ = Describe("RuncJobLifecycle", func() { ) setupMockDefaults() - err := runcLifecycle.StopProcess(logger, bpmCfg, exitTimeout) + err := runcLifecycle.StopProcess(logger, bpmCfg, procCfg, exitTimeout) Expect(err).ToNot(HaveOccurred()) }) @@ -536,7 +560,7 @@ var _ = Describe("RuncJobLifecycle", func() { ) setupMockDefaults() - err := runcLifecycle.StopProcess(logger, bpmCfg, exitTimeout) + err := runcLifecycle.StopProcess(logger, bpmCfg, procCfg, exitTimeout) Expect(err).To(MatchError("failed to stop job within timeout")) }) }) @@ -575,7 +599,7 @@ var _ = Describe("RuncJobLifecycle", func() { ) setupMockDefaults() - err := runcLifecycle.StopProcess(logger, bpmCfg, exitTimeout) + err := runcLifecycle.StopProcess(logger, bpmCfg, procCfg, exitTimeout) Expect(err).To(MatchError("failed to stop job within timeout")) }) }) @@ -593,7 +617,7 @@ var _ = Describe("RuncJobLifecycle", func() { It("returns an error", func() { setupMockDefaults() - err := runcLifecycle.StopProcess(logger, bpmCfg, exitTimeout) + err := runcLifecycle.StopProcess(logger, bpmCfg, procCfg, exitTimeout) Expect(err).To(Equal(expectedErr)) }) }) diff --git a/src/bpm/runc/lifecycle/mock_lifecycle/mocks.go b/src/bpm/runc/lifecycle/mock_lifecycle/mocks.go index 730cba9d..1e6ae76e 100644 --- a/src/bpm/runc/lifecycle/mock_lifecycle/mocks.go +++ b/src/bpm/runc/lifecycle/mock_lifecycle/mocks.go @@ -12,10 +12,9 @@ // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. -// // Code generated by MockGen. DO NOT EDIT. -// Source: bpm/runc/lifecycle (interfaces: UserFinder,CommandRunner,RuncAdapter,RuncClient) +// Source: bpm/runc/lifecycle/lifecycle.go // Package mock_lifecycle is a generated GoMock package. package mock_lifecycle @@ -30,71 +29,71 @@ import ( lager "code.cloudfoundry.org/lager" gomock "github.com/golang/mock/gomock" - specs "github.com/opencontainers/runtime-spec/specs-go" + specs_go "github.com/opencontainers/runtime-spec/specs-go" ) -// MockUserFinder is a mock of UserFinder interface +// MockUserFinder is a mock of UserFinder interface. type MockUserFinder struct { ctrl *gomock.Controller recorder *MockUserFinderMockRecorder } -// MockUserFinderMockRecorder is the mock recorder for MockUserFinder +// MockUserFinderMockRecorder is the mock recorder for MockUserFinder. type MockUserFinderMockRecorder struct { mock *MockUserFinder } -// NewMockUserFinder creates a new mock instance +// NewMockUserFinder creates a new mock instance. func NewMockUserFinder(ctrl *gomock.Controller) *MockUserFinder { mock := &MockUserFinder{ctrl: ctrl} mock.recorder = &MockUserFinderMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockUserFinder) EXPECT() *MockUserFinderMockRecorder { return m.recorder } -// Lookup mocks base method -func (m *MockUserFinder) Lookup(arg0 string) (specs.User, error) { +// Lookup mocks base method. +func (m *MockUserFinder) Lookup(username string) (specs_go.User, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Lookup", arg0) - ret0, _ := ret[0].(specs.User) + ret := m.ctrl.Call(m, "Lookup", username) + ret0, _ := ret[0].(specs_go.User) ret1, _ := ret[1].(error) return ret0, ret1 } -// Lookup indicates an expected call of Lookup -func (mr *MockUserFinderMockRecorder) Lookup(arg0 interface{}) *gomock.Call { +// Lookup indicates an expected call of Lookup. +func (mr *MockUserFinderMockRecorder) Lookup(username interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lookup", reflect.TypeOf((*MockUserFinder)(nil).Lookup), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lookup", reflect.TypeOf((*MockUserFinder)(nil).Lookup), username) } -// MockCommandRunner is a mock of CommandRunner interface +// MockCommandRunner is a mock of CommandRunner interface. type MockCommandRunner struct { ctrl *gomock.Controller recorder *MockCommandRunnerMockRecorder } -// MockCommandRunnerMockRecorder is the mock recorder for MockCommandRunner +// MockCommandRunnerMockRecorder is the mock recorder for MockCommandRunner. type MockCommandRunnerMockRecorder struct { mock *MockCommandRunner } -// NewMockCommandRunner creates a new mock instance +// NewMockCommandRunner creates a new mock instance. func NewMockCommandRunner(ctrl *gomock.Controller) *MockCommandRunner { mock := &MockCommandRunner{ctrl: ctrl} mock.recorder = &MockCommandRunnerMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockCommandRunner) EXPECT() *MockCommandRunnerMockRecorder { return m.recorder } -// Run mocks base method +// Run mocks base method. func (m *MockCommandRunner) Run(arg0 *exec.Cmd) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Run", arg0) @@ -102,161 +101,161 @@ func (m *MockCommandRunner) Run(arg0 *exec.Cmd) error { return ret0 } -// Run indicates an expected call of Run +// Run indicates an expected call of Run. func (mr *MockCommandRunnerMockRecorder) Run(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockCommandRunner)(nil).Run), arg0) } -// MockRuncAdapter is a mock of RuncAdapter interface +// MockRuncAdapter is a mock of RuncAdapter interface. type MockRuncAdapter struct { ctrl *gomock.Controller recorder *MockRuncAdapterMockRecorder } -// MockRuncAdapterMockRecorder is the mock recorder for MockRuncAdapter +// MockRuncAdapterMockRecorder is the mock recorder for MockRuncAdapter. type MockRuncAdapterMockRecorder struct { mock *MockRuncAdapter } -// NewMockRuncAdapter creates a new mock instance +// NewMockRuncAdapter creates a new mock instance. func NewMockRuncAdapter(ctrl *gomock.Controller) *MockRuncAdapter { mock := &MockRuncAdapter{ctrl: ctrl} mock.recorder = &MockRuncAdapterMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRuncAdapter) EXPECT() *MockRuncAdapterMockRecorder { return m.recorder } -// BuildSpec mocks base method -func (m *MockRuncAdapter) BuildSpec(arg0 lager.Logger, arg1 *config.BPMConfig, arg2 *config.ProcessConfig, arg3 specs.User) (specs.Spec, error) { +// BuildSpec mocks base method. +func (m *MockRuncAdapter) BuildSpec(logger lager.Logger, bpmCfg *config.BPMConfig, procCfg *config.ProcessConfig, user specs_go.User) (specs_go.Spec, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BuildSpec", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(specs.Spec) + ret := m.ctrl.Call(m, "BuildSpec", logger, bpmCfg, procCfg, user) + ret0, _ := ret[0].(specs_go.Spec) ret1, _ := ret[1].(error) return ret0, ret1 } -// BuildSpec indicates an expected call of BuildSpec -func (mr *MockRuncAdapterMockRecorder) BuildSpec(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +// BuildSpec indicates an expected call of BuildSpec. +func (mr *MockRuncAdapterMockRecorder) BuildSpec(logger, bpmCfg, procCfg, user interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BuildSpec", reflect.TypeOf((*MockRuncAdapter)(nil).BuildSpec), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BuildSpec", reflect.TypeOf((*MockRuncAdapter)(nil).BuildSpec), logger, bpmCfg, procCfg, user) } -// CreateJobPrerequisites mocks base method -func (m *MockRuncAdapter) CreateJobPrerequisites(arg0 *config.BPMConfig, arg1 *config.ProcessConfig, arg2 specs.User) (*os.File, *os.File, error) { +// CreateJobPrerequisites mocks base method. +func (m *MockRuncAdapter) CreateJobPrerequisites(bpmCfg *config.BPMConfig, procCfg *config.ProcessConfig, user specs_go.User) (*os.File, *os.File, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateJobPrerequisites", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "CreateJobPrerequisites", bpmCfg, procCfg, user) ret0, _ := ret[0].(*os.File) ret1, _ := ret[1].(*os.File) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// CreateJobPrerequisites indicates an expected call of CreateJobPrerequisites -func (mr *MockRuncAdapterMockRecorder) CreateJobPrerequisites(arg0, arg1, arg2 interface{}) *gomock.Call { +// CreateJobPrerequisites indicates an expected call of CreateJobPrerequisites. +func (mr *MockRuncAdapterMockRecorder) CreateJobPrerequisites(bpmCfg, procCfg, user interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateJobPrerequisites", reflect.TypeOf((*MockRuncAdapter)(nil).CreateJobPrerequisites), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateJobPrerequisites", reflect.TypeOf((*MockRuncAdapter)(nil).CreateJobPrerequisites), bpmCfg, procCfg, user) } -// MockRuncClient is a mock of RuncClient interface +// MockRuncClient is a mock of RuncClient interface. type MockRuncClient struct { ctrl *gomock.Controller recorder *MockRuncClientMockRecorder } -// MockRuncClientMockRecorder is the mock recorder for MockRuncClient +// MockRuncClientMockRecorder is the mock recorder for MockRuncClient. type MockRuncClientMockRecorder struct { mock *MockRuncClient } -// NewMockRuncClient creates a new mock instance +// NewMockRuncClient creates a new mock instance. func NewMockRuncClient(ctrl *gomock.Controller) *MockRuncClient { mock := &MockRuncClient{ctrl: ctrl} mock.recorder = &MockRuncClientMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRuncClient) EXPECT() *MockRuncClientMockRecorder { return m.recorder } -// ContainerState mocks base method -func (m *MockRuncClient) ContainerState(arg0 string) (*specs.State, error) { +// ContainerState mocks base method. +func (m *MockRuncClient) ContainerState(containerID string) (*specs_go.State, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ContainerState", arg0) - ret0, _ := ret[0].(*specs.State) + ret := m.ctrl.Call(m, "ContainerState", containerID) + ret0, _ := ret[0].(*specs_go.State) ret1, _ := ret[1].(error) return ret0, ret1 } -// ContainerState indicates an expected call of ContainerState -func (mr *MockRuncClientMockRecorder) ContainerState(arg0 interface{}) *gomock.Call { +// ContainerState indicates an expected call of ContainerState. +func (mr *MockRuncClientMockRecorder) ContainerState(containerID interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerState", reflect.TypeOf((*MockRuncClient)(nil).ContainerState), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerState", reflect.TypeOf((*MockRuncClient)(nil).ContainerState), containerID) } -// CreateBundle mocks base method -func (m *MockRuncClient) CreateBundle(arg0 string, arg1 specs.Spec, arg2 specs.User) error { +// CreateBundle mocks base method. +func (m *MockRuncClient) CreateBundle(bundlePath string, jobSpec specs_go.Spec, user specs_go.User) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateBundle", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "CreateBundle", bundlePath, jobSpec, user) ret0, _ := ret[0].(error) return ret0 } -// CreateBundle indicates an expected call of CreateBundle -func (mr *MockRuncClientMockRecorder) CreateBundle(arg0, arg1, arg2 interface{}) *gomock.Call { +// CreateBundle indicates an expected call of CreateBundle. +func (mr *MockRuncClientMockRecorder) CreateBundle(bundlePath, jobSpec, user interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateBundle", reflect.TypeOf((*MockRuncClient)(nil).CreateBundle), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateBundle", reflect.TypeOf((*MockRuncClient)(nil).CreateBundle), bundlePath, jobSpec, user) } -// DeleteContainer mocks base method -func (m *MockRuncClient) DeleteContainer(arg0 string) error { +// DeleteContainer mocks base method. +func (m *MockRuncClient) DeleteContainer(containerID string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteContainer", arg0) + ret := m.ctrl.Call(m, "DeleteContainer", containerID) ret0, _ := ret[0].(error) return ret0 } -// DeleteContainer indicates an expected call of DeleteContainer -func (mr *MockRuncClientMockRecorder) DeleteContainer(arg0 interface{}) *gomock.Call { +// DeleteContainer indicates an expected call of DeleteContainer. +func (mr *MockRuncClientMockRecorder) DeleteContainer(containerID interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteContainer", reflect.TypeOf((*MockRuncClient)(nil).DeleteContainer), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteContainer", reflect.TypeOf((*MockRuncClient)(nil).DeleteContainer), containerID) } -// DestroyBundle mocks base method -func (m *MockRuncClient) DestroyBundle(arg0 string) error { +// DestroyBundle mocks base method. +func (m *MockRuncClient) DestroyBundle(bundlePath string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DestroyBundle", arg0) + ret := m.ctrl.Call(m, "DestroyBundle", bundlePath) ret0, _ := ret[0].(error) return ret0 } -// DestroyBundle indicates an expected call of DestroyBundle -func (mr *MockRuncClientMockRecorder) DestroyBundle(arg0 interface{}) *gomock.Call { +// DestroyBundle indicates an expected call of DestroyBundle. +func (mr *MockRuncClientMockRecorder) DestroyBundle(bundlePath interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DestroyBundle", reflect.TypeOf((*MockRuncClient)(nil).DestroyBundle), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DestroyBundle", reflect.TypeOf((*MockRuncClient)(nil).DestroyBundle), bundlePath) } -// Exec mocks base method -func (m *MockRuncClient) Exec(arg0, arg1 string, arg2 io.Reader, arg3, arg4 io.Writer) error { +// Exec mocks base method. +func (m *MockRuncClient) Exec(containerID, command string, stdin io.Reader, stdout, stderr io.Writer) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Exec", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "Exec", containerID, command, stdin, stdout, stderr) ret0, _ := ret[0].(error) return ret0 } -// Exec indicates an expected call of Exec -func (mr *MockRuncClientMockRecorder) Exec(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +// Exec indicates an expected call of Exec. +func (mr *MockRuncClientMockRecorder) Exec(containerID, command, stdin, stdout, stderr interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockRuncClient)(nil).Exec), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockRuncClient)(nil).Exec), containerID, command, stdin, stdout, stderr) } -// ListContainers mocks base method +// ListContainers mocks base method. func (m *MockRuncClient) ListContainers() ([]client.ContainerState, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListContainers") @@ -265,37 +264,37 @@ func (m *MockRuncClient) ListContainers() ([]client.ContainerState, error) { return ret0, ret1 } -// ListContainers indicates an expected call of ListContainers +// ListContainers indicates an expected call of ListContainers. func (mr *MockRuncClientMockRecorder) ListContainers() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListContainers", reflect.TypeOf((*MockRuncClient)(nil).ListContainers)) } -// RunContainer mocks base method -func (m *MockRuncClient) RunContainer(arg0, arg1, arg2 string, arg3 bool, arg4, arg5 io.Writer) (int, error) { +// RunContainer mocks base method. +func (m *MockRuncClient) RunContainer(pidFilePath, bundlePath, containerID string, detach bool, stdout, stderr io.Writer) (int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RunContainer", arg0, arg1, arg2, arg3, arg4, arg5) + ret := m.ctrl.Call(m, "RunContainer", pidFilePath, bundlePath, containerID, detach, stdout, stderr) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } -// RunContainer indicates an expected call of RunContainer -func (mr *MockRuncClientMockRecorder) RunContainer(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +// RunContainer indicates an expected call of RunContainer. +func (mr *MockRuncClientMockRecorder) RunContainer(pidFilePath, bundlePath, containerID, detach, stdout, stderr interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunContainer", reflect.TypeOf((*MockRuncClient)(nil).RunContainer), arg0, arg1, arg2, arg3, arg4, arg5) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunContainer", reflect.TypeOf((*MockRuncClient)(nil).RunContainer), pidFilePath, bundlePath, containerID, detach, stdout, stderr) } -// SignalContainer mocks base method -func (m *MockRuncClient) SignalContainer(arg0 string, arg1 client.Signal) error { +// SignalContainer mocks base method. +func (m *MockRuncClient) SignalContainer(containerID string, signal client.Signal) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SignalContainer", arg0, arg1) + ret := m.ctrl.Call(m, "SignalContainer", containerID, signal) ret0, _ := ret[0].(error) return ret0 } -// SignalContainer indicates an expected call of SignalContainer -func (mr *MockRuncClientMockRecorder) SignalContainer(arg0, arg1 interface{}) *gomock.Call { +// SignalContainer indicates an expected call of SignalContainer. +func (mr *MockRuncClientMockRecorder) SignalContainer(containerID, signal interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignalContainer", reflect.TypeOf((*MockRuncClient)(nil).SignalContainer), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignalContainer", reflect.TypeOf((*MockRuncClient)(nil).SignalContainer), containerID, signal) }