@@ -885,64 +885,6 @@ func Test_GetJobLogs(t *testing.T) {
885885 assert .Len (t , logs , 2 )
886886 },
887887 },
888- {
889- name : "successful failed jobs logs with tailing" ,
890- mockedClient : mock .NewMockedHTTPClient (
891- mock .WithRequestMatchHandler (
892- mock .GetReposActionsRunsJobsByOwnerByRepoByRunId ,
893- http .HandlerFunc (func (w http.ResponseWriter , _ * http.Request ) {
894- jobs := & github.Jobs {
895- TotalCount : github .Ptr (3 ),
896- Jobs : []* github.WorkflowJob {
897- {
898- ID : github .Ptr (int64 (1 )),
899- Name : github .Ptr ("test-job-1" ),
900- Conclusion : github .Ptr ("failure" ),
901- },
902- {
903- ID : github .Ptr (int64 (2 )),
904- Name : github .Ptr ("test-job-2" ),
905- Conclusion : github .Ptr ("failure" ),
906- },
907- {
908- ID : github .Ptr (int64 (3 )),
909- Name : github .Ptr ("test-job-3" ),
910- Conclusion : github .Ptr ("failure" ),
911- },
912- },
913- }
914- w .WriteHeader (http .StatusOK )
915- _ = json .NewEncoder (w ).Encode (jobs )
916- }),
917- ),
918- mock .WithRequestMatchHandler (
919- mock .GetReposActionsJobsLogsByOwnerByRepoByJobId ,
920- http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
921- w .Header ().Set ("Location" , "https://github.com/logs/job/" + r .URL .Path [len (r .URL .Path )- 1 :])
922- w .WriteHeader (http .StatusFound )
923- }),
924- ),
925- ),
926- requestArgs : map [string ]any {
927- "owner" : "owner" ,
928- "repo" : "repo" ,
929- "run_id" : float64 (456 ),
930- "failed_only" : true ,
931- "tail_lines" : float64 (1 ),
932- },
933- expectError : false ,
934- checkResponse : func (t * testing.T , response map [string ]any ) {
935- assert .Equal (t , float64 (456 ), response ["run_id" ])
936- assert .Equal (t , float64 (3 ), response ["total_jobs" ])
937- assert .Equal (t , float64 (2 ), response ["failed_jobs" ])
938- assert .Contains (t , response , "logs" )
939- assert .Equal (t , "Retrieved logs for 2 failed jobs" , response ["message" ])
940-
941- logs , ok := response ["logs" ].([]interface {})
942- assert .True (t , ok )
943- assert .Len (t , logs , 3 )
944- },
945- },
946888 {
947889 name : "no failed jobs found" ,
948890 mockedClient : mock .NewMockedHTTPClient (
0 commit comments