diff --git a/internal/model/os.go b/internal/model/os.go deleted file mode 100644 index b62ef8d8ab..0000000000 --- a/internal/model/os.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) F5, Inc. -// -// This source code is licensed under the Apache License, Version 2.0 license found in the -// LICENSE file in the root directory of this source tree. - -package model - -type Process struct { - Name string - Cmd string - Exe string - Status string - PID int32 - PPID int32 - Running bool -} diff --git a/internal/watcher/health/nginx_health_watcher_operator.go b/internal/watcher/health/nginx_health_watcher_operator.go index b97882959c..45afe31e75 100644 --- a/internal/watcher/health/nginx_health_watcher_operator.go +++ b/internal/watcher/health/nginx_health_watcher_operator.go @@ -7,15 +7,12 @@ package health import ( "context" - "errors" "fmt" - "strings" - - "github.com/shirou/gopsutil/v4/process" mpi "github.com/nginx/agent/v3/api/grpc/mpi/v1" "github.com/nginx/agent/v3/internal/datasource/host/exec" processwatcher "github.com/nginx/agent/v3/internal/watcher/process" + "github.com/nginx/agent/v3/pkg/nginxprocess" ) type NginxHealthWatcher struct { @@ -39,7 +36,7 @@ func (nhw *NginxHealthWatcher) Health(ctx context.Context, instance *mpi.Instanc } proc, err := nhw.processOperator.Process(ctx, instance.GetInstanceRuntime().GetProcessId()) - if errors.Is(err, process.ErrorProcessNotRunning) { + if nginxprocess.IsNotRunningErr(err) { health.Description = fmt.Sprintf("PID: %d is not running", instance.GetInstanceRuntime().GetProcessId()) health.InstanceHealthStatus = mpi.InstanceHealth_INSTANCE_HEALTH_STATUS_UNHEALTHY @@ -48,7 +45,7 @@ func (nhw *NginxHealthWatcher) Health(ctx context.Context, instance *mpi.Instanc return nil, err } - if strings.Contains(proc.Status, "zombie") || !proc.Running { + if !proc.IsHealthy() { health.Description = fmt.Sprintf("PID: %d is unhealthy, status: %s", proc.PID, proc.Status) health.InstanceHealthStatus = mpi.InstanceHealth_INSTANCE_HEALTH_STATUS_UNHEALTHY } diff --git a/internal/watcher/health/nginx_health_watcher_operator_test.go b/internal/watcher/health/nginx_health_watcher_operator_test.go index 68f5efde25..18b4936023 100644 --- a/internal/watcher/health/nginx_health_watcher_operator_test.go +++ b/internal/watcher/health/nginx_health_watcher_operator_test.go @@ -10,9 +10,11 @@ import ( "fmt" "testing" + "github.com/shirou/gopsutil/v4/process" + mpi "github.com/nginx/agent/v3/api/grpc/mpi/v1" - "github.com/nginx/agent/v3/internal/model" "github.com/nginx/agent/v3/internal/watcher/process/processfakes" + "github.com/nginx/agent/v3/pkg/nginxprocess" "github.com/nginx/agent/v3/test/protos" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -30,20 +32,19 @@ func TestNginxHealthWatcherOperator_Health(t *testing.T) { tests := []struct { expected *mpi.InstanceHealth instance *mpi.Instance - process *model.Process + process *nginxprocess.Process err error name string }{ { name: "Test 1: Healthy Instance", - process: &model.Process{ - PID: 123, - PPID: 456, - Name: "nginx", - Cmd: "nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off;", - Exe: "/usr/local/Cellar/nginx/1.25.3/bin/nginx", - Status: "running", - Running: true, + process: &nginxprocess.Process{ + PID: instance.GetInstanceRuntime().GetProcessId(), + PPID: 456, + Name: "nginx", + Cmd: "nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off;", + Exe: "/usr/local/Cellar/nginx/1.25.3/bin/nginx", + Status: "running", }, expected: &mpi.InstanceHealth{ InstanceId: instance.GetInstanceMeta().GetInstanceId(), @@ -54,38 +55,34 @@ func TestNginxHealthWatcherOperator_Health(t *testing.T) { }, { name: "Test 2: Unhealthy Instance, Not Running", - process: &model.Process{ - PID: 123, - PPID: 456, - Name: "nginx", - Cmd: "nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off;", - Exe: "/usr/local/Cellar/nginx/1.25.3/bin/nginx", - Status: "sleep", - Running: false, - }, expected: &mpi.InstanceHealth{ - InstanceId: instance.GetInstanceMeta().GetInstanceId(), - Description: fmt.Sprintf("PID: %d is unhealthy, status: %s", 123, "sleep"), + InstanceId: instance.GetInstanceMeta().GetInstanceId(), + Description: fmt.Sprintf( + "PID: %d is not running", + instance.GetInstanceRuntime().GetProcessId(), + ), InstanceHealthStatus: mpi.InstanceHealth_INSTANCE_HEALTH_STATUS_UNHEALTHY, }, - err: nil, + err: process.ErrorProcessNotRunning, instance: instance, }, { name: "Test 3: Degraded Instance, Not Children", - process: &model.Process{ - PID: 123, - PPID: 456, - Name: "nginx", - Cmd: "nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off;", - Exe: "/usr/local/Cellar/nginx/1.25.3/bin/nginx", - Status: "sleep", - Running: false, + process: &nginxprocess.Process{ + PID: instance.GetInstanceRuntime().GetProcessId(), + PPID: 456, + Name: "nginx", + Cmd: "nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off;", + Exe: "/usr/local/Cellar/nginx/1.25.3/bin/nginx", + Status: "zombie", }, expected: &mpi.InstanceHealth{ InstanceId: instance.GetInstanceMeta().GetInstanceId(), - Description: fmt.Sprintf("PID: %d is unhealthy, status: %s, instance "+ - "does not have enough children", 123, "sleep"), + Description: fmt.Sprintf( + "PID: %d is unhealthy, status: %s, instance does not have enough children", + instance.GetInstanceRuntime().GetProcessId(), + "zombie", + ), InstanceHealthStatus: mpi.InstanceHealth_INSTANCE_HEALTH_STATUS_DEGRADED, }, err: nil, diff --git a/internal/watcher/instance/instance_watcher_service.go b/internal/watcher/instance/instance_watcher_service.go index 523ad704a9..9c1f12ec68 100644 --- a/internal/watcher/instance/instance_watcher_service.go +++ b/internal/watcher/instance/instance_watcher_service.go @@ -19,6 +19,7 @@ import ( "github.com/nginx/agent/v3/internal/logger" "github.com/nginx/agent/v3/internal/model" "github.com/nginx/agent/v3/internal/watcher/process" + "github.com/nginx/agent/v3/pkg/nginxprocess" ) const defaultAgentPath = "/run/nginx-agent" @@ -31,7 +32,7 @@ const defaultAgentPath = "/run/nginx-agent" type ( processParser interface { - Parse(ctx context.Context, processes []*model.Process) map[string]*mpi.Instance + Parse(ctx context.Context, processes []*nginxprocess.Process) map[string]*mpi.Instance } nginxConfigParser interface { diff --git a/internal/watcher/instance/instance_watcher_service_test.go b/internal/watcher/instance/instance_watcher_service_test.go index f71ff3e988..470bb21512 100644 --- a/internal/watcher/instance/instance_watcher_service_test.go +++ b/internal/watcher/instance/instance_watcher_service_test.go @@ -28,7 +28,7 @@ func TestInstanceWatcherService_checkForUpdates(t *testing.T) { nginxConfigContext := testModel.GetConfigContext() fakeProcessWatcher := &processfakes.FakeProcessOperatorInterface{} - fakeProcessWatcher.ProcessesReturns([]*model.Process{}, nil) + fakeProcessWatcher.ProcessesReturns(nil, nil) fakeProcessParser := &instancefakes.FakeProcessParser{} fakeProcessParser.ParseReturns(map[string]*mpi.Instance{ @@ -131,7 +131,7 @@ func TestInstanceWatcherService_instanceUpdates(t *testing.T) { for _, test := range tests { t.Run(test.name, func(tt *testing.T) { fakeProcessWatcher := &processfakes.FakeProcessOperatorInterface{} - fakeProcessWatcher.ProcessesReturns([]*model.Process{}, nil) + fakeProcessWatcher.ProcessesReturns(nil, nil) fakeProcessParser := &instancefakes.FakeProcessParser{} fakeProcessParser.ParseReturns(test.parsedInstances) diff --git a/internal/watcher/instance/instancefakes/fake_process_parser.go b/internal/watcher/instance/instancefakes/fake_process_parser.go index 8c163b1600..7c74a13e4f 100644 --- a/internal/watcher/instance/instancefakes/fake_process_parser.go +++ b/internal/watcher/instance/instancefakes/fake_process_parser.go @@ -6,15 +6,15 @@ import ( "sync" v1 "github.com/nginx/agent/v3/api/grpc/mpi/v1" - "github.com/nginx/agent/v3/internal/model" + "github.com/nginx/agent/v3/pkg/nginxprocess" ) type FakeProcessParser struct { - ParseStub func(context.Context, []*model.Process) map[string]*v1.Instance + ParseStub func(context.Context, []*nginxprocess.Process) map[string]*v1.Instance parseMutex sync.RWMutex parseArgsForCall []struct { arg1 context.Context - arg2 []*model.Process + arg2 []*nginxprocess.Process } parseReturns struct { result1 map[string]*v1.Instance @@ -26,17 +26,17 @@ type FakeProcessParser struct { invocationsMutex sync.RWMutex } -func (fake *FakeProcessParser) Parse(arg1 context.Context, arg2 []*model.Process) map[string]*v1.Instance { - var arg2Copy []*model.Process +func (fake *FakeProcessParser) Parse(arg1 context.Context, arg2 []*nginxprocess.Process) map[string]*v1.Instance { + var arg2Copy []*nginxprocess.Process if arg2 != nil { - arg2Copy = make([]*model.Process, len(arg2)) + arg2Copy = make([]*nginxprocess.Process, len(arg2)) copy(arg2Copy, arg2) } fake.parseMutex.Lock() ret, specificReturn := fake.parseReturnsOnCall[len(fake.parseArgsForCall)] fake.parseArgsForCall = append(fake.parseArgsForCall, struct { arg1 context.Context - arg2 []*model.Process + arg2 []*nginxprocess.Process }{arg1, arg2Copy}) stub := fake.ParseStub fakeReturns := fake.parseReturns @@ -57,13 +57,13 @@ func (fake *FakeProcessParser) ParseCallCount() int { return len(fake.parseArgsForCall) } -func (fake *FakeProcessParser) ParseCalls(stub func(context.Context, []*model.Process) map[string]*v1.Instance) { +func (fake *FakeProcessParser) ParseCalls(stub func(context.Context, []*nginxprocess.Process) map[string]*v1.Instance) { fake.parseMutex.Lock() defer fake.parseMutex.Unlock() fake.ParseStub = stub } -func (fake *FakeProcessParser) ParseArgsForCall(i int) (context.Context, []*model.Process) { +func (fake *FakeProcessParser) ParseArgsForCall(i int) (context.Context, []*nginxprocess.Process) { fake.parseMutex.RLock() defer fake.parseMutex.RUnlock() argsForCall := fake.parseArgsForCall[i] diff --git a/internal/watcher/instance/nginx_process_parser.go b/internal/watcher/instance/nginx_process_parser.go index 7ad875af12..72bea842fe 100644 --- a/internal/watcher/instance/nginx_process_parser.go +++ b/internal/watcher/instance/nginx_process_parser.go @@ -19,7 +19,7 @@ import ( mpi "github.com/nginx/agent/v3/api/grpc/mpi/v1" "github.com/nginx/agent/v3/internal/datasource/host/exec" - "github.com/nginx/agent/v3/internal/model" + "github.com/nginx/agent/v3/pkg/nginxprocess" "github.com/nginx/agent/v3/pkg/uuid" ) @@ -62,15 +62,15 @@ func NewNginxProcessParser() *NginxProcessParser { // cognitive complexity of 16 because of the if statements in the for loop // don't think can be avoided due to the need for continue // nolint: revive -func (npp *NginxProcessParser) Parse(ctx context.Context, processes []*model.Process) map[string]*mpi.Instance { +func (npp *NginxProcessParser) Parse(ctx context.Context, processes []*nginxprocess.Process) map[string]*mpi.Instance { instanceMap := make(map[string]*mpi.Instance) // key is instanceID workers := make(map[int32][]*mpi.InstanceChild) // key is ppid of process - nginxProcesses := filterNginxProcesses(processes) + nginxProcesses := convertToMap(processes) for _, nginxProcess := range nginxProcesses { // Here we are determining if the nginxProcess is a worker process - if strings.Contains(nginxProcess.Cmd, "worker") { + if nginxProcess.IsWorker() { // Here we are determining if the worker process has a master if masterProcess, ok := nginxProcesses[nginxProcess.PPID]; ok { workers[masterProcess.PID] = append(workers[masterProcess.PID], @@ -125,7 +125,7 @@ func (npp *NginxProcessParser) Parse(ctx context.Context, processes []*model.Pro return instanceMap } -func (npp *NginxProcessParser) getInfo(ctx context.Context, nginxProcess *model.Process) (*Info, error) { +func (npp *NginxProcessParser) getInfo(ctx context.Context, nginxProcess *nginxprocess.Process) (*Info, error) { exePath := nginxProcess.Exe if exePath == "" { @@ -382,18 +382,12 @@ func readDirectory(dir, extension string) (files []string, err error) { return files, err } -func filterNginxProcesses(processes []*model.Process) map[int32]*model.Process { - nginxProcesses := make(map[int32]*model.Process) +func convertToMap(processes []*nginxprocess.Process) map[int32]*nginxprocess.Process { + nginxProcesses := make(map[int32]*nginxprocess.Process) for _, p := range processes { - if isNginxProcess(p.Name, p.Cmd) { - nginxProcesses[p.PID] = p - } + nginxProcesses[p.PID] = p } return nginxProcesses } - -func isNginxProcess(name, cmd string) bool { - return name == "nginx" && !strings.Contains(cmd, "upgrade") && strings.HasPrefix(cmd, "nginx:") -} diff --git a/internal/watcher/instance/nginx_process_parser_test.go b/internal/watcher/instance/nginx_process_parser_test.go index b7d79fe2a2..fb46a9cfa7 100644 --- a/internal/watcher/instance/nginx_process_parser_test.go +++ b/internal/watcher/instance/nginx_process_parser_test.go @@ -18,7 +18,7 @@ import ( mpi "github.com/nginx/agent/v3/api/grpc/mpi/v1" "github.com/nginx/agent/v3/internal/datasource/host/exec/execfakes" - "github.com/nginx/agent/v3/internal/model" + "github.com/nginx/agent/v3/pkg/nginxprocess" "github.com/nginx/agent/v3/test/helpers" "github.com/nginx/agent/v3/test/protos" "github.com/stretchr/testify/assert" @@ -93,7 +93,7 @@ func TestNginxProcessParser_Parse(t *testing.T) { noModuleArgs := fmt.Sprintf(ossConfigArgs, noModulesPath) expectedModules := strings.ReplaceAll(filepath.Base(testModule.Name()), ".so", "") - processes := []*model.Process{ + processes := []*nginxprocess.Process{ { PID: 789, PPID: 1234, @@ -228,11 +228,11 @@ func TestNginxProcessParser_Parse_Processes(t *testing.T) { tests := []struct { expected map[string]*mpi.Instance name string - processes []*model.Process + processes []*nginxprocess.Process }{ { name: "Test 1: 1 master process, 2 workers", - processes: []*model.Process{ + processes: []*nginxprocess.Process{ { PID: 567, PPID: 1234, @@ -259,7 +259,7 @@ func TestNginxProcessParser_Parse_Processes(t *testing.T) { }, { name: "Test 2: 1 master process, no workers", - processes: []*model.Process{ + processes: []*nginxprocess.Process{ { PID: 1234, PPID: 1, @@ -272,7 +272,7 @@ func TestNginxProcessParser_Parse_Processes(t *testing.T) { }, { name: "Test 3: no master process, 2 workers for each killed master", - processes: []*model.Process{ + processes: []*nginxprocess.Process{ { PID: 789, PPID: 1234, @@ -306,7 +306,7 @@ func TestNginxProcessParser_Parse_Processes(t *testing.T) { }, { name: "Test 4: 2 master process each with 2 workers", - processes: []*model.Process{ + processes: []*nginxprocess.Process{ { PID: 789, PPID: 1234, @@ -400,7 +400,7 @@ func TestGetInfo(t *testing.T) { expectedModules := strings.ReplaceAll(filepath.Base(testModule.Name()), ".so", "") tests := []struct { - process *model.Process + process *nginxprocess.Process expected *Info name string nginxVersionCommandOutput string @@ -413,14 +413,16 @@ func TestGetInfo(t *testing.T) { built with OpenSSL 3.1.3 19 Sep 2023 (running with OpenSSL 3.2.0 23 Nov 2023) TLS SNI support enabled configure arguments: %s`, ossArgs), - process: &model.Process{ + process: &nginxprocess.Process{ + PID: 1123, Exe: exePath, }, expected: &Info{ - Version: "1.25.3", - Prefix: "/usr/local/Cellar/nginx/1.25.3", - ConfPath: "/usr/local/etc/nginx/nginx.conf", - ExePath: exePath, + ProcessID: 1123, + Version: "1.25.3", + Prefix: "/usr/local/Cellar/nginx/1.25.3", + ConfPath: "/usr/local/etc/nginx/nginx.conf", + ExePath: exePath, ConfigureArgs: map[string]interface{}{ "conf-path": "/usr/local/etc/nginx/nginx.conf", "error-log-path": "/usr/local/var/log/nginx/error.log", @@ -479,14 +481,16 @@ func TestGetInfo(t *testing.T) { built with OpenSSL 1.1.1f 31 Mar 2020 TLS SNI support enabled configure arguments: %s`, plusArgs), - process: &model.Process{ + process: &nginxprocess.Process{ + PID: 3141, Exe: exePath, }, expected: &Info{ - Version: "1.25.3 (nginx-plus-r31-p1)", - Prefix: "/etc/nginx", - ConfPath: "/etc/nginx/nginx.conf", - ExePath: exePath, + ProcessID: 3141, + Version: "1.25.3 (nginx-plus-r31-p1)", + Prefix: "/etc/nginx", + ConfPath: "/etc/nginx/nginx.conf", + ExePath: exePath, ConfigureArgs: map[string]interface{}{ "build": "nginx-plus-r31-p1", "conf-path": "/etc/nginx/nginx.conf", diff --git a/internal/watcher/process/process_operator.go b/internal/watcher/process/process_operator.go index 510b08ebb0..907a814e4b 100644 --- a/internal/watcher/process/process_operator.go +++ b/internal/watcher/process/process_operator.go @@ -7,21 +7,19 @@ package process import ( "context" - "fmt" - "strings" - "github.com/nginx/agent/v3/internal/model" - "github.com/shirou/gopsutil/v4/process" + "github.com/nginx/agent/v3/pkg/nginxprocess" ) //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6@v6.8.1 -generate //counterfeiter:generate . ProcessOperatorInterface type ( + // ProcessOperator provides details about running NGINX processes. ProcessOperator struct{} ProcessOperatorInterface interface { - Processes(ctx context.Context) ([]*model.Process, error) - Process(ctx context.Context, PID int32) (*model.Process, error) + Processes(ctx context.Context) ([]*nginxprocess.Process, error) + Process(ctx context.Context, pid int32) (*nginxprocess.Process, error) } ) @@ -31,59 +29,10 @@ func NewProcessOperator() *ProcessOperator { return &ProcessOperator{} } -func (pw *ProcessOperator) Processes(ctx context.Context) ([]*model.Process, error) { - processes, err := process.Processes() - if err != nil { - return nil, err - } - - internalProcesses := []*model.Process{} - - for _, proc := range processes { - ppid, _ := proc.PpidWithContext(ctx) - name, _ := proc.NameWithContext(ctx) - cmd, _ := proc.CmdlineWithContext(ctx) - exe, _ := proc.ExeWithContext(ctx) - status, _ := proc.StatusWithContext(ctx) - running, _ := proc.IsRunningWithContext(ctx) - - internalProcesses = append(internalProcesses, &model.Process{ - PID: proc.Pid, - PPID: ppid, - Name: name, - Cmd: cmd, - Exe: exe, - Status: strings.Join(status, " "), - Running: running, - }) - } - - return internalProcesses, nil +func (pw *ProcessOperator) Processes(ctx context.Context) ([]*nginxprocess.Process, error) { + return nginxprocess.List(ctx) } -func (pw *ProcessOperator) Process(ctx context.Context, pid int32) (*model.Process, error) { - newProc, err := process.NewProcessWithContext(ctx, pid) - status, _ := newProc.StatusWithContext(ctx) - running, _ := newProc.IsRunningWithContext(ctx) - ppid, _ := newProc.PpidWithContext(ctx) - name, _ := newProc.NameWithContext(ctx) - cmd, _ := newProc.CmdlineWithContext(ctx) - exe, _ := newProc.ExeWithContext(ctx) - - if err != nil { - return nil, fmt.Errorf("unable to create process with pid: %d, error : %w", - pid, err) - } - - proc := &model.Process{ - PID: newProc.Pid, - PPID: ppid, - Name: name, - Cmd: cmd, - Exe: exe, - Status: strings.Join(status, " "), - Running: running, - } - - return proc, nil +func (pw *ProcessOperator) Process(ctx context.Context, pid int32) (*nginxprocess.Process, error) { + return nginxprocess.Find(ctx, pid, nginxprocess.WithStatus(true)) } diff --git a/internal/watcher/process/processfakes/fake_process_operator_interface.go b/internal/watcher/process/processfakes/fake_process_operator_interface.go index 475ac8dcb0..82fd7c96af 100644 --- a/internal/watcher/process/processfakes/fake_process_operator_interface.go +++ b/internal/watcher/process/processfakes/fake_process_operator_interface.go @@ -5,43 +5,43 @@ import ( "context" "sync" - "github.com/nginx/agent/v3/internal/model" "github.com/nginx/agent/v3/internal/watcher/process" + "github.com/nginx/agent/v3/pkg/nginxprocess" ) type FakeProcessOperatorInterface struct { - ProcessStub func(context.Context, int32) (*model.Process, error) + ProcessStub func(context.Context, int32) (*nginxprocess.Process, error) processMutex sync.RWMutex processArgsForCall []struct { arg1 context.Context arg2 int32 } processReturns struct { - result1 *model.Process + result1 *nginxprocess.Process result2 error } processReturnsOnCall map[int]struct { - result1 *model.Process + result1 *nginxprocess.Process result2 error } - ProcessesStub func(context.Context) ([]*model.Process, error) + ProcessesStub func(context.Context) ([]*nginxprocess.Process, error) processesMutex sync.RWMutex processesArgsForCall []struct { arg1 context.Context } processesReturns struct { - result1 []*model.Process + result1 []*nginxprocess.Process result2 error } processesReturnsOnCall map[int]struct { - result1 []*model.Process + result1 []*nginxprocess.Process result2 error } invocations map[string][][]interface{} invocationsMutex sync.RWMutex } -func (fake *FakeProcessOperatorInterface) Process(arg1 context.Context, arg2 int32) (*model.Process, error) { +func (fake *FakeProcessOperatorInterface) Process(arg1 context.Context, arg2 int32) (*nginxprocess.Process, error) { fake.processMutex.Lock() ret, specificReturn := fake.processReturnsOnCall[len(fake.processArgsForCall)] fake.processArgsForCall = append(fake.processArgsForCall, struct { @@ -67,7 +67,7 @@ func (fake *FakeProcessOperatorInterface) ProcessCallCount() int { return len(fake.processArgsForCall) } -func (fake *FakeProcessOperatorInterface) ProcessCalls(stub func(context.Context, int32) (*model.Process, error)) { +func (fake *FakeProcessOperatorInterface) ProcessCalls(stub func(context.Context, int32) (*nginxprocess.Process, error)) { fake.processMutex.Lock() defer fake.processMutex.Unlock() fake.ProcessStub = stub @@ -80,33 +80,33 @@ func (fake *FakeProcessOperatorInterface) ProcessArgsForCall(i int) (context.Con return argsForCall.arg1, argsForCall.arg2 } -func (fake *FakeProcessOperatorInterface) ProcessReturns(result1 *model.Process, result2 error) { +func (fake *FakeProcessOperatorInterface) ProcessReturns(result1 *nginxprocess.Process, result2 error) { fake.processMutex.Lock() defer fake.processMutex.Unlock() fake.ProcessStub = nil fake.processReturns = struct { - result1 *model.Process + result1 *nginxprocess.Process result2 error }{result1, result2} } -func (fake *FakeProcessOperatorInterface) ProcessReturnsOnCall(i int, result1 *model.Process, result2 error) { +func (fake *FakeProcessOperatorInterface) ProcessReturnsOnCall(i int, result1 *nginxprocess.Process, result2 error) { fake.processMutex.Lock() defer fake.processMutex.Unlock() fake.ProcessStub = nil if fake.processReturnsOnCall == nil { fake.processReturnsOnCall = make(map[int]struct { - result1 *model.Process + result1 *nginxprocess.Process result2 error }) } fake.processReturnsOnCall[i] = struct { - result1 *model.Process + result1 *nginxprocess.Process result2 error }{result1, result2} } -func (fake *FakeProcessOperatorInterface) Processes(arg1 context.Context) ([]*model.Process, error) { +func (fake *FakeProcessOperatorInterface) Processes(arg1 context.Context) ([]*nginxprocess.Process, error) { fake.processesMutex.Lock() ret, specificReturn := fake.processesReturnsOnCall[len(fake.processesArgsForCall)] fake.processesArgsForCall = append(fake.processesArgsForCall, struct { @@ -131,7 +131,7 @@ func (fake *FakeProcessOperatorInterface) ProcessesCallCount() int { return len(fake.processesArgsForCall) } -func (fake *FakeProcessOperatorInterface) ProcessesCalls(stub func(context.Context) ([]*model.Process, error)) { +func (fake *FakeProcessOperatorInterface) ProcessesCalls(stub func(context.Context) ([]*nginxprocess.Process, error)) { fake.processesMutex.Lock() defer fake.processesMutex.Unlock() fake.ProcessesStub = stub @@ -144,28 +144,28 @@ func (fake *FakeProcessOperatorInterface) ProcessesArgsForCall(i int) context.Co return argsForCall.arg1 } -func (fake *FakeProcessOperatorInterface) ProcessesReturns(result1 []*model.Process, result2 error) { +func (fake *FakeProcessOperatorInterface) ProcessesReturns(result1 []*nginxprocess.Process, result2 error) { fake.processesMutex.Lock() defer fake.processesMutex.Unlock() fake.ProcessesStub = nil fake.processesReturns = struct { - result1 []*model.Process + result1 []*nginxprocess.Process result2 error }{result1, result2} } -func (fake *FakeProcessOperatorInterface) ProcessesReturnsOnCall(i int, result1 []*model.Process, result2 error) { +func (fake *FakeProcessOperatorInterface) ProcessesReturnsOnCall(i int, result1 []*nginxprocess.Process, result2 error) { fake.processesMutex.Lock() defer fake.processesMutex.Unlock() fake.ProcessesStub = nil if fake.processesReturnsOnCall == nil { fake.processesReturnsOnCall = make(map[int]struct { - result1 []*model.Process + result1 []*nginxprocess.Process result2 error }) } fake.processesReturnsOnCall[i] = struct { - result1 []*model.Process + result1 []*nginxprocess.Process result2 error }{result1, result2} }