@@ -134,8 +134,12 @@ async fn process_repository(repo: &RepositoryState, ctx: &BorsContext) -> anyhow
134134 let pr_num = pr. number ;
135135
136136 match pr. queue_status ( ) {
137- QueueStatus :: NotApproved => unreachable ! ( ) ,
138- QueueStatus :: Stalled ( ..) => unreachable ! ( ) ,
137+ QueueStatus :: NotApproved => unreachable ! (
138+ "PR {pr:?} is not approved. It should not have been returned by `get_merge_queue_prs`, this is a bug."
139+ ) ,
140+ QueueStatus :: Stalled ( ..) => unreachable ! (
141+ "PR {pr:?} is stalled. It should not have been returned by `get_merge_queue_prs`, this is a bug."
142+ ) ,
139143 QueueStatus :: Pending ( ..) => {
140144 // Build in progress - stop queue. We can only have one PR being built
141145 // at a time.
@@ -1115,4 +1119,21 @@ auto_build_failed = ["+foo", "+bar", "-baz"]
11151119 } )
11161120 . await ;
11171121 }
1122+
1123+ #[ sqlx:: test]
1124+ async fn run_empty_queue ( pool : sqlx:: PgPool ) {
1125+ run_test ( pool, async |tester : & mut BorsTester | {
1126+ // This PR should not be in the queue
1127+ let pr = tester. open_pr ( default_repo_name ( ) , |_| { } ) . await ?;
1128+ // Make sure that bors knows about the DB
1129+ tester
1130+ . post_comment ( Comment :: new ( pr. id ( ) , "@bors info" ) )
1131+ . await ?;
1132+ tester. expect_comments ( pr. id ( ) , 1 ) . await ;
1133+
1134+ tester. process_merge_queue ( ) . await ;
1135+ Ok ( ( ) )
1136+ } )
1137+ . await ;
1138+ }
11181139}
0 commit comments