code
stringlengths
22
3.95M
docstring
stringlengths
20
17.8k
func_name
stringlengths
1
472
language
stringclasses
1 value
repo
stringlengths
6
57
path
stringlengths
4
226
url
stringlengths
43
277
license
stringclasses
7 values
func (mmSetName *SpanInterfaceMock) SetNameBeforeCounter() uint64 { return mm_atomic.LoadUint64(&mmSetName.beforeSetNameCounter) }
SetNameBeforeCounter returns a count of SpanInterfaceMock.SetName invocations
SetNameBeforeCounter
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSetName *mSpanInterfaceMockSetName) Calls() []*SpanInterfaceMockSetNameParams { mmSetName.mutex.RLock() argCopy := make([]*SpanInterfaceMockSetNameParams, len(mmSetName.callArgs)) copy(argCopy, mmSetName.callArgs) mmSetName.mutex.RUnlock() return argCopy }
Calls returns a list of arguments used in each call to SpanInterfaceMock.SetName. The list is in the same order as the calls were made (i.e. recent calls have a higher index)
Calls
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (m *SpanInterfaceMock) MinimockSetNameDone() bool { for _, e := range m.SetNameMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { return false } } // if default expectation was set then invocations count should be greater than zero if m.SetNameMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterSetNameCounter) < 1 { return false } // if func was set then invocations count should be greater than zero if m.funcSetName != nil && mm_atomic.LoadUint64(&m.afterSetNameCounter) < 1 { return false } return true }
MinimockSetNameDone returns true if the count of the SetName invocations corresponds the number of defined expectations
MinimockSetNameDone
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSetStatus *mSpanInterfaceMockSetStatus) Expect(status mm_trace.Status) *mSpanInterfaceMockSetStatus { if mmSetStatus.mock.funcSetStatus != nil { mmSetStatus.mock.t.Fatalf("SpanInterfaceMock.SetStatus mock is already set by Set") } if mmSetStatus.defaultExpectation == nil { mmSetStatus.defaultExpectation = &SpanInterfaceMockSetStatusExpectation{} } mmSetStatus.defaultExpectation.params = &SpanInterfaceMockSetStatusParams{status} for _, e := range mmSetStatus.expectations { if minimock.Equal(e.params, mmSetStatus.defaultExpectation.params) { mmSetStatus.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmSetStatus.defaultExpectation.params) } } return mmSetStatus }
Expect sets up expected params for SpanInterface.SetStatus
Expect
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSetStatus *mSpanInterfaceMockSetStatus) Inspect(f func(status mm_trace.Status)) *mSpanInterfaceMockSetStatus { if mmSetStatus.mock.inspectFuncSetStatus != nil { mmSetStatus.mock.t.Fatalf("Inspect function is already set for SpanInterfaceMock.SetStatus") } mmSetStatus.mock.inspectFuncSetStatus = f return mmSetStatus }
Inspect accepts an inspector function that has same arguments as the SpanInterface.SetStatus
Inspect
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSetStatus *mSpanInterfaceMockSetStatus) Return() *SpanInterfaceMock { if mmSetStatus.mock.funcSetStatus != nil { mmSetStatus.mock.t.Fatalf("SpanInterfaceMock.SetStatus mock is already set by Set") } if mmSetStatus.defaultExpectation == nil { mmSetStatus.defaultExpectation = &SpanInterfaceMockSetStatusExpectation{mock: mmSetStatus.mock} } return mmSetStatus.mock }
Return sets up results that will be returned by SpanInterface.SetStatus
Return
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSetStatus *mSpanInterfaceMockSetStatus) Set(f func(status mm_trace.Status)) *SpanInterfaceMock { if mmSetStatus.defaultExpectation != nil { mmSetStatus.mock.t.Fatalf("Default expectation is already set for the SpanInterface.SetStatus method") } if len(mmSetStatus.expectations) > 0 { mmSetStatus.mock.t.Fatalf("Some expectations are already set for the SpanInterface.SetStatus method") } mmSetStatus.mock.funcSetStatus = f return mmSetStatus.mock }
Set uses given function f to mock the SpanInterface.SetStatus method
Set
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSetStatus *SpanInterfaceMock) SetStatusAfterCounter() uint64 { return mm_atomic.LoadUint64(&mmSetStatus.afterSetStatusCounter) }
SetStatusAfterCounter returns a count of finished SpanInterfaceMock.SetStatus invocations
SetStatusAfterCounter
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSetStatus *SpanInterfaceMock) SetStatusBeforeCounter() uint64 { return mm_atomic.LoadUint64(&mmSetStatus.beforeSetStatusCounter) }
SetStatusBeforeCounter returns a count of SpanInterfaceMock.SetStatus invocations
SetStatusBeforeCounter
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSetStatus *mSpanInterfaceMockSetStatus) Calls() []*SpanInterfaceMockSetStatusParams { mmSetStatus.mutex.RLock() argCopy := make([]*SpanInterfaceMockSetStatusParams, len(mmSetStatus.callArgs)) copy(argCopy, mmSetStatus.callArgs) mmSetStatus.mutex.RUnlock() return argCopy }
Calls returns a list of arguments used in each call to SpanInterfaceMock.SetStatus. The list is in the same order as the calls were made (i.e. recent calls have a higher index)
Calls
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (m *SpanInterfaceMock) MinimockSetStatusDone() bool { for _, e := range m.SetStatusMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { return false } } // if default expectation was set then invocations count should be greater than zero if m.SetStatusMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterSetStatusCounter) < 1 { return false } // if func was set then invocations count should be greater than zero if m.funcSetStatus != nil && mm_atomic.LoadUint64(&m.afterSetStatusCounter) < 1 { return false } return true }
MinimockSetStatusDone returns true if the count of the SetStatus invocations corresponds the number of defined expectations
MinimockSetStatusDone
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSpanContext *mSpanInterfaceMockSpanContext) Expect() *mSpanInterfaceMockSpanContext { if mmSpanContext.mock.funcSpanContext != nil { mmSpanContext.mock.t.Fatalf("SpanInterfaceMock.SpanContext mock is already set by Set") } if mmSpanContext.defaultExpectation == nil { mmSpanContext.defaultExpectation = &SpanInterfaceMockSpanContextExpectation{} } return mmSpanContext }
Expect sets up expected params for SpanInterface.SpanContext
Expect
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSpanContext *mSpanInterfaceMockSpanContext) Inspect(f func()) *mSpanInterfaceMockSpanContext { if mmSpanContext.mock.inspectFuncSpanContext != nil { mmSpanContext.mock.t.Fatalf("Inspect function is already set for SpanInterfaceMock.SpanContext") } mmSpanContext.mock.inspectFuncSpanContext = f return mmSpanContext }
Inspect accepts an inspector function that has same arguments as the SpanInterface.SpanContext
Inspect
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSpanContext *mSpanInterfaceMockSpanContext) Return(s1 mm_trace.SpanContext) *SpanInterfaceMock { if mmSpanContext.mock.funcSpanContext != nil { mmSpanContext.mock.t.Fatalf("SpanInterfaceMock.SpanContext mock is already set by Set") } if mmSpanContext.defaultExpectation == nil { mmSpanContext.defaultExpectation = &SpanInterfaceMockSpanContextExpectation{mock: mmSpanContext.mock} } mmSpanContext.defaultExpectation.results = &SpanInterfaceMockSpanContextResults{s1} return mmSpanContext.mock }
Return sets up results that will be returned by SpanInterface.SpanContext
Return
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSpanContext *mSpanInterfaceMockSpanContext) Set(f func() (s1 mm_trace.SpanContext)) *SpanInterfaceMock { if mmSpanContext.defaultExpectation != nil { mmSpanContext.mock.t.Fatalf("Default expectation is already set for the SpanInterface.SpanContext method") } if len(mmSpanContext.expectations) > 0 { mmSpanContext.mock.t.Fatalf("Some expectations are already set for the SpanInterface.SpanContext method") } mmSpanContext.mock.funcSpanContext = f return mmSpanContext.mock }
Set uses given function f to mock the SpanInterface.SpanContext method
Set
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSpanContext *SpanInterfaceMock) SpanContextAfterCounter() uint64 { return mm_atomic.LoadUint64(&mmSpanContext.afterSpanContextCounter) }
SpanContextAfterCounter returns a count of finished SpanInterfaceMock.SpanContext invocations
SpanContextAfterCounter
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmSpanContext *SpanInterfaceMock) SpanContextBeforeCounter() uint64 { return mm_atomic.LoadUint64(&mmSpanContext.beforeSpanContextCounter) }
SpanContextBeforeCounter returns a count of SpanInterfaceMock.SpanContext invocations
SpanContextBeforeCounter
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (m *SpanInterfaceMock) MinimockSpanContextDone() bool { for _, e := range m.SpanContextMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { return false } } // if default expectation was set then invocations count should be greater than zero if m.SpanContextMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterSpanContextCounter) < 1 { return false } // if func was set then invocations count should be greater than zero if m.funcSpanContext != nil && mm_atomic.LoadUint64(&m.afterSpanContextCounter) < 1 { return false } return true }
MinimockSpanContextDone returns true if the count of the SpanContext invocations corresponds the number of defined expectations
MinimockSpanContextDone
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmString *mSpanInterfaceMockString) Expect() *mSpanInterfaceMockString { if mmString.mock.funcString != nil { mmString.mock.t.Fatalf("SpanInterfaceMock.String mock is already set by Set") } if mmString.defaultExpectation == nil { mmString.defaultExpectation = &SpanInterfaceMockStringExpectation{} } return mmString }
Expect sets up expected params for SpanInterface.String
Expect
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmString *mSpanInterfaceMockString) Inspect(f func()) *mSpanInterfaceMockString { if mmString.mock.inspectFuncString != nil { mmString.mock.t.Fatalf("Inspect function is already set for SpanInterfaceMock.String") } mmString.mock.inspectFuncString = f return mmString }
Inspect accepts an inspector function that has same arguments as the SpanInterface.String
Inspect
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmString *mSpanInterfaceMockString) Return(s1 string) *SpanInterfaceMock { if mmString.mock.funcString != nil { mmString.mock.t.Fatalf("SpanInterfaceMock.String mock is already set by Set") } if mmString.defaultExpectation == nil { mmString.defaultExpectation = &SpanInterfaceMockStringExpectation{mock: mmString.mock} } mmString.defaultExpectation.results = &SpanInterfaceMockStringResults{s1} return mmString.mock }
Return sets up results that will be returned by SpanInterface.String
Return
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmString *mSpanInterfaceMockString) Set(f func() (s1 string)) *SpanInterfaceMock { if mmString.defaultExpectation != nil { mmString.mock.t.Fatalf("Default expectation is already set for the SpanInterface.String method") } if len(mmString.expectations) > 0 { mmString.mock.t.Fatalf("Some expectations are already set for the SpanInterface.String method") } mmString.mock.funcString = f return mmString.mock }
Set uses given function f to mock the SpanInterface.String method
Set
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmString *SpanInterfaceMock) StringAfterCounter() uint64 { return mm_atomic.LoadUint64(&mmString.afterStringCounter) }
StringAfterCounter returns a count of finished SpanInterfaceMock.String invocations
StringAfterCounter
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (mmString *SpanInterfaceMock) StringBeforeCounter() uint64 { return mm_atomic.LoadUint64(&mmString.beforeStringCounter) }
StringBeforeCounter returns a count of SpanInterfaceMock.String invocations
StringBeforeCounter
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (m *SpanInterfaceMock) MinimockStringDone() bool { for _, e := range m.StringMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { return false } } // if default expectation was set then invocations count should be greater than zero if m.StringMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterStringCounter) < 1 { return false } // if func was set then invocations count should be greater than zero if m.funcString != nil && mm_atomic.LoadUint64(&m.afterStringCounter) < 1 { return false } return true }
MinimockStringDone returns true if the count of the String invocations corresponds the number of defined expectations
MinimockStringDone
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (m *SpanInterfaceMock) MinimockFinish() { if !m.minimockDone() { m.MinimockAddAttributesInspect() m.MinimockAddLinkInspect() m.MinimockAddMessageReceiveEventInspect() m.MinimockAddMessageSendEventInspect() m.MinimockAnnotateInspect() m.MinimockAnnotatefInspect() m.MinimockEndInspect() m.MinimockIsRecordingEventsInspect() m.MinimockSetNameInspect() m.MinimockSetStatusInspect() m.MinimockSpanContextInspect() m.MinimockStringInspect() m.t.FailNow() } }
MinimockFinish checks that all mocked methods have been called the expected number of times
MinimockFinish
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func (m *SpanInterfaceMock) MinimockWait(timeout mm_time.Duration) { timeoutCh := mm_time.After(timeout) for { if m.minimockDone() { return } select { case <-timeoutCh: m.MinimockFinish() return case <-mm_time.After(10 * mm_time.Millisecond): } } }
MinimockWait waits for all mocked methods to be called the expected number of times
MinimockWait
go
hexdigest/gowrap
templates_tests/span_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_opencensus_mock_test.go
MIT
func NewTracerMock(t minimock.Tester) *TracerMock { m := &TracerMock{t: t} if controller, ok := t.(minimock.MockController); ok { controller.RegisterMocker(m) } m.ExtractMock = mTracerMockExtract{mock: m} m.InjectMock = mTracerMockInject{mock: m} m.StartSpanMock = mTracerMockStartSpan{mock: m} return m }
NewTracerMock returns a mock for github.com/opentracing/opentracing-go.Tracer
NewTracerMock
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *mTracerMockExtract) Expect(p interface{}, p1 interface{}) *mTracerMockExtract { m.mockExpectations = &TracerMockExtractParams{p, p1} return m }
Expect sets up expected params for the Tracer.Extract
Expect
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *mTracerMockExtract) Return(r opentracing.SpanContext, r1 error) *TracerMock { m.mock.ExtractFunc = func(p interface{}, p1 interface{}) (opentracing.SpanContext, error) { return r, r1 } return m.mock }
Return sets up a mock for Tracer.Extract to return Return's arguments
Return
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *mTracerMockExtract) Set(f func(p interface{}, p1 interface{}) (r opentracing.SpanContext, r1 error)) *TracerMock { m.mock.ExtractFunc = f return m.mock }
Set uses given function f as a mock of Tracer.Extract method
Set
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) Extract(p interface{}, p1 interface{}) (r opentracing.SpanContext, r1 error) { atomic.AddUint64(&m.ExtractPreCounter, 1) defer atomic.AddUint64(&m.ExtractCounter, 1) if m.ExtractMock.mockExpectations != nil { testify_assert.Equal(m.t, *m.ExtractMock.mockExpectations, TracerMockExtractParams{p, p1}, "Tracer.Extract got unexpected parameters") if m.ExtractFunc == nil { m.t.Fatal("No results are set for the TracerMock.Extract") return } } if m.ExtractFunc == nil { m.t.Fatal("Unexpected call to TracerMock.Extract") return } return m.ExtractFunc(p, p1) }
Extract implements github.com/opentracing/opentracing-go.Tracer interface
Extract
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) ExtractMinimockCounter() uint64 { return atomic.LoadUint64(&m.ExtractCounter) }
ExtractMinimockCounter returns a count of TracerMock.ExtractFunc invocations
ExtractMinimockCounter
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) ExtractMinimockPreCounter() uint64 { return atomic.LoadUint64(&m.ExtractPreCounter) }
ExtractMinimockPreCounter returns the value of TracerMock.Extract invocations
ExtractMinimockPreCounter
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *mTracerMockInject) Expect(p opentracing.SpanContext, p1 interface{}, p2 interface{}) *mTracerMockInject { m.mockExpectations = &TracerMockInjectParams{p, p1, p2} return m }
Expect sets up expected params for the Tracer.Inject
Expect
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *mTracerMockInject) Return(r error) *TracerMock { m.mock.InjectFunc = func(p opentracing.SpanContext, p1 interface{}, p2 interface{}) error { return r } return m.mock }
Return sets up a mock for Tracer.Inject to return Return's arguments
Return
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *mTracerMockInject) Set(f func(p opentracing.SpanContext, p1 interface{}, p2 interface{}) (r error)) *TracerMock { m.mock.InjectFunc = f return m.mock }
Set uses given function f as a mock of Tracer.Inject method
Set
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) Inject(p opentracing.SpanContext, p1 interface{}, p2 interface{}) (r error) { atomic.AddUint64(&m.InjectPreCounter, 1) defer atomic.AddUint64(&m.InjectCounter, 1) if m.InjectMock.mockExpectations != nil { testify_assert.Equal(m.t, *m.InjectMock.mockExpectations, TracerMockInjectParams{p, p1, p2}, "Tracer.Inject got unexpected parameters") if m.InjectFunc == nil { m.t.Fatal("No results are set for the TracerMock.Inject") return } } if m.InjectFunc == nil { m.t.Fatal("Unexpected call to TracerMock.Inject") return } return m.InjectFunc(p, p1, p2) }
Inject implements github.com/opentracing/opentracing-go.Tracer interface
Inject
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) InjectMinimockCounter() uint64 { return atomic.LoadUint64(&m.InjectCounter) }
InjectMinimockCounter returns a count of TracerMock.InjectFunc invocations
InjectMinimockCounter
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) InjectMinimockPreCounter() uint64 { return atomic.LoadUint64(&m.InjectPreCounter) }
InjectMinimockPreCounter returns the value of TracerMock.Inject invocations
InjectMinimockPreCounter
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *mTracerMockStartSpan) Expect(p string, p1 ...opentracing.StartSpanOption) *mTracerMockStartSpan { m.mockExpectations = &TracerMockStartSpanParams{p, p1} return m }
Expect sets up expected params for the Tracer.StartSpan
Expect
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *mTracerMockStartSpan) Return(r opentracing.Span) *TracerMock { m.mock.StartSpanFunc = func(p string, p1 ...opentracing.StartSpanOption) opentracing.Span { return r } return m.mock }
Return sets up a mock for Tracer.StartSpan to return Return's arguments
Return
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *mTracerMockStartSpan) Set(f func(p string, p1 ...opentracing.StartSpanOption) (r opentracing.Span)) *TracerMock { m.mock.StartSpanFunc = f return m.mock }
Set uses given function f as a mock of Tracer.StartSpan method
Set
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) StartSpan(p string, p1 ...opentracing.StartSpanOption) (r opentracing.Span) { atomic.AddUint64(&m.StartSpanPreCounter, 1) defer atomic.AddUint64(&m.StartSpanCounter, 1) if m.StartSpanMock.mockExpectations != nil { testify_assert.Equal(m.t, *m.StartSpanMock.mockExpectations, TracerMockStartSpanParams{p, p1}, "Tracer.StartSpan got unexpected parameters") if m.StartSpanFunc == nil { m.t.Fatal("No results are set for the TracerMock.StartSpan") return } } if m.StartSpanFunc == nil { m.t.Fatal("Unexpected call to TracerMock.StartSpan") return } return m.StartSpanFunc(p, p1...) }
StartSpan implements github.com/opentracing/opentracing-go.Tracer interface
StartSpan
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) StartSpanMinimockCounter() uint64 { return atomic.LoadUint64(&m.StartSpanCounter) }
StartSpanMinimockCounter returns a count of TracerMock.StartSpanFunc invocations
StartSpanMinimockCounter
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) StartSpanMinimockPreCounter() uint64 { return atomic.LoadUint64(&m.StartSpanPreCounter) }
StartSpanMinimockPreCounter returns the value of TracerMock.StartSpan invocations
StartSpanMinimockPreCounter
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) ValidateCallCounters() { if m.ExtractFunc != nil && atomic.LoadUint64(&m.ExtractCounter) == 0 { m.t.Fatal("Expected call to TracerMock.Extract") } if m.InjectFunc != nil && atomic.LoadUint64(&m.InjectCounter) == 0 { m.t.Fatal("Expected call to TracerMock.Inject") } if m.StartSpanFunc != nil && atomic.LoadUint64(&m.StartSpanCounter) == 0 { m.t.Fatal("Expected call to TracerMock.StartSpan") } }
ValidateCallCounters checks that all mocked methods of the interface have been called at least once Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller
ValidateCallCounters
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) MinimockFinish() { if m.ExtractFunc != nil && atomic.LoadUint64(&m.ExtractCounter) == 0 { m.t.Fatal("Expected call to TracerMock.Extract") } if m.InjectFunc != nil && atomic.LoadUint64(&m.InjectCounter) == 0 { m.t.Fatal("Expected call to TracerMock.Inject") } if m.StartSpanFunc != nil && atomic.LoadUint64(&m.StartSpanCounter) == 0 { m.t.Fatal("Expected call to TracerMock.StartSpan") } }
MinimockFinish checks that all mocked methods of the interface have been called at least once
MinimockFinish
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) MinimockWait(timeout time.Duration) { timeoutCh := time.After(timeout) for { ok := true ok = ok && (m.ExtractFunc == nil || atomic.LoadUint64(&m.ExtractCounter) > 0) ok = ok && (m.InjectFunc == nil || atomic.LoadUint64(&m.InjectCounter) > 0) ok = ok && (m.StartSpanFunc == nil || atomic.LoadUint64(&m.StartSpanCounter) > 0) if ok { return } select { case <-timeoutCh: if m.ExtractFunc != nil && atomic.LoadUint64(&m.ExtractCounter) == 0 { m.t.Error("Expected call to TracerMock.Extract") } if m.InjectFunc != nil && atomic.LoadUint64(&m.InjectCounter) == 0 { m.t.Error("Expected call to TracerMock.Inject") } if m.StartSpanFunc != nil && atomic.LoadUint64(&m.StartSpanCounter) == 0 { m.t.Error("Expected call to TracerMock.StartSpan") } m.t.Fatalf("Some mocks were not called on time: %s", timeout) return default: time.Sleep(time.Millisecond) } } }
MinimockWait waits for all mocked methods to be called at least once this method is called by minimock.Controller
MinimockWait
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func (m *TracerMock) AllMocksCalled() bool { if m.ExtractFunc != nil && atomic.LoadUint64(&m.ExtractCounter) == 0 { return false } if m.InjectFunc != nil && atomic.LoadUint64(&m.InjectCounter) == 0 { return false } if m.StartSpanFunc != nil && atomic.LoadUint64(&m.StartSpanCounter) == 0 { return false } return true }
AllMocksCalled returns true if all mocked methods were called before the execution of AllMocksCalled, it can be used with assert/require, i.e. assert.True(mock.AllMocksCalled())
AllMocksCalled
go
hexdigest/gowrap
templates_tests/tracer_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_mock_test.go
MIT
func NewTracerOpenCensusMock(t minimock.Tester) *TracerOpenCensusMock { m := &TracerOpenCensusMock{t: t} if controller, ok := t.(minimock.MockController); ok { controller.RegisterMocker(m) } m.FromContextMock = mTracerOpenCensusMockFromContext{mock: m} m.FromContextMock.callArgs = []*TracerOpenCensusMockFromContextParams{} m.NewContextMock = mTracerOpenCensusMockNewContext{mock: m} m.NewContextMock.callArgs = []*TracerOpenCensusMockNewContextParams{} m.StartSpanMock = mTracerOpenCensusMockStartSpan{mock: m} m.StartSpanMock.callArgs = []*TracerOpenCensusMockStartSpanParams{} m.StartSpanWithRemoteParentMock = mTracerOpenCensusMockStartSpanWithRemoteParent{mock: m} m.StartSpanWithRemoteParentMock.callArgs = []*TracerOpenCensusMockStartSpanWithRemoteParentParams{} return m }
NewTracerOpenCensusMock returns a mock for trace.Tracer
NewTracerOpenCensusMock
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmFromContext *mTracerOpenCensusMockFromContext) Expect(ctx context.Context) *mTracerOpenCensusMockFromContext { if mmFromContext.mock.funcFromContext != nil { mmFromContext.mock.t.Fatalf("TracerOpenCensusMock.FromContext mock is already set by Set") } if mmFromContext.defaultExpectation == nil { mmFromContext.defaultExpectation = &TracerOpenCensusMockFromContextExpectation{} } mmFromContext.defaultExpectation.params = &TracerOpenCensusMockFromContextParams{ctx} for _, e := range mmFromContext.expectations { if minimock.Equal(e.params, mmFromContext.defaultExpectation.params) { mmFromContext.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmFromContext.defaultExpectation.params) } } return mmFromContext }
Expect sets up expected params for Tracer.FromContext
Expect
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmFromContext *mTracerOpenCensusMockFromContext) Inspect(f func(ctx context.Context)) *mTracerOpenCensusMockFromContext { if mmFromContext.mock.inspectFuncFromContext != nil { mmFromContext.mock.t.Fatalf("Inspect function is already set for TracerOpenCensusMock.FromContext") } mmFromContext.mock.inspectFuncFromContext = f return mmFromContext }
Inspect accepts an inspector function that has same arguments as the Tracer.FromContext
Inspect
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmFromContext *mTracerOpenCensusMockFromContext) Return(sp1 *mm_trace.Span) *TracerOpenCensusMock { if mmFromContext.mock.funcFromContext != nil { mmFromContext.mock.t.Fatalf("TracerOpenCensusMock.FromContext mock is already set by Set") } if mmFromContext.defaultExpectation == nil { mmFromContext.defaultExpectation = &TracerOpenCensusMockFromContextExpectation{mock: mmFromContext.mock} } mmFromContext.defaultExpectation.results = &TracerOpenCensusMockFromContextResults{sp1} return mmFromContext.mock }
Return sets up results that will be returned by Tracer.FromContext
Return
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmFromContext *mTracerOpenCensusMockFromContext) Set(f func(ctx context.Context) (sp1 *mm_trace.Span)) *TracerOpenCensusMock { if mmFromContext.defaultExpectation != nil { mmFromContext.mock.t.Fatalf("Default expectation is already set for the Tracer.FromContext method") } if len(mmFromContext.expectations) > 0 { mmFromContext.mock.t.Fatalf("Some expectations are already set for the Tracer.FromContext method") } mmFromContext.mock.funcFromContext = f return mmFromContext.mock }
Set uses given function f to mock the Tracer.FromContext method
Set
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmFromContext *mTracerOpenCensusMockFromContext) When(ctx context.Context) *TracerOpenCensusMockFromContextExpectation { if mmFromContext.mock.funcFromContext != nil { mmFromContext.mock.t.Fatalf("TracerOpenCensusMock.FromContext mock is already set by Set") } expectation := &TracerOpenCensusMockFromContextExpectation{ mock: mmFromContext.mock, params: &TracerOpenCensusMockFromContextParams{ctx}, } mmFromContext.expectations = append(mmFromContext.expectations, expectation) return expectation }
When sets expectation for the Tracer.FromContext which will trigger the result defined by the following Then helper
When
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (e *TracerOpenCensusMockFromContextExpectation) Then(sp1 *mm_trace.Span) *TracerOpenCensusMock { e.results = &TracerOpenCensusMockFromContextResults{sp1} return e.mock }
Then sets up Tracer.FromContext return parameters for the expectation previously defined by the When method
Then
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmFromContext *TracerOpenCensusMock) FromContextAfterCounter() uint64 { return mm_atomic.LoadUint64(&mmFromContext.afterFromContextCounter) }
FromContextAfterCounter returns a count of finished TracerOpenCensusMock.FromContext invocations
FromContextAfterCounter
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmFromContext *TracerOpenCensusMock) FromContextBeforeCounter() uint64 { return mm_atomic.LoadUint64(&mmFromContext.beforeFromContextCounter) }
FromContextBeforeCounter returns a count of TracerOpenCensusMock.FromContext invocations
FromContextBeforeCounter
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmFromContext *mTracerOpenCensusMockFromContext) Calls() []*TracerOpenCensusMockFromContextParams { mmFromContext.mutex.RLock() argCopy := make([]*TracerOpenCensusMockFromContextParams, len(mmFromContext.callArgs)) copy(argCopy, mmFromContext.callArgs) mmFromContext.mutex.RUnlock() return argCopy }
Calls returns a list of arguments used in each call to TracerOpenCensusMock.FromContext. The list is in the same order as the calls were made (i.e. recent calls have a higher index)
Calls
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (m *TracerOpenCensusMock) MinimockFromContextDone() bool { for _, e := range m.FromContextMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { return false } } // if default expectation was set then invocations count should be greater than zero if m.FromContextMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterFromContextCounter) < 1 { return false } // if func was set then invocations count should be greater than zero if m.funcFromContext != nil && mm_atomic.LoadUint64(&m.afterFromContextCounter) < 1 { return false } return true }
MinimockFromContextDone returns true if the count of the FromContext invocations corresponds the number of defined expectations
MinimockFromContextDone
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmNewContext *mTracerOpenCensusMockNewContext) Expect(ctx context.Context, s *mm_trace.Span) *mTracerOpenCensusMockNewContext { if mmNewContext.mock.funcNewContext != nil { mmNewContext.mock.t.Fatalf("TracerOpenCensusMock.NewContext mock is already set by Set") } if mmNewContext.defaultExpectation == nil { mmNewContext.defaultExpectation = &TracerOpenCensusMockNewContextExpectation{} } mmNewContext.defaultExpectation.params = &TracerOpenCensusMockNewContextParams{ctx, s} for _, e := range mmNewContext.expectations { if minimock.Equal(e.params, mmNewContext.defaultExpectation.params) { mmNewContext.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmNewContext.defaultExpectation.params) } } return mmNewContext }
Expect sets up expected params for Tracer.NewContext
Expect
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmNewContext *mTracerOpenCensusMockNewContext) Inspect(f func(ctx context.Context, s *mm_trace.Span)) *mTracerOpenCensusMockNewContext { if mmNewContext.mock.inspectFuncNewContext != nil { mmNewContext.mock.t.Fatalf("Inspect function is already set for TracerOpenCensusMock.NewContext") } mmNewContext.mock.inspectFuncNewContext = f return mmNewContext }
Inspect accepts an inspector function that has same arguments as the Tracer.NewContext
Inspect
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmNewContext *mTracerOpenCensusMockNewContext) Return(c1 context.Context) *TracerOpenCensusMock { if mmNewContext.mock.funcNewContext != nil { mmNewContext.mock.t.Fatalf("TracerOpenCensusMock.NewContext mock is already set by Set") } if mmNewContext.defaultExpectation == nil { mmNewContext.defaultExpectation = &TracerOpenCensusMockNewContextExpectation{mock: mmNewContext.mock} } mmNewContext.defaultExpectation.results = &TracerOpenCensusMockNewContextResults{c1} return mmNewContext.mock }
Return sets up results that will be returned by Tracer.NewContext
Return
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmNewContext *mTracerOpenCensusMockNewContext) Set(f func(ctx context.Context, s *mm_trace.Span) (c1 context.Context)) *TracerOpenCensusMock { if mmNewContext.defaultExpectation != nil { mmNewContext.mock.t.Fatalf("Default expectation is already set for the Tracer.NewContext method") } if len(mmNewContext.expectations) > 0 { mmNewContext.mock.t.Fatalf("Some expectations are already set for the Tracer.NewContext method") } mmNewContext.mock.funcNewContext = f return mmNewContext.mock }
Set uses given function f to mock the Tracer.NewContext method
Set
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmNewContext *mTracerOpenCensusMockNewContext) When(ctx context.Context, s *mm_trace.Span) *TracerOpenCensusMockNewContextExpectation { if mmNewContext.mock.funcNewContext != nil { mmNewContext.mock.t.Fatalf("TracerOpenCensusMock.NewContext mock is already set by Set") } expectation := &TracerOpenCensusMockNewContextExpectation{ mock: mmNewContext.mock, params: &TracerOpenCensusMockNewContextParams{ctx, s}, } mmNewContext.expectations = append(mmNewContext.expectations, expectation) return expectation }
When sets expectation for the Tracer.NewContext which will trigger the result defined by the following Then helper
When
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (e *TracerOpenCensusMockNewContextExpectation) Then(c1 context.Context) *TracerOpenCensusMock { e.results = &TracerOpenCensusMockNewContextResults{c1} return e.mock }
Then sets up Tracer.NewContext return parameters for the expectation previously defined by the When method
Then
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmNewContext *TracerOpenCensusMock) NewContextAfterCounter() uint64 { return mm_atomic.LoadUint64(&mmNewContext.afterNewContextCounter) }
NewContextAfterCounter returns a count of finished TracerOpenCensusMock.NewContext invocations
NewContextAfterCounter
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmNewContext *TracerOpenCensusMock) NewContextBeforeCounter() uint64 { return mm_atomic.LoadUint64(&mmNewContext.beforeNewContextCounter) }
NewContextBeforeCounter returns a count of TracerOpenCensusMock.NewContext invocations
NewContextBeforeCounter
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmNewContext *mTracerOpenCensusMockNewContext) Calls() []*TracerOpenCensusMockNewContextParams { mmNewContext.mutex.RLock() argCopy := make([]*TracerOpenCensusMockNewContextParams, len(mmNewContext.callArgs)) copy(argCopy, mmNewContext.callArgs) mmNewContext.mutex.RUnlock() return argCopy }
Calls returns a list of arguments used in each call to TracerOpenCensusMock.NewContext. The list is in the same order as the calls were made (i.e. recent calls have a higher index)
Calls
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (m *TracerOpenCensusMock) MinimockNewContextDone() bool { for _, e := range m.NewContextMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { return false } } // if default expectation was set then invocations count should be greater than zero if m.NewContextMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterNewContextCounter) < 1 { return false } // if func was set then invocations count should be greater than zero if m.funcNewContext != nil && mm_atomic.LoadUint64(&m.afterNewContextCounter) < 1 { return false } return true }
MinimockNewContextDone returns true if the count of the NewContext invocations corresponds the number of defined expectations
MinimockNewContextDone
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpan *mTracerOpenCensusMockStartSpan) Expect(ctx context.Context, name string, o ...mm_trace.StartOption) *mTracerOpenCensusMockStartSpan { if mmStartSpan.mock.funcStartSpan != nil { mmStartSpan.mock.t.Fatalf("TracerOpenCensusMock.StartSpan mock is already set by Set") } if mmStartSpan.defaultExpectation == nil { mmStartSpan.defaultExpectation = &TracerOpenCensusMockStartSpanExpectation{} } mmStartSpan.defaultExpectation.params = &TracerOpenCensusMockStartSpanParams{ctx, name, o} for _, e := range mmStartSpan.expectations { if minimock.Equal(e.params, mmStartSpan.defaultExpectation.params) { mmStartSpan.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmStartSpan.defaultExpectation.params) } } return mmStartSpan }
Expect sets up expected params for Tracer.StartSpan
Expect
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpan *mTracerOpenCensusMockStartSpan) Inspect(f func(ctx context.Context, name string, o ...mm_trace.StartOption)) *mTracerOpenCensusMockStartSpan { if mmStartSpan.mock.inspectFuncStartSpan != nil { mmStartSpan.mock.t.Fatalf("Inspect function is already set for TracerOpenCensusMock.StartSpan") } mmStartSpan.mock.inspectFuncStartSpan = f return mmStartSpan }
Inspect accepts an inspector function that has same arguments as the Tracer.StartSpan
Inspect
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpan *mTracerOpenCensusMockStartSpan) Return(c2 context.Context, sp1 *mm_trace.Span) *TracerOpenCensusMock { if mmStartSpan.mock.funcStartSpan != nil { mmStartSpan.mock.t.Fatalf("TracerOpenCensusMock.StartSpan mock is already set by Set") } if mmStartSpan.defaultExpectation == nil { mmStartSpan.defaultExpectation = &TracerOpenCensusMockStartSpanExpectation{mock: mmStartSpan.mock} } mmStartSpan.defaultExpectation.results = &TracerOpenCensusMockStartSpanResults{c2, sp1} return mmStartSpan.mock }
Return sets up results that will be returned by Tracer.StartSpan
Return
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpan *mTracerOpenCensusMockStartSpan) Set(f func(ctx context.Context, name string, o ...mm_trace.StartOption) (c2 context.Context, sp1 *mm_trace.Span)) *TracerOpenCensusMock { if mmStartSpan.defaultExpectation != nil { mmStartSpan.mock.t.Fatalf("Default expectation is already set for the Tracer.StartSpan method") } if len(mmStartSpan.expectations) > 0 { mmStartSpan.mock.t.Fatalf("Some expectations are already set for the Tracer.StartSpan method") } mmStartSpan.mock.funcStartSpan = f return mmStartSpan.mock }
Set uses given function f to mock the Tracer.StartSpan method
Set
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpan *mTracerOpenCensusMockStartSpan) When(ctx context.Context, name string, o ...mm_trace.StartOption) *TracerOpenCensusMockStartSpanExpectation { if mmStartSpan.mock.funcStartSpan != nil { mmStartSpan.mock.t.Fatalf("TracerOpenCensusMock.StartSpan mock is already set by Set") } expectation := &TracerOpenCensusMockStartSpanExpectation{ mock: mmStartSpan.mock, params: &TracerOpenCensusMockStartSpanParams{ctx, name, o}, } mmStartSpan.expectations = append(mmStartSpan.expectations, expectation) return expectation }
When sets expectation for the Tracer.StartSpan which will trigger the result defined by the following Then helper
When
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (e *TracerOpenCensusMockStartSpanExpectation) Then(c2 context.Context, sp1 *mm_trace.Span) *TracerOpenCensusMock { e.results = &TracerOpenCensusMockStartSpanResults{c2, sp1} return e.mock }
Then sets up Tracer.StartSpan return parameters for the expectation previously defined by the When method
Then
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpan *TracerOpenCensusMock) StartSpanAfterCounter() uint64 { return mm_atomic.LoadUint64(&mmStartSpan.afterStartSpanCounter) }
StartSpanAfterCounter returns a count of finished TracerOpenCensusMock.StartSpan invocations
StartSpanAfterCounter
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpan *TracerOpenCensusMock) StartSpanBeforeCounter() uint64 { return mm_atomic.LoadUint64(&mmStartSpan.beforeStartSpanCounter) }
StartSpanBeforeCounter returns a count of TracerOpenCensusMock.StartSpan invocations
StartSpanBeforeCounter
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpan *mTracerOpenCensusMockStartSpan) Calls() []*TracerOpenCensusMockStartSpanParams { mmStartSpan.mutex.RLock() argCopy := make([]*TracerOpenCensusMockStartSpanParams, len(mmStartSpan.callArgs)) copy(argCopy, mmStartSpan.callArgs) mmStartSpan.mutex.RUnlock() return argCopy }
Calls returns a list of arguments used in each call to TracerOpenCensusMock.StartSpan. The list is in the same order as the calls were made (i.e. recent calls have a higher index)
Calls
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (m *TracerOpenCensusMock) MinimockStartSpanDone() bool { for _, e := range m.StartSpanMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { return false } } // if default expectation was set then invocations count should be greater than zero if m.StartSpanMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterStartSpanCounter) < 1 { return false } // if func was set then invocations count should be greater than zero if m.funcStartSpan != nil && mm_atomic.LoadUint64(&m.afterStartSpanCounter) < 1 { return false } return true }
MinimockStartSpanDone returns true if the count of the StartSpan invocations corresponds the number of defined expectations
MinimockStartSpanDone
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpanWithRemoteParent *mTracerOpenCensusMockStartSpanWithRemoteParent) Expect(ctx context.Context, name string, parent mm_trace.SpanContext, o ...mm_trace.StartOption) *mTracerOpenCensusMockStartSpanWithRemoteParent { if mmStartSpanWithRemoteParent.mock.funcStartSpanWithRemoteParent != nil { mmStartSpanWithRemoteParent.mock.t.Fatalf("TracerOpenCensusMock.StartSpanWithRemoteParent mock is already set by Set") } if mmStartSpanWithRemoteParent.defaultExpectation == nil { mmStartSpanWithRemoteParent.defaultExpectation = &TracerOpenCensusMockStartSpanWithRemoteParentExpectation{} } mmStartSpanWithRemoteParent.defaultExpectation.params = &TracerOpenCensusMockStartSpanWithRemoteParentParams{ctx, name, parent, o} for _, e := range mmStartSpanWithRemoteParent.expectations { if minimock.Equal(e.params, mmStartSpanWithRemoteParent.defaultExpectation.params) { mmStartSpanWithRemoteParent.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmStartSpanWithRemoteParent.defaultExpectation.params) } } return mmStartSpanWithRemoteParent }
Expect sets up expected params for Tracer.StartSpanWithRemoteParent
Expect
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpanWithRemoteParent *mTracerOpenCensusMockStartSpanWithRemoteParent) Inspect(f func(ctx context.Context, name string, parent mm_trace.SpanContext, o ...mm_trace.StartOption)) *mTracerOpenCensusMockStartSpanWithRemoteParent { if mmStartSpanWithRemoteParent.mock.inspectFuncStartSpanWithRemoteParent != nil { mmStartSpanWithRemoteParent.mock.t.Fatalf("Inspect function is already set for TracerOpenCensusMock.StartSpanWithRemoteParent") } mmStartSpanWithRemoteParent.mock.inspectFuncStartSpanWithRemoteParent = f return mmStartSpanWithRemoteParent }
Inspect accepts an inspector function that has same arguments as the Tracer.StartSpanWithRemoteParent
Inspect
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpanWithRemoteParent *mTracerOpenCensusMockStartSpanWithRemoteParent) Return(c2 context.Context, sp1 *mm_trace.Span) *TracerOpenCensusMock { if mmStartSpanWithRemoteParent.mock.funcStartSpanWithRemoteParent != nil { mmStartSpanWithRemoteParent.mock.t.Fatalf("TracerOpenCensusMock.StartSpanWithRemoteParent mock is already set by Set") } if mmStartSpanWithRemoteParent.defaultExpectation == nil { mmStartSpanWithRemoteParent.defaultExpectation = &TracerOpenCensusMockStartSpanWithRemoteParentExpectation{mock: mmStartSpanWithRemoteParent.mock} } mmStartSpanWithRemoteParent.defaultExpectation.results = &TracerOpenCensusMockStartSpanWithRemoteParentResults{c2, sp1} return mmStartSpanWithRemoteParent.mock }
Return sets up results that will be returned by Tracer.StartSpanWithRemoteParent
Return
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpanWithRemoteParent *mTracerOpenCensusMockStartSpanWithRemoteParent) Set(f func(ctx context.Context, name string, parent mm_trace.SpanContext, o ...mm_trace.StartOption) (c2 context.Context, sp1 *mm_trace.Span)) *TracerOpenCensusMock { if mmStartSpanWithRemoteParent.defaultExpectation != nil { mmStartSpanWithRemoteParent.mock.t.Fatalf("Default expectation is already set for the Tracer.StartSpanWithRemoteParent method") } if len(mmStartSpanWithRemoteParent.expectations) > 0 { mmStartSpanWithRemoteParent.mock.t.Fatalf("Some expectations are already set for the Tracer.StartSpanWithRemoteParent method") } mmStartSpanWithRemoteParent.mock.funcStartSpanWithRemoteParent = f return mmStartSpanWithRemoteParent.mock }
Set uses given function f to mock the Tracer.StartSpanWithRemoteParent method
Set
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpanWithRemoteParent *mTracerOpenCensusMockStartSpanWithRemoteParent) When(ctx context.Context, name string, parent mm_trace.SpanContext, o ...mm_trace.StartOption) *TracerOpenCensusMockStartSpanWithRemoteParentExpectation { if mmStartSpanWithRemoteParent.mock.funcStartSpanWithRemoteParent != nil { mmStartSpanWithRemoteParent.mock.t.Fatalf("TracerOpenCensusMock.StartSpanWithRemoteParent mock is already set by Set") } expectation := &TracerOpenCensusMockStartSpanWithRemoteParentExpectation{ mock: mmStartSpanWithRemoteParent.mock, params: &TracerOpenCensusMockStartSpanWithRemoteParentParams{ctx, name, parent, o}, } mmStartSpanWithRemoteParent.expectations = append(mmStartSpanWithRemoteParent.expectations, expectation) return expectation }
When sets expectation for the Tracer.StartSpanWithRemoteParent which will trigger the result defined by the following Then helper
When
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (e *TracerOpenCensusMockStartSpanWithRemoteParentExpectation) Then(c2 context.Context, sp1 *mm_trace.Span) *TracerOpenCensusMock { e.results = &TracerOpenCensusMockStartSpanWithRemoteParentResults{c2, sp1} return e.mock }
Then sets up Tracer.StartSpanWithRemoteParent return parameters for the expectation previously defined by the When method
Then
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpanWithRemoteParent *TracerOpenCensusMock) StartSpanWithRemoteParentAfterCounter() uint64 { return mm_atomic.LoadUint64(&mmStartSpanWithRemoteParent.afterStartSpanWithRemoteParentCounter) }
StartSpanWithRemoteParentAfterCounter returns a count of finished TracerOpenCensusMock.StartSpanWithRemoteParent invocations
StartSpanWithRemoteParentAfterCounter
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpanWithRemoteParent *TracerOpenCensusMock) StartSpanWithRemoteParentBeforeCounter() uint64 { return mm_atomic.LoadUint64(&mmStartSpanWithRemoteParent.beforeStartSpanWithRemoteParentCounter) }
StartSpanWithRemoteParentBeforeCounter returns a count of TracerOpenCensusMock.StartSpanWithRemoteParent invocations
StartSpanWithRemoteParentBeforeCounter
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (mmStartSpanWithRemoteParent *mTracerOpenCensusMockStartSpanWithRemoteParent) Calls() []*TracerOpenCensusMockStartSpanWithRemoteParentParams { mmStartSpanWithRemoteParent.mutex.RLock() argCopy := make([]*TracerOpenCensusMockStartSpanWithRemoteParentParams, len(mmStartSpanWithRemoteParent.callArgs)) copy(argCopy, mmStartSpanWithRemoteParent.callArgs) mmStartSpanWithRemoteParent.mutex.RUnlock() return argCopy }
Calls returns a list of arguments used in each call to TracerOpenCensusMock.StartSpanWithRemoteParent. The list is in the same order as the calls were made (i.e. recent calls have a higher index)
Calls
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (m *TracerOpenCensusMock) MinimockStartSpanWithRemoteParentDone() bool { for _, e := range m.StartSpanWithRemoteParentMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { return false } } // if default expectation was set then invocations count should be greater than zero if m.StartSpanWithRemoteParentMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterStartSpanWithRemoteParentCounter) < 1 { return false } // if func was set then invocations count should be greater than zero if m.funcStartSpanWithRemoteParent != nil && mm_atomic.LoadUint64(&m.afterStartSpanWithRemoteParentCounter) < 1 { return false } return true }
MinimockStartSpanWithRemoteParentDone returns true if the count of the StartSpanWithRemoteParent invocations corresponds the number of defined expectations
MinimockStartSpanWithRemoteParentDone
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (m *TracerOpenCensusMock) MinimockFinish() { if !m.minimockDone() { m.MinimockFromContextInspect() m.MinimockNewContextInspect() m.MinimockStartSpanInspect() m.MinimockStartSpanWithRemoteParentInspect() m.t.FailNow() } }
MinimockFinish checks that all mocked methods have been called the expected number of times
MinimockFinish
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT
func (m *TracerOpenCensusMock) MinimockWait(timeout mm_time.Duration) { timeoutCh := mm_time.After(timeout) for { if m.minimockDone() { return } select { case <-timeoutCh: m.MinimockFinish() return case <-mm_time.After(10 * mm_time.Millisecond): } } }
MinimockWait waits for all mocked methods to be called the expected number of times
MinimockWait
go
hexdigest/gowrap
templates_tests/tracer_opencensus_mock_test.go
https://github.com/hexdigest/gowrap/blob/master/templates_tests/tracer_opencensus_mock_test.go
MIT