@@ -406,6 +406,10 @@ func (fts *FleetTestSuite) setup() error {
406406}
407407
408408func (fts * FleetTestSuite ) theAgentIsListedInFleetWithStatus (desiredStatus string ) error {
409+ return theAgentIsListedInFleetWithStatus (desiredStatus , fts .Hostname )
410+ }
411+
412+ func theAgentIsListedInFleetWithStatus (desiredStatus , hostname string ) error {
409413 log .Tracef ("Checking if agent is listed in Fleet as %s" , desiredStatus )
410414
411415 maxTimeout := time .Duration (timeoutFactor ) * time .Minute * 2
@@ -414,7 +418,7 @@ func (fts *FleetTestSuite) theAgentIsListedInFleetWithStatus(desiredStatus strin
414418 exp := e2e .GetExponentialBackOff (maxTimeout )
415419
416420 agentOnlineFn := func () error {
417- agentID , err := getAgentID (fts . Hostname )
421+ agentID , err := getAgentID (hostname )
418422 if err != nil {
419423 retryCount ++
420424 return err
@@ -425,7 +429,7 @@ func (fts *FleetTestSuite) theAgentIsListedInFleetWithStatus(desiredStatus strin
425429 if desiredStatus == "offline" || desiredStatus == "inactive" {
426430 log .WithFields (log.Fields {
427431 "elapsedTime" : exp .GetElapsedTime (),
428- "hostname" : fts . Hostname ,
432+ "hostname" : hostname ,
429433 "retries" : retryCount ,
430434 "status" : desiredStatus ,
431435 }).Info ("The Agent is not present in Fleet, as expected" )
@@ -446,7 +450,7 @@ func (fts *FleetTestSuite) theAgentIsListedInFleetWithStatus(desiredStatus strin
446450 "agentID" : agentID ,
447451 "isAgentInStatus" : isAgentInStatus ,
448452 "elapsedTime" : exp .GetElapsedTime (),
449- "hostname" : fts . Hostname ,
453+ "hostname" : hostname ,
450454 "retry" : retryCount ,
451455 "status" : desiredStatus ,
452456 }).Warn (err .Error ())
@@ -459,7 +463,7 @@ func (fts *FleetTestSuite) theAgentIsListedInFleetWithStatus(desiredStatus strin
459463 log .WithFields (log.Fields {
460464 "isAgentInStatus" : isAgentInStatus ,
461465 "elapsedTime" : exp .GetElapsedTime (),
462- "hostname" : fts . Hostname ,
466+ "hostname" : hostname ,
463467 "retries" : retryCount ,
464468 "status" : desiredStatus ,
465469 }).Info ("The Agent is in the desired status" )
0 commit comments