github.com/chenbh/concourse/v6@v6.4.2/worker/runtime/libcontainerd/libcontainerdfakes/fake_client.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package libcontainerdfakes
     3  
     4  import (
     5  	"context"
     6  	"sync"
     7  
     8  	"github.com/chenbh/concourse/v6/worker/runtime/libcontainerd"
     9  	"github.com/containerd/containerd"
    10  	specs "github.com/opencontainers/runtime-spec/specs-go"
    11  )
    12  
    13  type FakeClient struct {
    14  	ContainersStub        func(context.Context, ...string) ([]containerd.Container, error)
    15  	containersMutex       sync.RWMutex
    16  	containersArgsForCall []struct {
    17  		arg1 context.Context
    18  		arg2 []string
    19  	}
    20  	containersReturns struct {
    21  		result1 []containerd.Container
    22  		result2 error
    23  	}
    24  	containersReturnsOnCall map[int]struct {
    25  		result1 []containerd.Container
    26  		result2 error
    27  	}
    28  	DestroyStub        func(context.Context, string) error
    29  	destroyMutex       sync.RWMutex
    30  	destroyArgsForCall []struct {
    31  		arg1 context.Context
    32  		arg2 string
    33  	}
    34  	destroyReturns struct {
    35  		result1 error
    36  	}
    37  	destroyReturnsOnCall map[int]struct {
    38  		result1 error
    39  	}
    40  	GetContainerStub        func(context.Context, string) (containerd.Container, error)
    41  	getContainerMutex       sync.RWMutex
    42  	getContainerArgsForCall []struct {
    43  		arg1 context.Context
    44  		arg2 string
    45  	}
    46  	getContainerReturns struct {
    47  		result1 containerd.Container
    48  		result2 error
    49  	}
    50  	getContainerReturnsOnCall map[int]struct {
    51  		result1 containerd.Container
    52  		result2 error
    53  	}
    54  	InitStub        func() error
    55  	initMutex       sync.RWMutex
    56  	initArgsForCall []struct {
    57  	}
    58  	initReturns struct {
    59  		result1 error
    60  	}
    61  	initReturnsOnCall map[int]struct {
    62  		result1 error
    63  	}
    64  	NewContainerStub        func(context.Context, string, map[string]string, *specs.Spec) (containerd.Container, error)
    65  	newContainerMutex       sync.RWMutex
    66  	newContainerArgsForCall []struct {
    67  		arg1 context.Context
    68  		arg2 string
    69  		arg3 map[string]string
    70  		arg4 *specs.Spec
    71  	}
    72  	newContainerReturns struct {
    73  		result1 containerd.Container
    74  		result2 error
    75  	}
    76  	newContainerReturnsOnCall map[int]struct {
    77  		result1 containerd.Container
    78  		result2 error
    79  	}
    80  	StopStub        func() error
    81  	stopMutex       sync.RWMutex
    82  	stopArgsForCall []struct {
    83  	}
    84  	stopReturns struct {
    85  		result1 error
    86  	}
    87  	stopReturnsOnCall map[int]struct {
    88  		result1 error
    89  	}
    90  	VersionStub        func(context.Context) error
    91  	versionMutex       sync.RWMutex
    92  	versionArgsForCall []struct {
    93  		arg1 context.Context
    94  	}
    95  	versionReturns struct {
    96  		result1 error
    97  	}
    98  	versionReturnsOnCall map[int]struct {
    99  		result1 error
   100  	}
   101  	invocations      map[string][][]interface{}
   102  	invocationsMutex sync.RWMutex
   103  }
   104  
   105  func (fake *FakeClient) Containers(arg1 context.Context, arg2 ...string) ([]containerd.Container, error) {
   106  	fake.containersMutex.Lock()
   107  	ret, specificReturn := fake.containersReturnsOnCall[len(fake.containersArgsForCall)]
   108  	fake.containersArgsForCall = append(fake.containersArgsForCall, struct {
   109  		arg1 context.Context
   110  		arg2 []string
   111  	}{arg1, arg2})
   112  	fake.recordInvocation("Containers", []interface{}{arg1, arg2})
   113  	fake.containersMutex.Unlock()
   114  	if fake.ContainersStub != nil {
   115  		return fake.ContainersStub(arg1, arg2...)
   116  	}
   117  	if specificReturn {
   118  		return ret.result1, ret.result2
   119  	}
   120  	fakeReturns := fake.containersReturns
   121  	return fakeReturns.result1, fakeReturns.result2
   122  }
   123  
   124  func (fake *FakeClient) ContainersCallCount() int {
   125  	fake.containersMutex.RLock()
   126  	defer fake.containersMutex.RUnlock()
   127  	return len(fake.containersArgsForCall)
   128  }
   129  
   130  func (fake *FakeClient) ContainersCalls(stub func(context.Context, ...string) ([]containerd.Container, error)) {
   131  	fake.containersMutex.Lock()
   132  	defer fake.containersMutex.Unlock()
   133  	fake.ContainersStub = stub
   134  }
   135  
   136  func (fake *FakeClient) ContainersArgsForCall(i int) (context.Context, []string) {
   137  	fake.containersMutex.RLock()
   138  	defer fake.containersMutex.RUnlock()
   139  	argsForCall := fake.containersArgsForCall[i]
   140  	return argsForCall.arg1, argsForCall.arg2
   141  }
   142  
   143  func (fake *FakeClient) ContainersReturns(result1 []containerd.Container, result2 error) {
   144  	fake.containersMutex.Lock()
   145  	defer fake.containersMutex.Unlock()
   146  	fake.ContainersStub = nil
   147  	fake.containersReturns = struct {
   148  		result1 []containerd.Container
   149  		result2 error
   150  	}{result1, result2}
   151  }
   152  
   153  func (fake *FakeClient) ContainersReturnsOnCall(i int, result1 []containerd.Container, result2 error) {
   154  	fake.containersMutex.Lock()
   155  	defer fake.containersMutex.Unlock()
   156  	fake.ContainersStub = nil
   157  	if fake.containersReturnsOnCall == nil {
   158  		fake.containersReturnsOnCall = make(map[int]struct {
   159  			result1 []containerd.Container
   160  			result2 error
   161  		})
   162  	}
   163  	fake.containersReturnsOnCall[i] = struct {
   164  		result1 []containerd.Container
   165  		result2 error
   166  	}{result1, result2}
   167  }
   168  
   169  func (fake *FakeClient) Destroy(arg1 context.Context, arg2 string) error {
   170  	fake.destroyMutex.Lock()
   171  	ret, specificReturn := fake.destroyReturnsOnCall[len(fake.destroyArgsForCall)]
   172  	fake.destroyArgsForCall = append(fake.destroyArgsForCall, struct {
   173  		arg1 context.Context
   174  		arg2 string
   175  	}{arg1, arg2})
   176  	fake.recordInvocation("Destroy", []interface{}{arg1, arg2})
   177  	fake.destroyMutex.Unlock()
   178  	if fake.DestroyStub != nil {
   179  		return fake.DestroyStub(arg1, arg2)
   180  	}
   181  	if specificReturn {
   182  		return ret.result1
   183  	}
   184  	fakeReturns := fake.destroyReturns
   185  	return fakeReturns.result1
   186  }
   187  
   188  func (fake *FakeClient) DestroyCallCount() int {
   189  	fake.destroyMutex.RLock()
   190  	defer fake.destroyMutex.RUnlock()
   191  	return len(fake.destroyArgsForCall)
   192  }
   193  
   194  func (fake *FakeClient) DestroyCalls(stub func(context.Context, string) error) {
   195  	fake.destroyMutex.Lock()
   196  	defer fake.destroyMutex.Unlock()
   197  	fake.DestroyStub = stub
   198  }
   199  
   200  func (fake *FakeClient) DestroyArgsForCall(i int) (context.Context, string) {
   201  	fake.destroyMutex.RLock()
   202  	defer fake.destroyMutex.RUnlock()
   203  	argsForCall := fake.destroyArgsForCall[i]
   204  	return argsForCall.arg1, argsForCall.arg2
   205  }
   206  
   207  func (fake *FakeClient) DestroyReturns(result1 error) {
   208  	fake.destroyMutex.Lock()
   209  	defer fake.destroyMutex.Unlock()
   210  	fake.DestroyStub = nil
   211  	fake.destroyReturns = struct {
   212  		result1 error
   213  	}{result1}
   214  }
   215  
   216  func (fake *FakeClient) DestroyReturnsOnCall(i int, result1 error) {
   217  	fake.destroyMutex.Lock()
   218  	defer fake.destroyMutex.Unlock()
   219  	fake.DestroyStub = nil
   220  	if fake.destroyReturnsOnCall == nil {
   221  		fake.destroyReturnsOnCall = make(map[int]struct {
   222  			result1 error
   223  		})
   224  	}
   225  	fake.destroyReturnsOnCall[i] = struct {
   226  		result1 error
   227  	}{result1}
   228  }
   229  
   230  func (fake *FakeClient) GetContainer(arg1 context.Context, arg2 string) (containerd.Container, error) {
   231  	fake.getContainerMutex.Lock()
   232  	ret, specificReturn := fake.getContainerReturnsOnCall[len(fake.getContainerArgsForCall)]
   233  	fake.getContainerArgsForCall = append(fake.getContainerArgsForCall, struct {
   234  		arg1 context.Context
   235  		arg2 string
   236  	}{arg1, arg2})
   237  	fake.recordInvocation("GetContainer", []interface{}{arg1, arg2})
   238  	fake.getContainerMutex.Unlock()
   239  	if fake.GetContainerStub != nil {
   240  		return fake.GetContainerStub(arg1, arg2)
   241  	}
   242  	if specificReturn {
   243  		return ret.result1, ret.result2
   244  	}
   245  	fakeReturns := fake.getContainerReturns
   246  	return fakeReturns.result1, fakeReturns.result2
   247  }
   248  
   249  func (fake *FakeClient) GetContainerCallCount() int {
   250  	fake.getContainerMutex.RLock()
   251  	defer fake.getContainerMutex.RUnlock()
   252  	return len(fake.getContainerArgsForCall)
   253  }
   254  
   255  func (fake *FakeClient) GetContainerCalls(stub func(context.Context, string) (containerd.Container, error)) {
   256  	fake.getContainerMutex.Lock()
   257  	defer fake.getContainerMutex.Unlock()
   258  	fake.GetContainerStub = stub
   259  }
   260  
   261  func (fake *FakeClient) GetContainerArgsForCall(i int) (context.Context, string) {
   262  	fake.getContainerMutex.RLock()
   263  	defer fake.getContainerMutex.RUnlock()
   264  	argsForCall := fake.getContainerArgsForCall[i]
   265  	return argsForCall.arg1, argsForCall.arg2
   266  }
   267  
   268  func (fake *FakeClient) GetContainerReturns(result1 containerd.Container, result2 error) {
   269  	fake.getContainerMutex.Lock()
   270  	defer fake.getContainerMutex.Unlock()
   271  	fake.GetContainerStub = nil
   272  	fake.getContainerReturns = struct {
   273  		result1 containerd.Container
   274  		result2 error
   275  	}{result1, result2}
   276  }
   277  
   278  func (fake *FakeClient) GetContainerReturnsOnCall(i int, result1 containerd.Container, result2 error) {
   279  	fake.getContainerMutex.Lock()
   280  	defer fake.getContainerMutex.Unlock()
   281  	fake.GetContainerStub = nil
   282  	if fake.getContainerReturnsOnCall == nil {
   283  		fake.getContainerReturnsOnCall = make(map[int]struct {
   284  			result1 containerd.Container
   285  			result2 error
   286  		})
   287  	}
   288  	fake.getContainerReturnsOnCall[i] = struct {
   289  		result1 containerd.Container
   290  		result2 error
   291  	}{result1, result2}
   292  }
   293  
   294  func (fake *FakeClient) Init() error {
   295  	fake.initMutex.Lock()
   296  	ret, specificReturn := fake.initReturnsOnCall[len(fake.initArgsForCall)]
   297  	fake.initArgsForCall = append(fake.initArgsForCall, struct {
   298  	}{})
   299  	fake.recordInvocation("Init", []interface{}{})
   300  	fake.initMutex.Unlock()
   301  	if fake.InitStub != nil {
   302  		return fake.InitStub()
   303  	}
   304  	if specificReturn {
   305  		return ret.result1
   306  	}
   307  	fakeReturns := fake.initReturns
   308  	return fakeReturns.result1
   309  }
   310  
   311  func (fake *FakeClient) InitCallCount() int {
   312  	fake.initMutex.RLock()
   313  	defer fake.initMutex.RUnlock()
   314  	return len(fake.initArgsForCall)
   315  }
   316  
   317  func (fake *FakeClient) InitCalls(stub func() error) {
   318  	fake.initMutex.Lock()
   319  	defer fake.initMutex.Unlock()
   320  	fake.InitStub = stub
   321  }
   322  
   323  func (fake *FakeClient) InitReturns(result1 error) {
   324  	fake.initMutex.Lock()
   325  	defer fake.initMutex.Unlock()
   326  	fake.InitStub = nil
   327  	fake.initReturns = struct {
   328  		result1 error
   329  	}{result1}
   330  }
   331  
   332  func (fake *FakeClient) InitReturnsOnCall(i int, result1 error) {
   333  	fake.initMutex.Lock()
   334  	defer fake.initMutex.Unlock()
   335  	fake.InitStub = nil
   336  	if fake.initReturnsOnCall == nil {
   337  		fake.initReturnsOnCall = make(map[int]struct {
   338  			result1 error
   339  		})
   340  	}
   341  	fake.initReturnsOnCall[i] = struct {
   342  		result1 error
   343  	}{result1}
   344  }
   345  
   346  func (fake *FakeClient) NewContainer(arg1 context.Context, arg2 string, arg3 map[string]string, arg4 *specs.Spec) (containerd.Container, error) {
   347  	fake.newContainerMutex.Lock()
   348  	ret, specificReturn := fake.newContainerReturnsOnCall[len(fake.newContainerArgsForCall)]
   349  	fake.newContainerArgsForCall = append(fake.newContainerArgsForCall, struct {
   350  		arg1 context.Context
   351  		arg2 string
   352  		arg3 map[string]string
   353  		arg4 *specs.Spec
   354  	}{arg1, arg2, arg3, arg4})
   355  	fake.recordInvocation("NewContainer", []interface{}{arg1, arg2, arg3, arg4})
   356  	fake.newContainerMutex.Unlock()
   357  	if fake.NewContainerStub != nil {
   358  		return fake.NewContainerStub(arg1, arg2, arg3, arg4)
   359  	}
   360  	if specificReturn {
   361  		return ret.result1, ret.result2
   362  	}
   363  	fakeReturns := fake.newContainerReturns
   364  	return fakeReturns.result1, fakeReturns.result2
   365  }
   366  
   367  func (fake *FakeClient) NewContainerCallCount() int {
   368  	fake.newContainerMutex.RLock()
   369  	defer fake.newContainerMutex.RUnlock()
   370  	return len(fake.newContainerArgsForCall)
   371  }
   372  
   373  func (fake *FakeClient) NewContainerCalls(stub func(context.Context, string, map[string]string, *specs.Spec) (containerd.Container, error)) {
   374  	fake.newContainerMutex.Lock()
   375  	defer fake.newContainerMutex.Unlock()
   376  	fake.NewContainerStub = stub
   377  }
   378  
   379  func (fake *FakeClient) NewContainerArgsForCall(i int) (context.Context, string, map[string]string, *specs.Spec) {
   380  	fake.newContainerMutex.RLock()
   381  	defer fake.newContainerMutex.RUnlock()
   382  	argsForCall := fake.newContainerArgsForCall[i]
   383  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
   384  }
   385  
   386  func (fake *FakeClient) NewContainerReturns(result1 containerd.Container, result2 error) {
   387  	fake.newContainerMutex.Lock()
   388  	defer fake.newContainerMutex.Unlock()
   389  	fake.NewContainerStub = nil
   390  	fake.newContainerReturns = struct {
   391  		result1 containerd.Container
   392  		result2 error
   393  	}{result1, result2}
   394  }
   395  
   396  func (fake *FakeClient) NewContainerReturnsOnCall(i int, result1 containerd.Container, result2 error) {
   397  	fake.newContainerMutex.Lock()
   398  	defer fake.newContainerMutex.Unlock()
   399  	fake.NewContainerStub = nil
   400  	if fake.newContainerReturnsOnCall == nil {
   401  		fake.newContainerReturnsOnCall = make(map[int]struct {
   402  			result1 containerd.Container
   403  			result2 error
   404  		})
   405  	}
   406  	fake.newContainerReturnsOnCall[i] = struct {
   407  		result1 containerd.Container
   408  		result2 error
   409  	}{result1, result2}
   410  }
   411  
   412  func (fake *FakeClient) Stop() error {
   413  	fake.stopMutex.Lock()
   414  	ret, specificReturn := fake.stopReturnsOnCall[len(fake.stopArgsForCall)]
   415  	fake.stopArgsForCall = append(fake.stopArgsForCall, struct {
   416  	}{})
   417  	fake.recordInvocation("Stop", []interface{}{})
   418  	fake.stopMutex.Unlock()
   419  	if fake.StopStub != nil {
   420  		return fake.StopStub()
   421  	}
   422  	if specificReturn {
   423  		return ret.result1
   424  	}
   425  	fakeReturns := fake.stopReturns
   426  	return fakeReturns.result1
   427  }
   428  
   429  func (fake *FakeClient) StopCallCount() int {
   430  	fake.stopMutex.RLock()
   431  	defer fake.stopMutex.RUnlock()
   432  	return len(fake.stopArgsForCall)
   433  }
   434  
   435  func (fake *FakeClient) StopCalls(stub func() error) {
   436  	fake.stopMutex.Lock()
   437  	defer fake.stopMutex.Unlock()
   438  	fake.StopStub = stub
   439  }
   440  
   441  func (fake *FakeClient) StopReturns(result1 error) {
   442  	fake.stopMutex.Lock()
   443  	defer fake.stopMutex.Unlock()
   444  	fake.StopStub = nil
   445  	fake.stopReturns = struct {
   446  		result1 error
   447  	}{result1}
   448  }
   449  
   450  func (fake *FakeClient) StopReturnsOnCall(i int, result1 error) {
   451  	fake.stopMutex.Lock()
   452  	defer fake.stopMutex.Unlock()
   453  	fake.StopStub = nil
   454  	if fake.stopReturnsOnCall == nil {
   455  		fake.stopReturnsOnCall = make(map[int]struct {
   456  			result1 error
   457  		})
   458  	}
   459  	fake.stopReturnsOnCall[i] = struct {
   460  		result1 error
   461  	}{result1}
   462  }
   463  
   464  func (fake *FakeClient) Version(arg1 context.Context) error {
   465  	fake.versionMutex.Lock()
   466  	ret, specificReturn := fake.versionReturnsOnCall[len(fake.versionArgsForCall)]
   467  	fake.versionArgsForCall = append(fake.versionArgsForCall, struct {
   468  		arg1 context.Context
   469  	}{arg1})
   470  	fake.recordInvocation("Version", []interface{}{arg1})
   471  	fake.versionMutex.Unlock()
   472  	if fake.VersionStub != nil {
   473  		return fake.VersionStub(arg1)
   474  	}
   475  	if specificReturn {
   476  		return ret.result1
   477  	}
   478  	fakeReturns := fake.versionReturns
   479  	return fakeReturns.result1
   480  }
   481  
   482  func (fake *FakeClient) VersionCallCount() int {
   483  	fake.versionMutex.RLock()
   484  	defer fake.versionMutex.RUnlock()
   485  	return len(fake.versionArgsForCall)
   486  }
   487  
   488  func (fake *FakeClient) VersionCalls(stub func(context.Context) error) {
   489  	fake.versionMutex.Lock()
   490  	defer fake.versionMutex.Unlock()
   491  	fake.VersionStub = stub
   492  }
   493  
   494  func (fake *FakeClient) VersionArgsForCall(i int) context.Context {
   495  	fake.versionMutex.RLock()
   496  	defer fake.versionMutex.RUnlock()
   497  	argsForCall := fake.versionArgsForCall[i]
   498  	return argsForCall.arg1
   499  }
   500  
   501  func (fake *FakeClient) VersionReturns(result1 error) {
   502  	fake.versionMutex.Lock()
   503  	defer fake.versionMutex.Unlock()
   504  	fake.VersionStub = nil
   505  	fake.versionReturns = struct {
   506  		result1 error
   507  	}{result1}
   508  }
   509  
   510  func (fake *FakeClient) VersionReturnsOnCall(i int, result1 error) {
   511  	fake.versionMutex.Lock()
   512  	defer fake.versionMutex.Unlock()
   513  	fake.VersionStub = nil
   514  	if fake.versionReturnsOnCall == nil {
   515  		fake.versionReturnsOnCall = make(map[int]struct {
   516  			result1 error
   517  		})
   518  	}
   519  	fake.versionReturnsOnCall[i] = struct {
   520  		result1 error
   521  	}{result1}
   522  }
   523  
   524  func (fake *FakeClient) Invocations() map[string][][]interface{} {
   525  	fake.invocationsMutex.RLock()
   526  	defer fake.invocationsMutex.RUnlock()
   527  	fake.containersMutex.RLock()
   528  	defer fake.containersMutex.RUnlock()
   529  	fake.destroyMutex.RLock()
   530  	defer fake.destroyMutex.RUnlock()
   531  	fake.getContainerMutex.RLock()
   532  	defer fake.getContainerMutex.RUnlock()
   533  	fake.initMutex.RLock()
   534  	defer fake.initMutex.RUnlock()
   535  	fake.newContainerMutex.RLock()
   536  	defer fake.newContainerMutex.RUnlock()
   537  	fake.stopMutex.RLock()
   538  	defer fake.stopMutex.RUnlock()
   539  	fake.versionMutex.RLock()
   540  	defer fake.versionMutex.RUnlock()
   541  	copiedInvocations := map[string][][]interface{}{}
   542  	for key, value := range fake.invocations {
   543  		copiedInvocations[key] = value
   544  	}
   545  	return copiedInvocations
   546  }
   547  
   548  func (fake *FakeClient) recordInvocation(key string, args []interface{}) {
   549  	fake.invocationsMutex.Lock()
   550  	defer fake.invocationsMutex.Unlock()
   551  	if fake.invocations == nil {
   552  		fake.invocations = map[string][][]interface{}{}
   553  	}
   554  	if fake.invocations[key] == nil {
   555  		fake.invocations[key] = [][]interface{}{}
   556  	}
   557  	fake.invocations[key] = append(fake.invocations[key], args)
   558  }
   559  
   560  var _ libcontainerd.Client = new(FakeClient)