@@ -208,7 +208,7 @@ func Test_GHActionExporter_HandleGHWebHook_WorkflowJobInProgressEvent(t *testing
208208
209209 // Then
210210 assert .Equal (t , http .StatusAccepted , res .Result ().StatusCode )
211- observer .assetWorkflowJobObservation (workflowJobObservation {
211+ observer .assertWorkflowJobObservation (workflowJobObservation {
212212 org : org ,
213213 repo : repo ,
214214 state : "queued" ,
@@ -274,7 +274,7 @@ func Test_WorkflowMetricsExporter_HandleGHWebHook_WorkflowJobInProgressEventWith
274274
275275 // Then
276276 assert .Equal (t , http .StatusAccepted , res .Result ().StatusCode )
277- observer .assetWorkflowJobObservation (workflowJobObservation {
277+ observer .assertWorkflowJobObservation (workflowJobObservation {
278278 org : org ,
279279 repo : repo ,
280280 state : "queued" ,
@@ -335,7 +335,7 @@ func Test_GHActionExporter_HandleGHWebHook_WorkflowJobCompletedEvent(t *testing.
335335
336336 // Then
337337 assert .Equal (t , http .StatusAccepted , res .Result ().StatusCode )
338- observer .assetWorkflowJobObservation (workflowJobObservation {
338+ observer .assertWorkflowJobObservation (workflowJobObservation {
339339 org : org ,
340340 repo : repo ,
341341 state : "in_progress" ,
@@ -478,6 +478,8 @@ func Test_WorkflowMetricsExporter_HandleGHWebHook_WorkflowRunCompleted(t *testin
478478 runStartTime := time .Unix (1650308740 , 0 )
479479 runUpdatedTime := runStartTime .Add (time .Duration (expectedRunDuration ) * time .Second )
480480 status := "completed"
481+ conclusion := "success"
482+
481483 event := github.WorkflowRunEvent {
482484 Action : github .String ("completed" ),
483485 Repo : & github.Repository {
@@ -493,6 +495,7 @@ func Test_WorkflowMetricsExporter_HandleGHWebHook_WorkflowRunCompleted(t *testin
493495 Status : & status ,
494496 RunStartedAt : & github.Timestamp {Time : runStartTime },
495497 UpdatedAt : & github.Timestamp {Time : runUpdatedTime },
498+ Conclusion : & conclusion ,
496499 },
497500 }
498501 req := testWebhookRequest (t , "/anything" , "workflow_run" , event )
@@ -503,17 +506,19 @@ func Test_WorkflowMetricsExporter_HandleGHWebHook_WorkflowRunCompleted(t *testin
503506
504507 // Then
505508 assert .Equal (t , http .StatusAccepted , res .Result ().StatusCode )
506- observer .assetWorkflowRunObservation (workflowRunObservation {
509+ observer .assertWorkflowRunObservation (workflowRunObservation {
507510 org : org ,
508511 repo : repo ,
509512 workflowName : workflowName ,
513+ conclusion : conclusion ,
510514 seconds : expectedRunDuration ,
511515 }, 50 * time .Millisecond )
512516 observer .assertWorkflowRunStatusCount (workflowRunStatusCount {
513517 org : org ,
514518 repo : repo ,
515519 workflowName : workflowName ,
516520 status : status ,
521+ conclusion : conclusion ,
517522 }, 50 * time .Millisecond )
518523}
519524
@@ -597,8 +602,8 @@ type workflowJobDurationCount struct {
597602}
598603
599604type workflowRunObservation struct {
600- org , repo , workflowName string
601- seconds float64
605+ org , repo , workflowName , conclusion string
606+ seconds float64
602607}
603608
604609type workflowRunStatusCount struct {
@@ -658,12 +663,13 @@ func (o *TestPrometheusObserver) CountWorkflowJobDuration(org, repo, status, con
658663 }
659664}
660665
661- func (o * TestPrometheusObserver ) ObserveWorkflowRunDuration (org , repo , workflowName string , seconds float64 ) {
666+ func (o * TestPrometheusObserver ) ObserveWorkflowRunDuration (org , repo , workflowName , conclusion string , seconds float64 ) {
662667 o .workflowRunObserved <- workflowRunObservation {
663668 org : org ,
664669 repo : repo ,
665670 workflowName : workflowName ,
666671 seconds : seconds ,
672+ conclusion : conclusion ,
667673 }
668674}
669675
@@ -685,7 +691,7 @@ func (o *TestPrometheusObserver) assertNoWorkflowJobDurationObservation(timeout
685691 }
686692}
687693
688- func (o * TestPrometheusObserver ) assetWorkflowJobObservation (expected workflowJobObservation , timeout time.Duration ) {
694+ func (o * TestPrometheusObserver ) assertWorkflowJobObservation (expected workflowJobObservation , timeout time.Duration ) {
689695 select {
690696 case <- time .After (timeout ):
691697 o .t .Fatal ("expected observation but none occurred" )
@@ -712,7 +718,7 @@ func (o *TestPrometheusObserver) assertWorkflowJobDurationCount(expected workflo
712718 }
713719}
714720
715- func (o * TestPrometheusObserver ) assetWorkflowRunObservation (expected workflowRunObservation , timeout time.Duration ) {
721+ func (o * TestPrometheusObserver ) assertWorkflowRunObservation (expected workflowRunObservation , timeout time.Duration ) {
716722 select {
717723 case <- time .After (timeout ):
718724 o .t .Fatal ("expected observation but none occurred" )
0 commit comments