From bb734a1607c071f29b1ef35e430aa2e1220a7b8f Mon Sep 17 00:00:00 2001 From: Pavel Zorin Date: Tue, 26 Nov 2024 17:16:31 +0200 Subject: [PATCH] Test fix: propely collect hostnames for GetAgentByPolicyIDAndHostnameFromList (#6146) --- pkg/testing/tools/fleettools/fleet.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/testing/tools/fleettools/fleet.go b/pkg/testing/tools/fleettools/fleet.go index ce1048a1c7e..e593590b3f2 100644 --- a/pkg/testing/tools/fleettools/fleet.go +++ b/pkg/testing/tools/fleettools/fleet.go @@ -35,6 +35,8 @@ func GetAgentByPolicyIDAndHostnameFromList(ctx context.Context, client *kibana.C agentHostname := item.LocalMetadata.Host.Hostname agentPolicyID := item.PolicyID + agentHostnames = append(agentHostnames, agentHostname) + if strings.EqualFold(agentHostname, hostname) && agentPolicyID == policyID { hostnameAgents = append(hostnameAgents, &listAgentsResp.Items[i]) }