diff --git a/stream/mts/meta/meta.go b/stream/mts/meta/meta.go index 297b2fa2..66790315 100644 --- a/stream/mts/meta/meta.go +++ b/stream/mts/meta/meta.go @@ -124,7 +124,7 @@ func (m *Data) Get(key string) (val string, ok bool) { } // Delete deletes a meta entry in the map and returns error if it doesn’t exist. -func (m *Data) Delete(key string) error { +func (m *Data) Delete(key string) { m.mu.Lock() defer m.mu.Unlock() if _, ok := m.data[key]; ok { @@ -136,9 +136,9 @@ func (m *Data) Delete(key string) error { break } } - return nil + return } - return errKeyAbsent + return } // Encode takes the meta data map and encodes into a byte slice with header diff --git a/stream/mts/meta/meta_test.go b/stream/mts/meta/meta_test.go index a97d925f..e1f9f3b7 100644 --- a/stream/mts/meta/meta_test.go +++ b/stream/mts/meta/meta_test.go @@ -108,23 +108,12 @@ func TestGetAbsentKey(t *testing.T) { func TestDelete(t *testing.T) { meta := New() meta.Add(tstKey1, tstData1) - if err := meta.Delete(tstKey1); err != nil { - t.Errorf("Unexpected err: %v\n", err) - } + meta.Delete(tstKey1) if _, ok := meta.Get(tstKey1); ok { t.Error("Get incorrectly returned okay for absent key") } } -// TestDeleteAbsentKey checks that we get an expected error when we try to delete -// an entry in the Meta map that doesn't exist. -func TestDeleteAbsentKey(t *testing.T) { - meta := New() - if err := meta.Delete(tstKey1); err != errKeyAbsent { - t.Errorf("Not expected err: %v\n", errKeyAbsent) - } -} - // TestEncode checks that we're getting the correct byte slice from Meta.Encode(). func TestEncode(t *testing.T) { meta := New()