Skip to content
This repository has been archived by the owner on Apr 2, 2018. It is now read-only.

Commit

Permalink
generate fakes. chaneg refs.
Browse files Browse the repository at this point in the history
[#118887103]

Signed-off-by: Maria Shaldibina <[email protected]>
  • Loading branch information
Yucheng Tu authored and mariash committed Jun 27, 2016
1 parent e64fd66 commit 4c5bc87
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file was generated by counterfeiter
package fakes
package syslogfakes

import (
"sync"
Expand All @@ -17,6 +17,8 @@ type FakeDrainer struct {
drainReturns struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}

func (fake *FakeDrainer) Drain(line string, tag string) error {
Expand All @@ -25,6 +27,7 @@ func (fake *FakeDrainer) Drain(line string, tag string) error {
line string
tag string
}{line, tag})
fake.recordInvocation("Drain", []interface{}{line, tag})
fake.drainMutex.Unlock()
if fake.DrainStub != nil {
return fake.DrainStub(line, tag)
Expand Down Expand Up @@ -52,4 +55,24 @@ func (fake *FakeDrainer) DrainReturns(result1 error) {
}{result1}
}

func (fake *FakeDrainer) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.drainMutex.RLock()
defer fake.drainMutex.RUnlock()
return fake.invocations
}

func (fake *FakeDrainer) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}

var _ syslog.Drainer = new(FakeDrainer)

0 comments on commit 4c5bc87

Please sign in to comment.