github.com/Jeffail/benthos/v3@v3.65.0/lib/output/common_test.go (about)

     1  package output
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/Jeffail/benthos/v3/lib/types"
     7  )
     8  
     9  // MockOutputType implements the output.Type interface.
    10  type MockOutputType struct {
    11  	TChan <-chan types.Transaction
    12  }
    13  
    14  // Consume sets the read channel. This implementation is NOT thread safe.
    15  func (m *MockOutputType) Consume(msgs <-chan types.Transaction) error {
    16  	m.TChan = msgs
    17  	return nil
    18  }
    19  
    20  // Connected returns a boolean indicating whether this output is currently
    21  // connected to its target.
    22  func (m *MockOutputType) Connected() bool {
    23  	return true
    24  }
    25  
    26  // CloseAsync does nothing.
    27  func (m *MockOutputType) CloseAsync() {
    28  }
    29  
    30  // WaitForClose does nothing.
    31  func (m MockOutputType) WaitForClose(t time.Duration) error {
    32  	return nil
    33  }