github.com/chenbh/concourse/v6@v6.4.2/atc/runtime/runtimefakes/fake_runner.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package runtimefakes
     3  
     4  import (
     5  	"context"
     6  	"io"
     7  	"sync"
     8  
     9  	"github.com/chenbh/concourse/v6/atc/runtime"
    10  )
    11  
    12  type FakeRunner struct {
    13  	RunScriptStub        func(context.Context, string, []string, []byte, interface{}, io.Writer, bool) error
    14  	runScriptMutex       sync.RWMutex
    15  	runScriptArgsForCall []struct {
    16  		arg1 context.Context
    17  		arg2 string
    18  		arg3 []string
    19  		arg4 []byte
    20  		arg5 interface{}
    21  		arg6 io.Writer
    22  		arg7 bool
    23  	}
    24  	runScriptReturns struct {
    25  		result1 error
    26  	}
    27  	runScriptReturnsOnCall map[int]struct {
    28  		result1 error
    29  	}
    30  	invocations      map[string][][]interface{}
    31  	invocationsMutex sync.RWMutex
    32  }
    33  
    34  func (fake *FakeRunner) RunScript(arg1 context.Context, arg2 string, arg3 []string, arg4 []byte, arg5 interface{}, arg6 io.Writer, arg7 bool) error {
    35  	var arg3Copy []string
    36  	if arg3 != nil {
    37  		arg3Copy = make([]string, len(arg3))
    38  		copy(arg3Copy, arg3)
    39  	}
    40  	var arg4Copy []byte
    41  	if arg4 != nil {
    42  		arg4Copy = make([]byte, len(arg4))
    43  		copy(arg4Copy, arg4)
    44  	}
    45  	fake.runScriptMutex.Lock()
    46  	ret, specificReturn := fake.runScriptReturnsOnCall[len(fake.runScriptArgsForCall)]
    47  	fake.runScriptArgsForCall = append(fake.runScriptArgsForCall, struct {
    48  		arg1 context.Context
    49  		arg2 string
    50  		arg3 []string
    51  		arg4 []byte
    52  		arg5 interface{}
    53  		arg6 io.Writer
    54  		arg7 bool
    55  	}{arg1, arg2, arg3Copy, arg4Copy, arg5, arg6, arg7})
    56  	fake.recordInvocation("RunScript", []interface{}{arg1, arg2, arg3Copy, arg4Copy, arg5, arg6, arg7})
    57  	fake.runScriptMutex.Unlock()
    58  	if fake.RunScriptStub != nil {
    59  		return fake.RunScriptStub(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
    60  	}
    61  	if specificReturn {
    62  		return ret.result1
    63  	}
    64  	fakeReturns := fake.runScriptReturns
    65  	return fakeReturns.result1
    66  }
    67  
    68  func (fake *FakeRunner) RunScriptCallCount() int {
    69  	fake.runScriptMutex.RLock()
    70  	defer fake.runScriptMutex.RUnlock()
    71  	return len(fake.runScriptArgsForCall)
    72  }
    73  
    74  func (fake *FakeRunner) RunScriptCalls(stub func(context.Context, string, []string, []byte, interface{}, io.Writer, bool) error) {
    75  	fake.runScriptMutex.Lock()
    76  	defer fake.runScriptMutex.Unlock()
    77  	fake.RunScriptStub = stub
    78  }
    79  
    80  func (fake *FakeRunner) RunScriptArgsForCall(i int) (context.Context, string, []string, []byte, interface{}, io.Writer, bool) {
    81  	fake.runScriptMutex.RLock()
    82  	defer fake.runScriptMutex.RUnlock()
    83  	argsForCall := fake.runScriptArgsForCall[i]
    84  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6, argsForCall.arg7
    85  }
    86  
    87  func (fake *FakeRunner) RunScriptReturns(result1 error) {
    88  	fake.runScriptMutex.Lock()
    89  	defer fake.runScriptMutex.Unlock()
    90  	fake.RunScriptStub = nil
    91  	fake.runScriptReturns = struct {
    92  		result1 error
    93  	}{result1}
    94  }
    95  
    96  func (fake *FakeRunner) RunScriptReturnsOnCall(i int, result1 error) {
    97  	fake.runScriptMutex.Lock()
    98  	defer fake.runScriptMutex.Unlock()
    99  	fake.RunScriptStub = nil
   100  	if fake.runScriptReturnsOnCall == nil {
   101  		fake.runScriptReturnsOnCall = make(map[int]struct {
   102  			result1 error
   103  		})
   104  	}
   105  	fake.runScriptReturnsOnCall[i] = struct {
   106  		result1 error
   107  	}{result1}
   108  }
   109  
   110  func (fake *FakeRunner) Invocations() map[string][][]interface{} {
   111  	fake.invocationsMutex.RLock()
   112  	defer fake.invocationsMutex.RUnlock()
   113  	fake.runScriptMutex.RLock()
   114  	defer fake.runScriptMutex.RUnlock()
   115  	copiedInvocations := map[string][][]interface{}{}
   116  	for key, value := range fake.invocations {
   117  		copiedInvocations[key] = value
   118  	}
   119  	return copiedInvocations
   120  }
   121  
   122  func (fake *FakeRunner) recordInvocation(key string, args []interface{}) {
   123  	fake.invocationsMutex.Lock()
   124  	defer fake.invocationsMutex.Unlock()
   125  	if fake.invocations == nil {
   126  		fake.invocations = map[string][][]interface{}{}
   127  	}
   128  	if fake.invocations[key] == nil {
   129  		fake.invocations[key] = [][]interface{}{}
   130  	}
   131  	fake.invocations[key] = append(fake.invocations[key], args)
   132  }
   133  
   134  var _ runtime.Runner = new(FakeRunner)