github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/resource/plugins/mocks/Plugin.go (about)

     1  // Code generated by mockery v2.31.4. DO NOT EDIT.
     2  
     3  package mocks
     4  
     5  import (
     6  	context "context"
     7  
     8  	enginetypes "github.com/projecteru2/core/engine/types"
     9  	mock "github.com/stretchr/testify/mock"
    10  
    11  	pluginstypes "github.com/projecteru2/core/resource/plugins/types"
    12  
    13  	types "github.com/projecteru2/core/resource/types"
    14  )
    15  
    16  // Plugin is an autogenerated mock type for the Plugin type
    17  type Plugin struct {
    18  	mock.Mock
    19  }
    20  
    21  // AddNode provides a mock function with given fields: ctx, nodename, resource, info
    22  func (_m *Plugin) AddNode(ctx context.Context, nodename string, resource types.RawParams, info *enginetypes.Info) (*pluginstypes.AddNodeResponse, error) {
    23  	ret := _m.Called(ctx, nodename, resource, info)
    24  
    25  	var r0 *pluginstypes.AddNodeResponse
    26  	var r1 error
    27  	if rf, ok := ret.Get(0).(func(context.Context, string, types.RawParams, *enginetypes.Info) (*pluginstypes.AddNodeResponse, error)); ok {
    28  		return rf(ctx, nodename, resource, info)
    29  	}
    30  	if rf, ok := ret.Get(0).(func(context.Context, string, types.RawParams, *enginetypes.Info) *pluginstypes.AddNodeResponse); ok {
    31  		r0 = rf(ctx, nodename, resource, info)
    32  	} else {
    33  		if ret.Get(0) != nil {
    34  			r0 = ret.Get(0).(*pluginstypes.AddNodeResponse)
    35  		}
    36  	}
    37  
    38  	if rf, ok := ret.Get(1).(func(context.Context, string, types.RawParams, *enginetypes.Info) error); ok {
    39  		r1 = rf(ctx, nodename, resource, info)
    40  	} else {
    41  		r1 = ret.Error(1)
    42  	}
    43  
    44  	return r0, r1
    45  }
    46  
    47  // CalculateDeploy provides a mock function with given fields: ctx, nodename, deployCount, resourceRequest
    48  func (_m *Plugin) CalculateDeploy(ctx context.Context, nodename string, deployCount int, resourceRequest types.RawParams) (*pluginstypes.CalculateDeployResponse, error) {
    49  	ret := _m.Called(ctx, nodename, deployCount, resourceRequest)
    50  
    51  	var r0 *pluginstypes.CalculateDeployResponse
    52  	var r1 error
    53  	if rf, ok := ret.Get(0).(func(context.Context, string, int, types.RawParams) (*pluginstypes.CalculateDeployResponse, error)); ok {
    54  		return rf(ctx, nodename, deployCount, resourceRequest)
    55  	}
    56  	if rf, ok := ret.Get(0).(func(context.Context, string, int, types.RawParams) *pluginstypes.CalculateDeployResponse); ok {
    57  		r0 = rf(ctx, nodename, deployCount, resourceRequest)
    58  	} else {
    59  		if ret.Get(0) != nil {
    60  			r0 = ret.Get(0).(*pluginstypes.CalculateDeployResponse)
    61  		}
    62  	}
    63  
    64  	if rf, ok := ret.Get(1).(func(context.Context, string, int, types.RawParams) error); ok {
    65  		r1 = rf(ctx, nodename, deployCount, resourceRequest)
    66  	} else {
    67  		r1 = ret.Error(1)
    68  	}
    69  
    70  	return r0, r1
    71  }
    72  
    73  // CalculateRealloc provides a mock function with given fields: ctx, nodename, resource, resourceRequest
    74  func (_m *Plugin) CalculateRealloc(ctx context.Context, nodename string, resource types.RawParams, resourceRequest types.RawParams) (*pluginstypes.CalculateReallocResponse, error) {
    75  	ret := _m.Called(ctx, nodename, resource, resourceRequest)
    76  
    77  	var r0 *pluginstypes.CalculateReallocResponse
    78  	var r1 error
    79  	if rf, ok := ret.Get(0).(func(context.Context, string, types.RawParams, types.RawParams) (*pluginstypes.CalculateReallocResponse, error)); ok {
    80  		return rf(ctx, nodename, resource, resourceRequest)
    81  	}
    82  	if rf, ok := ret.Get(0).(func(context.Context, string, types.RawParams, types.RawParams) *pluginstypes.CalculateReallocResponse); ok {
    83  		r0 = rf(ctx, nodename, resource, resourceRequest)
    84  	} else {
    85  		if ret.Get(0) != nil {
    86  			r0 = ret.Get(0).(*pluginstypes.CalculateReallocResponse)
    87  		}
    88  	}
    89  
    90  	if rf, ok := ret.Get(1).(func(context.Context, string, types.RawParams, types.RawParams) error); ok {
    91  		r1 = rf(ctx, nodename, resource, resourceRequest)
    92  	} else {
    93  		r1 = ret.Error(1)
    94  	}
    95  
    96  	return r0, r1
    97  }
    98  
    99  // CalculateRemap provides a mock function with given fields: ctx, nodename, workloadsResource
   100  func (_m *Plugin) CalculateRemap(ctx context.Context, nodename string, workloadsResource map[string]types.RawParams) (*pluginstypes.CalculateRemapResponse, error) {
   101  	ret := _m.Called(ctx, nodename, workloadsResource)
   102  
   103  	var r0 *pluginstypes.CalculateRemapResponse
   104  	var r1 error
   105  	if rf, ok := ret.Get(0).(func(context.Context, string, map[string]types.RawParams) (*pluginstypes.CalculateRemapResponse, error)); ok {
   106  		return rf(ctx, nodename, workloadsResource)
   107  	}
   108  	if rf, ok := ret.Get(0).(func(context.Context, string, map[string]types.RawParams) *pluginstypes.CalculateRemapResponse); ok {
   109  		r0 = rf(ctx, nodename, workloadsResource)
   110  	} else {
   111  		if ret.Get(0) != nil {
   112  			r0 = ret.Get(0).(*pluginstypes.CalculateRemapResponse)
   113  		}
   114  	}
   115  
   116  	if rf, ok := ret.Get(1).(func(context.Context, string, map[string]types.RawParams) error); ok {
   117  		r1 = rf(ctx, nodename, workloadsResource)
   118  	} else {
   119  		r1 = ret.Error(1)
   120  	}
   121  
   122  	return r0, r1
   123  }
   124  
   125  // FixNodeResource provides a mock function with given fields: ctx, nodename, workloadsResource
   126  func (_m *Plugin) FixNodeResource(ctx context.Context, nodename string, workloadsResource []types.RawParams) (*pluginstypes.GetNodeResourceInfoResponse, error) {
   127  	ret := _m.Called(ctx, nodename, workloadsResource)
   128  
   129  	var r0 *pluginstypes.GetNodeResourceInfoResponse
   130  	var r1 error
   131  	if rf, ok := ret.Get(0).(func(context.Context, string, []types.RawParams) (*pluginstypes.GetNodeResourceInfoResponse, error)); ok {
   132  		return rf(ctx, nodename, workloadsResource)
   133  	}
   134  	if rf, ok := ret.Get(0).(func(context.Context, string, []types.RawParams) *pluginstypes.GetNodeResourceInfoResponse); ok {
   135  		r0 = rf(ctx, nodename, workloadsResource)
   136  	} else {
   137  		if ret.Get(0) != nil {
   138  			r0 = ret.Get(0).(*pluginstypes.GetNodeResourceInfoResponse)
   139  		}
   140  	}
   141  
   142  	if rf, ok := ret.Get(1).(func(context.Context, string, []types.RawParams) error); ok {
   143  		r1 = rf(ctx, nodename, workloadsResource)
   144  	} else {
   145  		r1 = ret.Error(1)
   146  	}
   147  
   148  	return r0, r1
   149  }
   150  
   151  // GetMetrics provides a mock function with given fields: ctx, podname, nodename
   152  func (_m *Plugin) GetMetrics(ctx context.Context, podname string, nodename string) (*pluginstypes.GetMetricsResponse, error) {
   153  	ret := _m.Called(ctx, podname, nodename)
   154  
   155  	var r0 *pluginstypes.GetMetricsResponse
   156  	var r1 error
   157  	if rf, ok := ret.Get(0).(func(context.Context, string, string) (*pluginstypes.GetMetricsResponse, error)); ok {
   158  		return rf(ctx, podname, nodename)
   159  	}
   160  	if rf, ok := ret.Get(0).(func(context.Context, string, string) *pluginstypes.GetMetricsResponse); ok {
   161  		r0 = rf(ctx, podname, nodename)
   162  	} else {
   163  		if ret.Get(0) != nil {
   164  			r0 = ret.Get(0).(*pluginstypes.GetMetricsResponse)
   165  		}
   166  	}
   167  
   168  	if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
   169  		r1 = rf(ctx, podname, nodename)
   170  	} else {
   171  		r1 = ret.Error(1)
   172  	}
   173  
   174  	return r0, r1
   175  }
   176  
   177  // GetMetricsDescription provides a mock function with given fields: ctx
   178  func (_m *Plugin) GetMetricsDescription(ctx context.Context) (*pluginstypes.GetMetricsDescriptionResponse, error) {
   179  	ret := _m.Called(ctx)
   180  
   181  	var r0 *pluginstypes.GetMetricsDescriptionResponse
   182  	var r1 error
   183  	if rf, ok := ret.Get(0).(func(context.Context) (*pluginstypes.GetMetricsDescriptionResponse, error)); ok {
   184  		return rf(ctx)
   185  	}
   186  	if rf, ok := ret.Get(0).(func(context.Context) *pluginstypes.GetMetricsDescriptionResponse); ok {
   187  		r0 = rf(ctx)
   188  	} else {
   189  		if ret.Get(0) != nil {
   190  			r0 = ret.Get(0).(*pluginstypes.GetMetricsDescriptionResponse)
   191  		}
   192  	}
   193  
   194  	if rf, ok := ret.Get(1).(func(context.Context) error); ok {
   195  		r1 = rf(ctx)
   196  	} else {
   197  		r1 = ret.Error(1)
   198  	}
   199  
   200  	return r0, r1
   201  }
   202  
   203  // GetMostIdleNode provides a mock function with given fields: ctx, nodenames
   204  func (_m *Plugin) GetMostIdleNode(ctx context.Context, nodenames []string) (*pluginstypes.GetMostIdleNodeResponse, error) {
   205  	ret := _m.Called(ctx, nodenames)
   206  
   207  	var r0 *pluginstypes.GetMostIdleNodeResponse
   208  	var r1 error
   209  	if rf, ok := ret.Get(0).(func(context.Context, []string) (*pluginstypes.GetMostIdleNodeResponse, error)); ok {
   210  		return rf(ctx, nodenames)
   211  	}
   212  	if rf, ok := ret.Get(0).(func(context.Context, []string) *pluginstypes.GetMostIdleNodeResponse); ok {
   213  		r0 = rf(ctx, nodenames)
   214  	} else {
   215  		if ret.Get(0) != nil {
   216  			r0 = ret.Get(0).(*pluginstypes.GetMostIdleNodeResponse)
   217  		}
   218  	}
   219  
   220  	if rf, ok := ret.Get(1).(func(context.Context, []string) error); ok {
   221  		r1 = rf(ctx, nodenames)
   222  	} else {
   223  		r1 = ret.Error(1)
   224  	}
   225  
   226  	return r0, r1
   227  }
   228  
   229  // GetNodeResourceInfo provides a mock function with given fields: ctx, nodename, workloadsResource
   230  func (_m *Plugin) GetNodeResourceInfo(ctx context.Context, nodename string, workloadsResource []types.RawParams) (*pluginstypes.GetNodeResourceInfoResponse, error) {
   231  	ret := _m.Called(ctx, nodename, workloadsResource)
   232  
   233  	var r0 *pluginstypes.GetNodeResourceInfoResponse
   234  	var r1 error
   235  	if rf, ok := ret.Get(0).(func(context.Context, string, []types.RawParams) (*pluginstypes.GetNodeResourceInfoResponse, error)); ok {
   236  		return rf(ctx, nodename, workloadsResource)
   237  	}
   238  	if rf, ok := ret.Get(0).(func(context.Context, string, []types.RawParams) *pluginstypes.GetNodeResourceInfoResponse); ok {
   239  		r0 = rf(ctx, nodename, workloadsResource)
   240  	} else {
   241  		if ret.Get(0) != nil {
   242  			r0 = ret.Get(0).(*pluginstypes.GetNodeResourceInfoResponse)
   243  		}
   244  	}
   245  
   246  	if rf, ok := ret.Get(1).(func(context.Context, string, []types.RawParams) error); ok {
   247  		r1 = rf(ctx, nodename, workloadsResource)
   248  	} else {
   249  		r1 = ret.Error(1)
   250  	}
   251  
   252  	return r0, r1
   253  }
   254  
   255  // GetNodesDeployCapacity provides a mock function with given fields: ctx, nodenames, resource
   256  func (_m *Plugin) GetNodesDeployCapacity(ctx context.Context, nodenames []string, resource types.RawParams) (*pluginstypes.GetNodesDeployCapacityResponse, error) {
   257  	ret := _m.Called(ctx, nodenames, resource)
   258  
   259  	var r0 *pluginstypes.GetNodesDeployCapacityResponse
   260  	var r1 error
   261  	if rf, ok := ret.Get(0).(func(context.Context, []string, types.RawParams) (*pluginstypes.GetNodesDeployCapacityResponse, error)); ok {
   262  		return rf(ctx, nodenames, resource)
   263  	}
   264  	if rf, ok := ret.Get(0).(func(context.Context, []string, types.RawParams) *pluginstypes.GetNodesDeployCapacityResponse); ok {
   265  		r0 = rf(ctx, nodenames, resource)
   266  	} else {
   267  		if ret.Get(0) != nil {
   268  			r0 = ret.Get(0).(*pluginstypes.GetNodesDeployCapacityResponse)
   269  		}
   270  	}
   271  
   272  	if rf, ok := ret.Get(1).(func(context.Context, []string, types.RawParams) error); ok {
   273  		r1 = rf(ctx, nodenames, resource)
   274  	} else {
   275  		r1 = ret.Error(1)
   276  	}
   277  
   278  	return r0, r1
   279  }
   280  
   281  // Name provides a mock function with given fields:
   282  func (_m *Plugin) Name() string {
   283  	ret := _m.Called()
   284  
   285  	var r0 string
   286  	if rf, ok := ret.Get(0).(func() string); ok {
   287  		r0 = rf()
   288  	} else {
   289  		r0 = ret.Get(0).(string)
   290  	}
   291  
   292  	return r0
   293  }
   294  
   295  // RemoveNode provides a mock function with given fields: ctx, nodename
   296  func (_m *Plugin) RemoveNode(ctx context.Context, nodename string) (*pluginstypes.RemoveNodeResponse, error) {
   297  	ret := _m.Called(ctx, nodename)
   298  
   299  	var r0 *pluginstypes.RemoveNodeResponse
   300  	var r1 error
   301  	if rf, ok := ret.Get(0).(func(context.Context, string) (*pluginstypes.RemoveNodeResponse, error)); ok {
   302  		return rf(ctx, nodename)
   303  	}
   304  	if rf, ok := ret.Get(0).(func(context.Context, string) *pluginstypes.RemoveNodeResponse); ok {
   305  		r0 = rf(ctx, nodename)
   306  	} else {
   307  		if ret.Get(0) != nil {
   308  			r0 = ret.Get(0).(*pluginstypes.RemoveNodeResponse)
   309  		}
   310  	}
   311  
   312  	if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
   313  		r1 = rf(ctx, nodename)
   314  	} else {
   315  		r1 = ret.Error(1)
   316  	}
   317  
   318  	return r0, r1
   319  }
   320  
   321  // SetNodeResourceCapacity provides a mock function with given fields: ctx, nodename, resource, resourceRequest, delta, incr
   322  func (_m *Plugin) SetNodeResourceCapacity(ctx context.Context, nodename string, resource types.RawParams, resourceRequest types.RawParams, delta bool, incr bool) (*pluginstypes.SetNodeResourceCapacityResponse, error) {
   323  	ret := _m.Called(ctx, nodename, resource, resourceRequest, delta, incr)
   324  
   325  	var r0 *pluginstypes.SetNodeResourceCapacityResponse
   326  	var r1 error
   327  	if rf, ok := ret.Get(0).(func(context.Context, string, types.RawParams, types.RawParams, bool, bool) (*pluginstypes.SetNodeResourceCapacityResponse, error)); ok {
   328  		return rf(ctx, nodename, resource, resourceRequest, delta, incr)
   329  	}
   330  	if rf, ok := ret.Get(0).(func(context.Context, string, types.RawParams, types.RawParams, bool, bool) *pluginstypes.SetNodeResourceCapacityResponse); ok {
   331  		r0 = rf(ctx, nodename, resource, resourceRequest, delta, incr)
   332  	} else {
   333  		if ret.Get(0) != nil {
   334  			r0 = ret.Get(0).(*pluginstypes.SetNodeResourceCapacityResponse)
   335  		}
   336  	}
   337  
   338  	if rf, ok := ret.Get(1).(func(context.Context, string, types.RawParams, types.RawParams, bool, bool) error); ok {
   339  		r1 = rf(ctx, nodename, resource, resourceRequest, delta, incr)
   340  	} else {
   341  		r1 = ret.Error(1)
   342  	}
   343  
   344  	return r0, r1
   345  }
   346  
   347  // SetNodeResourceInfo provides a mock function with given fields: ctx, nodename, capacity, usage
   348  func (_m *Plugin) SetNodeResourceInfo(ctx context.Context, nodename string, capacity types.RawParams, usage types.RawParams) (*pluginstypes.SetNodeResourceInfoResponse, error) {
   349  	ret := _m.Called(ctx, nodename, capacity, usage)
   350  
   351  	var r0 *pluginstypes.SetNodeResourceInfoResponse
   352  	var r1 error
   353  	if rf, ok := ret.Get(0).(func(context.Context, string, types.RawParams, types.RawParams) (*pluginstypes.SetNodeResourceInfoResponse, error)); ok {
   354  		return rf(ctx, nodename, capacity, usage)
   355  	}
   356  	if rf, ok := ret.Get(0).(func(context.Context, string, types.RawParams, types.RawParams) *pluginstypes.SetNodeResourceInfoResponse); ok {
   357  		r0 = rf(ctx, nodename, capacity, usage)
   358  	} else {
   359  		if ret.Get(0) != nil {
   360  			r0 = ret.Get(0).(*pluginstypes.SetNodeResourceInfoResponse)
   361  		}
   362  	}
   363  
   364  	if rf, ok := ret.Get(1).(func(context.Context, string, types.RawParams, types.RawParams) error); ok {
   365  		r1 = rf(ctx, nodename, capacity, usage)
   366  	} else {
   367  		r1 = ret.Error(1)
   368  	}
   369  
   370  	return r0, r1
   371  }
   372  
   373  // SetNodeResourceUsage provides a mock function with given fields: ctx, nodename, resource, resourceRequest, workloadsResource, delta, incr
   374  func (_m *Plugin) SetNodeResourceUsage(ctx context.Context, nodename string, resource types.RawParams, resourceRequest types.RawParams, workloadsResource []types.RawParams, delta bool, incr bool) (*pluginstypes.SetNodeResourceUsageResponse, error) {
   375  	ret := _m.Called(ctx, nodename, resource, resourceRequest, workloadsResource, delta, incr)
   376  
   377  	var r0 *pluginstypes.SetNodeResourceUsageResponse
   378  	var r1 error
   379  	if rf, ok := ret.Get(0).(func(context.Context, string, types.RawParams, types.RawParams, []types.RawParams, bool, bool) (*pluginstypes.SetNodeResourceUsageResponse, error)); ok {
   380  		return rf(ctx, nodename, resource, resourceRequest, workloadsResource, delta, incr)
   381  	}
   382  	if rf, ok := ret.Get(0).(func(context.Context, string, types.RawParams, types.RawParams, []types.RawParams, bool, bool) *pluginstypes.SetNodeResourceUsageResponse); ok {
   383  		r0 = rf(ctx, nodename, resource, resourceRequest, workloadsResource, delta, incr)
   384  	} else {
   385  		if ret.Get(0) != nil {
   386  			r0 = ret.Get(0).(*pluginstypes.SetNodeResourceUsageResponse)
   387  		}
   388  	}
   389  
   390  	if rf, ok := ret.Get(1).(func(context.Context, string, types.RawParams, types.RawParams, []types.RawParams, bool, bool) error); ok {
   391  		r1 = rf(ctx, nodename, resource, resourceRequest, workloadsResource, delta, incr)
   392  	} else {
   393  		r1 = ret.Error(1)
   394  	}
   395  
   396  	return r0, r1
   397  }
   398  
   399  // NewPlugin creates a new instance of Plugin. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
   400  // The first argument is typically a *testing.T value.
   401  func NewPlugin(t interface {
   402  	mock.TestingT
   403  	Cleanup(func())
   404  }) *Plugin {
   405  	mock := &Plugin{}
   406  	mock.Mock.Test(t)
   407  
   408  	t.Cleanup(func() { mock.AssertExpectations(t) })
   409  
   410  	return mock
   411  }