@@ -927,7 +927,7 @@ func TestComponentWorkDir(t *testing.T) {
927927 type configOptions struct {
928928 RuntimeExperimental string
929929 }
930- configTemplate := `agent.logging.level: info
930+ configTemplate := `agent.logging.level: debug
931931agent.logging.to_stderr: true
932932agent.logging.to_files: false
933933inputs:
@@ -978,13 +978,14 @@ agent.monitoring.enabled: false
978978 var componentID , componentWorkDir string
979979 var workDirCreated time.Time
980980
981- // wait for component to appear in status
981+ // wait for component to appear in status and be healthy
982982 require .EventuallyWithT (t , func (collect * assert.CollectT ) {
983983 var statusErr error
984984 status , statusErr := fixture .ExecStatus (ctx )
985985 require .NoError (collect , statusErr )
986986 require .Equal (collect , 1 , len (status .Components ))
987987 componentStatus := status .Components [0 ]
988+ assert .Equal (collect , cproto .State_HEALTHY , cproto .State (componentStatus .State ))
988989 componentID = componentStatus .ID
989990 }, 2 * time .Minute , 5 * time .Second )
990991
@@ -1001,13 +1002,17 @@ agent.monitoring.enabled: false
10011002 err = fixture .Configure (ctx , receiverConfig )
10021003 require .NoError (t , err )
10031004
1005+ // wait for component to appear in status and be healthy or degraded
10041006 require .EventuallyWithT (t , func (collect * assert.CollectT ) {
10051007 var statusErr error
10061008 status , statusErr := fixture .ExecStatus (ctx )
10071009 require .NoError (collect , statusErr )
10081010 require .Equal (collect , 1 , len (status .Components ))
10091011 componentStatus := status .Components [0 ]
1010- assert .Equal (collect , "beats-receiver" , componentStatus .VersionInfo .Name )
1012+ require .Equal (collect , "beats-receiver" , componentStatus .VersionInfo .Name )
1013+ componentState := cproto .State (componentStatus .State )
1014+ assert .Truef (collect , componentState == cproto .State_HEALTHY || componentState == cproto .State_DEGRADED ,
1015+ "component state should be HEALTHY or DEGRADED, got %s" , componentState .String ())
10111016 }, 2 * time .Minute , 5 * time .Second )
10121017
10131018 // the component working directory should still exist
0 commit comments