Ejemplo n.º 1
0
		f.logMsgCount++
		if f.logMsgCount == 4+1 {
			f.truncateChan <- struct{}{}
		}
	} else if eventType == events.Envelope_CounterEvent {
		f.truncateChan <- struct{}{}
	}

	return true
}

var _ = Describe("Truncating Buffer", func() {
	var inMessageChan chan *events.Envelope
	var stopChannel chan struct{}
	var bufferSize uint
	var buffer *truncatingbuffer.TruncatingBuffer
	var context truncatingbuffer.BufferContext

	BeforeEach(func() {
		inMessageChan = make(chan *events.Envelope)
		stopChannel = make(chan struct{})
		context = &FakeContext{}
		bufferSize = 3
	})

	JustBeforeEach(func() {
		buffer = truncatingbuffer.NewTruncatingBuffer(inMessageChan, bufferSize, context, loggertesthelper.Logger(), stopChannel)
	})

	AfterEach(func() {
		if inMessageChan != nil {
Ejemplo n.º 2
0
	if eventType == events.Envelope_LogMessage {
		f.logMsgCount++
		if f.logMsgCount == 4+1 {
			f.truncateChan <- struct{}{}
		}
	} else if eventType == events.Envelope_CounterEvent {
		f.truncateChan <- struct{}{}
	}

	return true
}

var _ = Describe("Truncating Buffer", func() {
	var inMessageChan chan *events.Envelope
	var stopChannel chan struct{}
	var buffer *truncatingbuffer.TruncatingBuffer
	var context truncatingbuffer.BufferContext

	BeforeEach(func() {
		inMessageChan = make(chan *events.Envelope)
		stopChannel = make(chan struct{})
		context = &FakeContext{}
	})

	JustBeforeEach(func() {
		buffer = truncatingbuffer.NewTruncatingBuffer(inMessageChan, 3, context, loggertesthelper.Logger(), stopChannel)
	})

	AfterEach(func() {
		if inMessageChan != nil {
			close(inMessageChan)