From 3780c9fd6980242f208ee759fa841cea34a62b5b Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 22 Nov 2024 16:42:34 +0100 Subject: [PATCH] fix nil in test Signed-off-by: Kristoffer Dalby --- hscontrol/db/users_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hscontrol/db/users_test.go b/hscontrol/db/users_test.go index 6684989e..06073762 100644 --- a/hscontrol/db/users_test.go +++ b/hscontrol/db/users_test.go @@ -90,9 +90,10 @@ func (s *Suite) TestRenameUser(c *check.C) { c.Assert(err, check.IsNil) c.Assert(userTest2.Name, check.Equals, "test2") + want := "UNIQUE constraint failed" err = db.RenameUser(types.UserID(userTest2.ID), "test-renamed") - if !strings.Contains(err.Error(), "UNIQUE constraint failed") { - c.Fatalf("expected failure with unique constraint, got: %s", err.Error()) + if err == nil || !strings.Contains(err.Error(), want) { + c.Fatalf("expected failure with unique constraint, want: %q got: %q", want, err) } }