Skip to content

Commit 2fcab0a

Browse files
committed
Don't use require
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
1 parent 5470322 commit 2fcab0a

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

model/labelset_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ package model
1616
import (
1717
"encoding/json"
1818
"testing"
19-
20-
"github.com/stretchr/testify/require"
2119
)
2220

2321
func TestUnmarshalJSONLabelSet(t *testing.T) {
@@ -57,10 +55,14 @@ func TestUnmarshalJSONLabelSet(t *testing.T) {
5755
}
5856
}`
5957

60-
err = json.Unmarshal([]byte(invalidlabelSetJSON), &c)
61-
require.NoError(t, err)
58+
if err := json.Unmarshal([]byte(invalidlabelSetJSON), &c); err != nil {
59+
t.Errorf("unexpected error: %s", err)
60+
}
6261
err = c.LabelSet.validate(LegacyValidation)
63-
require.EqualError(t, err, `invalid name "1nvalid_23name"`)
62+
const expectedErr = `invalid name "1nvalid_23name"`
63+
if err == nil || err.Error() != expectedErr {
64+
t.Errorf("expected an error with message '%s' to be thrown, got: '%s'", expectedErr, err)
65+
}
6466
}
6567

6668
func TestLabelSetClone(t *testing.T) {

0 commit comments

Comments
 (0)