github.com/prysmaticlabs/prysm@v1.4.4/shared/logutil/stream_test.go (about)

     1  package logutil
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/prysmaticlabs/prysm/shared/testutil/require"
     7  )
     8  
     9  func TestStreamServer_BackfillsMessages(t *testing.T) {
    10  	ss := NewStreamServer()
    11  	msgs := [][]byte{
    12  		[]byte("foo"),
    13  		[]byte("bar"),
    14  		[]byte("buzz"),
    15  	}
    16  	for _, msg := range msgs {
    17  		_, err := ss.Write(msg)
    18  		require.NoError(t, err)
    19  	}
    20  
    21  	recentMessages := ss.GetLastFewLogs()
    22  	require.DeepEqual(t, msgs, recentMessages)
    23  }