@@ -62,27 +62,29 @@ func TestFIPSAgentConnectingToFIPSFleetServerInECHFRH(t *testing.T) {
6262 require .Equalf (t , "HEALTHY" , body .Status , "response status code: %d" , resp .StatusCode )
6363
6464 // Get all Agents
65- ctx , cancel := context .WithTimeout (t .Context (), 5 * time .Second )
66- defer cancel ()
67- agents , err := info .KibanaClient .ListAgents (ctx , kibana.ListAgentsRequest {})
68- require .NoError (t , err )
65+ require .Eventually (t , func () bool {
66+ ctx , cancel := context .WithTimeout (t .Context (), 5 * time .Second )
67+ defer cancel ()
68+ agents , err := info .KibanaClient .ListAgents (ctx , kibana.ListAgentsRequest {})
69+ require .NoError (t , err )
6970
70- // Find Fleet Server's own Agent and get its status and whether it's
71- // FIPS-capable
72- //var agentStatus string
73- var agentIsFIPS bool
74- for _ , item := range agents .Items {
75- if item .PolicyID == cloudAgentPolicyID {
76- t .Logf ("Found fleet-server entry: %+v" , item )
77- //agentStatus = item.Status
78- agentIsFIPS = item .LocalMetadata .Elastic .Agent .FIPS
79- break
71+ // Find Fleet Server's own Agent and get its status and whether it's
72+ // FIPS-capable
73+ //var agentStatus string
74+ var agentIsFIPS bool
75+ for _ , item := range agents .Items {
76+ if item .PolicyID == cloudAgentPolicyID {
77+ t .Logf ("Found fleet-server entry: %+v" , item )
78+ //agentStatus = item.Status
79+ agentIsFIPS = item .LocalMetadata .Elastic .Agent .FIPS
80+ break
81+ }
8082 }
81- }
8283
83- // Check that this Agent is online (i.e. healthy) and is FIPS-capable. This
84- // will prove that a FIPS-capable Agent is able to connect to a FIPS-capable
85- // Fleet Server, with both running in ECH.
86- require .Equal (t , true , agentIsFIPS )
87- //require.Equal(t, "online", agentStatus) // FIXME: Uncomment after https://github.com/elastic/apm-server/issues/17063 is resolved
84+ // Check that this Agent is online (i.e. healthy) and is FIPS-capable. This
85+ // will prove that a FIPS-capable Agent is able to connect to a FIPS-capable
86+ // Fleet Server, with both running in ECH.
87+ //require.Equal(t, "online", agentStatus) // FIXME: Uncomment after https://github.com/elastic/apm-server/issues/17063 is resolved
88+ return agentIsFIPS
89+ }, 10 * time .Second , 200 * time .Millisecond , "Fleet Server's Elastic Agent should be healthy and FIPS-capable" )
8890}
0 commit comments