diff --git a/stream/mts/meta/meta_test.go b/stream/mts/meta/meta_test.go index d40e26d5..0fcda13b 100644 --- a/stream/mts/meta/meta_test.go +++ b/stream/mts/meta/meta_test.go @@ -43,7 +43,9 @@ const ( ) var ( - errNotExpectedOut = "Did not get expected out. \nGot : %v, \nwant: %v" + errNotExpectedOut = "Did not get expected out. \nGot : %v, \nwant: %v\n" + errUnexpectedErr = "Unexpected err: %v\n" + errNotExpectedErr = "Not expected err: %v\n" ) // TestAddAndGet ensures that we can add metadata and then successfully get it. @@ -75,7 +77,7 @@ func TestUpdate(t *testing.T) { meta.Add(tstKey1, tstData3) if data, err := meta.Get(tstKey1); err != nil { - t.Errorf("Did not expect err: %v", err.Error()) + t.Errorf(errUnexpectedErr, err.Error()) if data != tstData2 { t.Errorf("Data did not correctly update for key \"loc\"") } @@ -105,7 +107,7 @@ func TestGetAbsentKey(t *testing.T) { meta := New() if _, err := meta.Get(tstKey1); err != errKeyAbsent { - t.Errorf("Did not get expected err: %v", errKeyAbsent.Error()) + t.Errorf(errNotExpectedErr, errKeyAbsent.Error()) } } @@ -114,10 +116,10 @@ func TestDelete(t *testing.T) { meta := New() meta.Add(tstKey1, tstData1) if err := meta.Delete(tstKey1); err != nil { - t.Errorf("Did not expect error: %v", err.Error()) + t.Errorf(errUnexpectedErr, err.Error()) } if _, err := meta.Get(tstKey1); err != errKeyAbsent { - t.Errorf("Did not get expected err: %v", errKeyAbsent.Error()) + t.Errorf(errNotExpectedErr, errKeyAbsent.Error()) } } @@ -126,7 +128,7 @@ func TestDelete(t *testing.T) { func TestDeleteAbsentKey(t *testing.T) { meta := New() if err := meta.Delete(tstKey1); err != errKeyAbsent { - t.Errorf("Did not get expected err: %v", errKeyAbsent.Error()) + t.Errorf(errNotExpectedErr, errKeyAbsent.Error()) } } @@ -157,7 +159,7 @@ func TestReadFrom(t *testing.T) { tstStr := "loc=a,b,c\tts=12345" got, err := ReadFrom([]byte(tstStr), "loc") if err != nil { - t.Errorf("Got unexpected error: %v", err.Error()) + t.Errorf(errUnexpectedErr, err.Error()) } want := "a,b,c" if got != want { @@ -165,7 +167,7 @@ func TestReadFrom(t *testing.T) { } if got, err = ReadFrom([]byte(tstStr), "ts"); err != nil { - t.Errorf("Got unexpected error: %v", err.Error()) + t.Errorf(errUnexpectedErr, err.Error()) } want = "12345" if got != want {