2021-09-17 21:55:24 +00:00
|
|
|
package logs
|
2020-09-18 00:34:03 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
2020-09-18 00:34:03 +00:00
|
|
|
)
|
|
|
|
|
2020-12-18 18:03:24 +00:00
|
|
|
func TestStreamServer_BackfillsMessages(t *testing.T) {
|
|
|
|
ss := NewStreamServer()
|
2020-09-18 00:34:03 +00:00
|
|
|
msgs := [][]byte{
|
|
|
|
[]byte("foo"),
|
|
|
|
[]byte("bar"),
|
|
|
|
[]byte("buzz"),
|
|
|
|
}
|
|
|
|
for _, msg := range msgs {
|
|
|
|
_, err := ss.Write(msg)
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
|
2020-12-18 18:03:24 +00:00
|
|
|
recentMessages := ss.GetLastFewLogs()
|
|
|
|
require.DeepEqual(t, msgs, recentMessages)
|
2020-09-18 00:34:03 +00:00
|
|
|
}
|