github.com/zppinho/prow@v0.0.0-20240510014325-1738badeb017/pkg/plugins/testfreeze/testfreezefakes/fake_verifier.go (about)

     1  /*
     2  Copyright 2022 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 testfreezefakes
    19  
    20  import (
    21  	"sync"
    22  
    23  	"github.com/sirupsen/logrus"
    24  	"sigs.k8s.io/prow/pkg/plugins"
    25  	"sigs.k8s.io/prow/pkg/plugins/testfreeze/checker"
    26  )
    27  
    28  type FakeVerifier struct {
    29  	CheckInTestFreezeStub        func(*logrus.Entry) (*checker.Result, error)
    30  	checkInTestFreezeMutex       sync.RWMutex
    31  	checkInTestFreezeArgsForCall []struct {
    32  		arg1 *logrus.Entry
    33  	}
    34  	checkInTestFreezeReturns struct {
    35  		result1 *checker.Result
    36  		result2 error
    37  	}
    38  	checkInTestFreezeReturnsOnCall map[int]struct {
    39  		result1 *checker.Result
    40  		result2 error
    41  	}
    42  	CreateCommentStub        func(plugins.PluginGitHubClient, string, string, int, string) error
    43  	createCommentMutex       sync.RWMutex
    44  	createCommentArgsForCall []struct {
    45  		arg1 plugins.PluginGitHubClient
    46  		arg2 string
    47  		arg3 string
    48  		arg4 int
    49  		arg5 string
    50  	}
    51  	createCommentReturns struct {
    52  		result1 error
    53  	}
    54  	createCommentReturnsOnCall map[int]struct {
    55  		result1 error
    56  	}
    57  	invocations      map[string][][]interface{}
    58  	invocationsMutex sync.RWMutex
    59  }
    60  
    61  func (fake *FakeVerifier) CheckInTestFreeze(arg1 *logrus.Entry) (*checker.Result, error) {
    62  	fake.checkInTestFreezeMutex.Lock()
    63  	ret, specificReturn := fake.checkInTestFreezeReturnsOnCall[len(fake.checkInTestFreezeArgsForCall)]
    64  	fake.checkInTestFreezeArgsForCall = append(fake.checkInTestFreezeArgsForCall, struct {
    65  		arg1 *logrus.Entry
    66  	}{arg1})
    67  	stub := fake.CheckInTestFreezeStub
    68  	fakeReturns := fake.checkInTestFreezeReturns
    69  	fake.recordInvocation("CheckInTestFreeze", []interface{}{arg1})
    70  	fake.checkInTestFreezeMutex.Unlock()
    71  	if stub != nil {
    72  		return stub(arg1)
    73  	}
    74  	if specificReturn {
    75  		return ret.result1, ret.result2
    76  	}
    77  	return fakeReturns.result1, fakeReturns.result2
    78  }
    79  
    80  func (fake *FakeVerifier) CheckInTestFreezeCallCount() int {
    81  	fake.checkInTestFreezeMutex.RLock()
    82  	defer fake.checkInTestFreezeMutex.RUnlock()
    83  	return len(fake.checkInTestFreezeArgsForCall)
    84  }
    85  
    86  func (fake *FakeVerifier) CheckInTestFreezeCalls(stub func(*logrus.Entry) (*checker.Result, error)) {
    87  	fake.checkInTestFreezeMutex.Lock()
    88  	defer fake.checkInTestFreezeMutex.Unlock()
    89  	fake.CheckInTestFreezeStub = stub
    90  }
    91  
    92  func (fake *FakeVerifier) CheckInTestFreezeArgsForCall(i int) *logrus.Entry {
    93  	fake.checkInTestFreezeMutex.RLock()
    94  	defer fake.checkInTestFreezeMutex.RUnlock()
    95  	argsForCall := fake.checkInTestFreezeArgsForCall[i]
    96  	return argsForCall.arg1
    97  }
    98  
    99  func (fake *FakeVerifier) CheckInTestFreezeReturns(result1 *checker.Result, result2 error) {
   100  	fake.checkInTestFreezeMutex.Lock()
   101  	defer fake.checkInTestFreezeMutex.Unlock()
   102  	fake.CheckInTestFreezeStub = nil
   103  	fake.checkInTestFreezeReturns = struct {
   104  		result1 *checker.Result
   105  		result2 error
   106  	}{result1, result2}
   107  }
   108  
   109  func (fake *FakeVerifier) CheckInTestFreezeReturnsOnCall(i int, result1 *checker.Result, result2 error) {
   110  	fake.checkInTestFreezeMutex.Lock()
   111  	defer fake.checkInTestFreezeMutex.Unlock()
   112  	fake.CheckInTestFreezeStub = nil
   113  	if fake.checkInTestFreezeReturnsOnCall == nil {
   114  		fake.checkInTestFreezeReturnsOnCall = make(map[int]struct {
   115  			result1 *checker.Result
   116  			result2 error
   117  		})
   118  	}
   119  	fake.checkInTestFreezeReturnsOnCall[i] = struct {
   120  		result1 *checker.Result
   121  		result2 error
   122  	}{result1, result2}
   123  }
   124  
   125  func (fake *FakeVerifier) CreateComment(arg1 plugins.PluginGitHubClient, arg2 string, arg3 string, arg4 int, arg5 string) error {
   126  	fake.createCommentMutex.Lock()
   127  	ret, specificReturn := fake.createCommentReturnsOnCall[len(fake.createCommentArgsForCall)]
   128  	fake.createCommentArgsForCall = append(fake.createCommentArgsForCall, struct {
   129  		arg1 plugins.PluginGitHubClient
   130  		arg2 string
   131  		arg3 string
   132  		arg4 int
   133  		arg5 string
   134  	}{arg1, arg2, arg3, arg4, arg5})
   135  	stub := fake.CreateCommentStub
   136  	fakeReturns := fake.createCommentReturns
   137  	fake.recordInvocation("CreateComment", []interface{}{arg1, arg2, arg3, arg4, arg5})
   138  	fake.createCommentMutex.Unlock()
   139  	if stub != nil {
   140  		return stub(arg1, arg2, arg3, arg4, arg5)
   141  	}
   142  	if specificReturn {
   143  		return ret.result1
   144  	}
   145  	return fakeReturns.result1
   146  }
   147  
   148  func (fake *FakeVerifier) CreateCommentCallCount() int {
   149  	fake.createCommentMutex.RLock()
   150  	defer fake.createCommentMutex.RUnlock()
   151  	return len(fake.createCommentArgsForCall)
   152  }
   153  
   154  func (fake *FakeVerifier) CreateCommentCalls(stub func(plugins.PluginGitHubClient, string, string, int, string) error) {
   155  	fake.createCommentMutex.Lock()
   156  	defer fake.createCommentMutex.Unlock()
   157  	fake.CreateCommentStub = stub
   158  }
   159  
   160  func (fake *FakeVerifier) CreateCommentArgsForCall(i int) (plugins.PluginGitHubClient, string, string, int, string) {
   161  	fake.createCommentMutex.RLock()
   162  	defer fake.createCommentMutex.RUnlock()
   163  	argsForCall := fake.createCommentArgsForCall[i]
   164  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5
   165  }
   166  
   167  func (fake *FakeVerifier) CreateCommentReturns(result1 error) {
   168  	fake.createCommentMutex.Lock()
   169  	defer fake.createCommentMutex.Unlock()
   170  	fake.CreateCommentStub = nil
   171  	fake.createCommentReturns = struct {
   172  		result1 error
   173  	}{result1}
   174  }
   175  
   176  func (fake *FakeVerifier) CreateCommentReturnsOnCall(i int, result1 error) {
   177  	fake.createCommentMutex.Lock()
   178  	defer fake.createCommentMutex.Unlock()
   179  	fake.CreateCommentStub = nil
   180  	if fake.createCommentReturnsOnCall == nil {
   181  		fake.createCommentReturnsOnCall = make(map[int]struct {
   182  			result1 error
   183  		})
   184  	}
   185  	fake.createCommentReturnsOnCall[i] = struct {
   186  		result1 error
   187  	}{result1}
   188  }
   189  
   190  func (fake *FakeVerifier) Invocations() map[string][][]interface{} {
   191  	fake.invocationsMutex.RLock()
   192  	defer fake.invocationsMutex.RUnlock()
   193  	fake.checkInTestFreezeMutex.RLock()
   194  	defer fake.checkInTestFreezeMutex.RUnlock()
   195  	fake.createCommentMutex.RLock()
   196  	defer fake.createCommentMutex.RUnlock()
   197  	copiedInvocations := map[string][][]interface{}{}
   198  	for key, value := range fake.invocations {
   199  		copiedInvocations[key] = value
   200  	}
   201  	return copiedInvocations
   202  }
   203  
   204  func (fake *FakeVerifier) recordInvocation(key string, args []interface{}) {
   205  	fake.invocationsMutex.Lock()
   206  	defer fake.invocationsMutex.Unlock()
   207  	if fake.invocations == nil {
   208  		fake.invocations = map[string][][]interface{}{}
   209  	}
   210  	if fake.invocations[key] == nil {
   211  		fake.invocations[key] = [][]interface{}{}
   212  	}
   213  	fake.invocations[key] = append(fake.invocations[key], args)
   214  }