...

Source file src/sigs.k8s.io/release-utils/env/internal/internalfakes/fake_impl.go

Documentation: sigs.k8s.io/release-utils/env/internal/internalfakes

     1  /*
     2  Copyright The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  // Code generated by counterfeiter. DO NOT EDIT.
    18  package internalfakes
    19  
    20  import (
    21  	"sync"
    22  )
    23  
    24  type FakeImpl struct {
    25  	LookupEnvStub        func(string) (string, bool)
    26  	lookupEnvMutex       sync.RWMutex
    27  	lookupEnvArgsForCall []struct {
    28  		arg1 string
    29  	}
    30  	lookupEnvReturns struct {
    31  		result1 string
    32  		result2 bool
    33  	}
    34  	lookupEnvReturnsOnCall map[int]struct {
    35  		result1 string
    36  		result2 bool
    37  	}
    38  	invocations      map[string][][]interface{}
    39  	invocationsMutex sync.RWMutex
    40  }
    41  
    42  func (fake *FakeImpl) LookupEnv(arg1 string) (string, bool) {
    43  	fake.lookupEnvMutex.Lock()
    44  	ret, specificReturn := fake.lookupEnvReturnsOnCall[len(fake.lookupEnvArgsForCall)]
    45  	fake.lookupEnvArgsForCall = append(fake.lookupEnvArgsForCall, struct {
    46  		arg1 string
    47  	}{arg1})
    48  	stub := fake.LookupEnvStub
    49  	fakeReturns := fake.lookupEnvReturns
    50  	fake.recordInvocation("LookupEnv", []interface{}{arg1})
    51  	fake.lookupEnvMutex.Unlock()
    52  	if stub != nil {
    53  		return stub(arg1)
    54  	}
    55  	if specificReturn {
    56  		return ret.result1, ret.result2
    57  	}
    58  	return fakeReturns.result1, fakeReturns.result2
    59  }
    60  
    61  func (fake *FakeImpl) LookupEnvCallCount() int {
    62  	fake.lookupEnvMutex.RLock()
    63  	defer fake.lookupEnvMutex.RUnlock()
    64  	return len(fake.lookupEnvArgsForCall)
    65  }
    66  
    67  func (fake *FakeImpl) LookupEnvCalls(stub func(string) (string, bool)) {
    68  	fake.lookupEnvMutex.Lock()
    69  	defer fake.lookupEnvMutex.Unlock()
    70  	fake.LookupEnvStub = stub
    71  }
    72  
    73  func (fake *FakeImpl) LookupEnvArgsForCall(i int) string {
    74  	fake.lookupEnvMutex.RLock()
    75  	defer fake.lookupEnvMutex.RUnlock()
    76  	argsForCall := fake.lookupEnvArgsForCall[i]
    77  	return argsForCall.arg1
    78  }
    79  
    80  func (fake *FakeImpl) LookupEnvReturns(result1 string, result2 bool) {
    81  	fake.lookupEnvMutex.Lock()
    82  	defer fake.lookupEnvMutex.Unlock()
    83  	fake.LookupEnvStub = nil
    84  	fake.lookupEnvReturns = struct {
    85  		result1 string
    86  		result2 bool
    87  	}{result1, result2}
    88  }
    89  
    90  func (fake *FakeImpl) LookupEnvReturnsOnCall(i int, result1 string, result2 bool) {
    91  	fake.lookupEnvMutex.Lock()
    92  	defer fake.lookupEnvMutex.Unlock()
    93  	fake.LookupEnvStub = nil
    94  	if fake.lookupEnvReturnsOnCall == nil {
    95  		fake.lookupEnvReturnsOnCall = make(map[int]struct {
    96  			result1 string
    97  			result2 bool
    98  		})
    99  	}
   100  	fake.lookupEnvReturnsOnCall[i] = struct {
   101  		result1 string
   102  		result2 bool
   103  	}{result1, result2}
   104  }
   105  
   106  func (fake *FakeImpl) Invocations() map[string][][]interface{} {
   107  	fake.invocationsMutex.RLock()
   108  	defer fake.invocationsMutex.RUnlock()
   109  	fake.lookupEnvMutex.RLock()
   110  	defer fake.lookupEnvMutex.RUnlock()
   111  	copiedInvocations := map[string][][]interface{}{}
   112  	for key, value := range fake.invocations {
   113  		copiedInvocations[key] = value
   114  	}
   115  	return copiedInvocations
   116  }
   117  
   118  func (fake *FakeImpl) recordInvocation(key string, args []interface{}) {
   119  	fake.invocationsMutex.Lock()
   120  	defer fake.invocationsMutex.Unlock()
   121  	if fake.invocations == nil {
   122  		fake.invocations = map[string][][]interface{}{}
   123  	}
   124  	if fake.invocations[key] == nil {
   125  		fake.invocations[key] = [][]interface{}{}
   126  	}
   127  	fake.invocations[key] = append(fake.invocations[key], args)
   128  }
   129  

View as plain text