Testdata: add random labeled stream (#41932)

This commit is contained in:
Ryan McKinley
2021-11-19 09:54:05 -08:00
committed by GitHub
parent 82cf49143d
commit f661e20dd7
5 changed files with 68 additions and 17 deletions
@@ -94,6 +94,10 @@ func (r *Runner) GetManagedChannels(orgID int64) ([]*ManagedChannel, error) {
Channel: "plugin/testdata/random-flakey-stream",
Data: frameJSON,
MinuteRate: 150,
}, &ManagedChannel{
Channel: "plugin/testdata/random-labeled-stream",
Data: frameJSON,
MinuteRate: 250,
}, &ManagedChannel{
Channel: "plugin/testdata/random-20Hz-stream",
Data: frameJSON,
@@ -55,7 +55,7 @@ func TestGetManagedStreams(t *testing.T) {
managedChannels, err := runner.GetManagedChannels(1)
require.NoError(t, err)
require.Len(t, managedChannels, 3) // 3 hardcoded testdata streams.
require.Len(t, managedChannels, 4) // 4 hardcoded testdata streams.
err = s1.Push("cpu1", data.NewFrame("cpu1"))
require.NoError(t, err)
@@ -68,10 +68,10 @@ func TestGetManagedStreams(t *testing.T) {
managedChannels, err = runner.GetManagedChannels(1)
require.NoError(t, err)
require.Len(t, managedChannels, 6) // 3 hardcoded testdata streams + 3 test channels.
require.Equal(t, "stream/test1/cpu1", managedChannels[3].Channel)
require.Equal(t, "stream/test1/cpu2", managedChannels[4].Channel)
require.Equal(t, "stream/test2/cpu1", managedChannels[5].Channel)
require.Len(t, managedChannels, 7) // 4 hardcoded testdata streams + 3 test channels.
require.Equal(t, "stream/test1/cpu1", managedChannels[4].Channel)
require.Equal(t, "stream/test1/cpu2", managedChannels[5].Channel)
require.Equal(t, "stream/test2/cpu1", managedChannels[6].Channel)
// Different org.
s3, err := runner.GetOrCreateStream(2, "stream", "test1")
@@ -80,5 +80,5 @@ func TestGetManagedStreams(t *testing.T) {
require.NoError(t, err)
managedChannels, err = runner.GetManagedChannels(1)
require.NoError(t, err)
require.Len(t, managedChannels, 6) // Not affected by other org.
require.Len(t, managedChannels, 7) // Not affected by other org.
}