Skip to content

Commit 9cbb91f

Browse files
engine-manager: state the over-long query test's two expectations separately
One condition checked both that there was an error and what it said. Split, the test fails plainly if the query is answered, and compares the message only once there is one -- comparing a nil error's message would panic instead of failing. Signed-off-by: Terve <ntervalon@nvidia.com>
1 parent c73e4ed commit 9cbb91f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎services/nvpair-engine-manager/catalog_test.go‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,11 @@ func TestOverLongSearchIsRefused(t *testing.T) {
639639

640640
query := strings.TrimSpace(strings.Repeat("private ", maxCatalogQuery/len("private ")+1))
641641
_, err := c.Catalog(context.Background(), "llamacpp", "", "", query)
642-
if err == nil || err.Error() != "a model search is limited to 100 characters" {
643-
t.Errorf("a %d-character query: error %v, want the limit stated without the query", len(query), err)
642+
if err == nil {
643+
t.Fatalf("a %d-character query was answered", len(query))
644+
}
645+
if got, want := err.Error(), "a model search is limited to 100 characters"; got != want {
646+
t.Errorf("error %q, want %q", got, want)
644647
}
645648
if got := requests(); len(got) != 0 {
646649
t.Errorf("an over-long query reached the upstream: %v", got)

0 commit comments

Comments
 (0)