@@ -80,16 +80,28 @@ func (s *linuxPrivateActionRunnerEnabledSuite) TestPrivateActionRunnerStartsWhen
8080 host .MustExecuteOn (c , fmt .Sprintf ("sudo grep -i %q %s" , privateActionRunnerStartedLogLine , privateActionRunnerLogFile ))
8181 }, 2 * time .Minute , 5 * time .Second , "private action runner log should contain the started message" )
8282
83- // Push the key only after PAR has subscribed. This bumps the fakeintake RC
84- // version after the Core Agent knows about the AP_RUNNER_KEYS client .
83+ // Push the key only after PAR has subscribed and the Core Agent has had time
84+ // to report the AP_RUNNER_KEYS client in its backend requests .
8585 s .Require ().EventuallyWithT (func (c * assert.CollectT ) {
8686 host .MustExecuteOn (c , fmt .Sprintf ("sudo grep -F %q %s" , privateActionRunnerRCSubscribedLogLine , privateActionRunnerLogFile ))
8787 }, 2 * time .Minute , 5 * time .Second , "private action runner should subscribe to remote config" )
88- PushFakeRunnerKeysConfig (s .T (), s .Env ().FakeIntake .Client ())
88+
89+ client := s .Env ().FakeIntake .Client ()
90+ stats , err := client .RCStats ()
91+ s .Require ().NoError (err )
92+ s .Require ().EventuallyWithT (func (c * assert.CollectT ) {
93+ current , statsErr := client .RCStats ()
94+ assert .NoError (c , statsErr )
95+ if statsErr == nil {
96+ assert .GreaterOrEqual (c , current .Polls , stats .Polls + 2 )
97+ }
98+ }, 45 * time .Second , time .Second , "Core Agent should poll after PAR subscribes" )
99+ PushFakeRunnerKeysConfig (s .T (), client )
100+ WaitForFakeRunnerKeyAcknowledged (s .T (), client , 5 * time .Minute )
89101
90102 s .Require ().EventuallyWithT (func (c * assert.CollectT ) {
91103 host .MustExecuteOn (c , fmt .Sprintf ("sudo grep -F %q %s" , privateActionRunnerKeysManagerLogLine , privateActionRunnerLogFile ))
92- }, 5 * time .Minute , 5 * time .Second , "private action runner log should report the keys manager ready" )
104+ }, 30 * time .Second , time .Second , "private action runner log should report the keys manager ready" )
93105}
94106
95107func (s * linuxPrivateActionRunnerEnabledSuite ) TestPrivateActionRunnerServiceRestart () {
0 commit comments