From d51d41faf5013f2962e43d87f6dafaf468f3b609 Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Wed, 3 Apr 2024 15:07:23 -0400 Subject: [PATCH] Fix label integrations test --- server/service/integration_core_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/service/integration_core_test.go b/server/service/integration_core_test.go index ac358259b1..297a04231d 100644 --- a/server/service/integration_core_test.go +++ b/server/service/integration_core_test.go @@ -3632,9 +3632,13 @@ func (s *integrationTestSuite) TestLabels() { s.DoJSON("GET", "/api/latest/fleet/labels/summary", nil, http.StatusOK, &summaryResp) assert.Len(t, summaryResp.Labels, builtInsCount+1) - // next page is empty - s.DoJSON("GET", "/api/latest/fleet/labels", nil, http.StatusOK, &listResp, "per_page", "2", "page", "1", "query", t.Name()) - assert.Len(t, listResp.Labels, 0) + // next page is empty (note that the "query" parameter is ignored for "list labels") + s.DoJSON("GET", "/api/latest/fleet/labels", nil, http.StatusOK, &listResp, "per_page", strconv.Itoa(builtInsCount+1), "page", "1") + if !assert.Len(t, listResp.Labels, 0) { + for _, lbl := range listResp.Labels { + t.Logf("label: %v", lbl) + } + } // create another label s.DoJSON("POST", "/api/latest/fleet/labels", &fleet.LabelPayload{Name: ptr.String(strings.ReplaceAll(t.Name(), "/", "_")), Query: ptr.String("select 1")}, http.StatusOK, &createResp)