diff --git a/src/bors/handlers/autobuild.rs b/src/bors/handlers/autobuild.rs index a1f96f0d..bad02a5d 100644 --- a/src/bors/handlers/autobuild.rs +++ b/src/bors/handlers/autobuild.rs @@ -147,7 +147,7 @@ async fn notify_of_invalid_retry_state( mod tests { use crate::tests::{BorsTester, Comment, GitHub, User, run_test}; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn retry_command_insufficient_privileges(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment(Comment::from("@bors retry").with_author(User::unprivileged())) @@ -161,7 +161,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn retry_invalid_state_error(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors retry").await?; @@ -174,7 +174,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn retry_invalid_state_error_pending_build_hint(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -194,7 +194,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn retry_auto_build(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -213,7 +213,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn retry_apply_label(pool: sqlx::PgPool) { let gh = GitHub::default().with_default_config( r#" @@ -237,7 +237,7 @@ auto_build_failed = ["-foo"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cancel_no_running_build(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors cancel").await?; @@ -247,7 +247,7 @@ auto_build_failed = ["-foo"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cancel_while_try_build_is_running(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -263,7 +263,7 @@ auto_build_failed = ["-foo"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cancel_cancel_workflows(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -290,7 +290,7 @@ auto_build_failed = ["-foo"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cancel_error(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; diff --git a/src/bors/handlers/help.rs b/src/bors/handlers/help.rs index dc641223..5b48c06f 100644 --- a/src/bors/handlers/help.rs +++ b/src/bors/handlers/help.rs @@ -21,7 +21,7 @@ pub(super) async fn command_help( mod tests { use crate::tests::{BorsTester, run_test}; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn help_command(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors help").await?; diff --git a/src/bors/handlers/info.rs b/src/bors/handlers/info.rs index 900414d1..f66c3a5d 100644 --- a/src/bors/handlers/info.rs +++ b/src/bors/handlers/info.rs @@ -91,7 +91,7 @@ pub(super) async fn command_info( mod tests { use crate::tests::{BorsTester, WorkflowEvent, run_test}; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn info_for_unapproved_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors info").await?; @@ -109,7 +109,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn info_for_approved_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -129,7 +129,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn info_for_pr_with_priority(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors p=5").await?; @@ -150,7 +150,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn info_for_pr_with_try_build(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -172,7 +172,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn info_for_pr_with_everything(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r+ p=10").await?; @@ -201,7 +201,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn info_cancelled_auto_build(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; diff --git a/src/bors/handlers/mod.rs b/src/bors/handlers/mod.rs index bc2aa206..54742160 100644 --- a/src/bors/handlers/mod.rs +++ b/src/bors/handlers/mod.rs @@ -1101,7 +1101,7 @@ fn is_bors_observed_branch(branch: &str) -> bool { mod tests { use crate::tests::{BorsTester, Comment, User, run_test}; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn ignore_bot_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment(Comment::from("@bors ping").with_author(User::bors_bot())) @@ -1112,7 +1112,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn do_not_load_pr_on_unrelated_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_repo((), |repo| repo.pull_request_error = true); @@ -1122,7 +1122,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unknown_command(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment(Comment::from("@bors foo")).await?; diff --git a/src/bors/handlers/ping.rs b/src/bors/handlers/ping.rs index e097a671..953fabd7 100644 --- a/src/bors/handlers/ping.rs +++ b/src/bors/handlers/ping.rs @@ -28,7 +28,7 @@ pub(super) async fn command_ping( mod tests { use crate::tests::{BorsTester, run_test}; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn ping_command(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors ping").await?; diff --git a/src/bors/handlers/pr_events.rs b/src/bors/handlers/pr_events.rs index d3e933ef..f9476e0d 100644 --- a/src/bors/handlers/pr_events.rs +++ b/src/bors/handlers/pr_events.rs @@ -332,7 +332,7 @@ mod tests { tests::{User, default_branch_name, run_test}, }; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_on_base_edited(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -356,7 +356,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn edit_pr_do_nothing_when_base_not_edited(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -370,7 +370,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn change_pr_base_branch_warning(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let branch = ctx.create_branch("beta"); @@ -385,7 +385,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_on_push(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -405,7 +405,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn push_to_pr_do_nothing_when_not_approved(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.push_to_pr((), Commit::from_sha("foo")).await?; @@ -416,7 +416,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn push_to_pr_do_nothing_when_build_failed(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -433,7 +433,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn push_to_pr_do_not_send_mergeability_notification(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -456,7 +456,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn push_to_pr_hide_previous_mergeability_notification(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -482,7 +482,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn edit_pr_while_in_mergeability_queue(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -510,7 +510,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn edit_pr_while_not_in_mergeability_queue(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -537,7 +537,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn store_base_branch_on_pr_opened(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -550,7 +550,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn update_base_branch_on_pr_edited(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let branch = ctx.create_branch("foo"); @@ -564,7 +564,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn update_mergeability_state_on_pr_edited(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.edit_pr((), |pr| { @@ -580,7 +580,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn open_close_and_reopen_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -597,7 +597,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_on_close(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -609,7 +609,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn open_draft_pr_and_convert_to_ready_for_review(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx @@ -627,7 +627,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn open_pr_and_convert_to_draft(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -641,7 +641,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn assign_pr_updates_assignees(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -655,7 +655,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unassign_pr_updates_assignees(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -670,7 +670,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn open_and_merge_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -684,7 +684,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn mergeability_queue_processes_pr_base_change(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let branch = ctx.create_branch("beta"); @@ -705,7 +705,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn enqueue_prs_on_push_to_branch(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx @@ -729,7 +729,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn conflict_message_disabled_in_config(pool: sqlx::PgPool) { let gh = GitHub::default().with_default_config( r#" @@ -753,7 +753,7 @@ report_merge_conflicts = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn conflict_message_unknown_sha(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx @@ -778,7 +778,7 @@ report_merge_conflicts = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn conflict_message_unknown_sha_approved(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx @@ -805,7 +805,7 @@ report_merge_conflicts = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn conflict_message_known_sha(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx @@ -840,7 +840,7 @@ report_merge_conflicts = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn conflict_message_known_sha_race_condition(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx @@ -875,7 +875,7 @@ report_merge_conflicts = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn conflict_label(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::default().append_to_default_config( @@ -904,7 +904,7 @@ conflict = ["+conflict"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn enqueue_prs_on_pr_opened(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx @@ -921,7 +921,7 @@ conflict = ["+conflict"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn enqueue_prs_on_pr_reopened(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| { @@ -942,7 +942,7 @@ conflict = ["+conflict"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn enqueue_prs_on_push_to_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.push_to_pr((), Commit::from_sha("foo")).await?; @@ -958,7 +958,7 @@ conflict = ["+conflict"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cancel_pending_auto_build_on_push_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -983,7 +983,7 @@ conflict = ["+conflict"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cancel_pending_auto_build_on_push_error_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_repo((), |repo| { @@ -1007,7 +1007,7 @@ conflict = ["+conflict"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cancel_pending_auto_build_on_push_updates_check_run(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1029,7 +1029,7 @@ conflict = ["+conflict"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cancel_pending_auto_build_on_close(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1052,7 +1052,7 @@ conflict = ["+conflict"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn process_bors_commands_in_pr_description(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx diff --git a/src/bors/handlers/refresh.rs b/src/bors/handlers/refresh.rs index 6659f204..defdde13 100644 --- a/src/bors/handlers/refresh.rs +++ b/src/bors/handlers/refresh.rs @@ -143,7 +143,7 @@ mod tests { use octocrab::params::checks::{CheckRunConclusion, CheckRunStatus}; use std::time::Duration; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_no_builds(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.refresh_pending_builds().await; @@ -152,7 +152,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_pr_state(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.refresh_prs().await; @@ -161,7 +161,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_do_nothing_before_timeout(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -175,7 +175,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_cancel_build_after_timeout(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -208,7 +208,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_cancel_build_apply_timeout(pool: sqlx::PgPool) { let gh = GitHub::default().append_to_default_config( r#" @@ -232,7 +232,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_cancel_build_updates_check_run(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -257,7 +257,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_cancel_workflow_after_timeout(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -277,7 +277,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_enqueues_unknown_mergeable_prs(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.edit_pr((), |pr| { @@ -299,7 +299,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_enqueues_approved_prs(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -317,7 +317,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_new_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr_id = ctx.repo().lock().add_pr(User::default_pr_author()).id(); @@ -336,7 +336,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_pr_with_status_closed(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -354,7 +354,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_pr_with_status_draft(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -369,7 +369,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_pr_with_status_closed_draft(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -388,7 +388,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_pr_properties(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -418,7 +418,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn refresh_complete_before_timeout(pool: sqlx::PgPool) { run_test( pool, @@ -455,7 +455,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn complete_build_missed_complete_webhook(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { // Start an auto build @@ -488,7 +488,7 @@ auto_build_failed = ["+failed"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn complete_build_missed_all_webhooks(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { // Start an auto build diff --git a/src/bors/handlers/review.rs b/src/bors/handlers/review.rs index 6af57fb8..18ce251f 100644 --- a/src/bors/handlers/review.rs +++ b/src/bors/handlers/review.rs @@ -564,7 +564,7 @@ mod tests { tests::{BorsBuilder, Comment, GitHub, Permissions, User, run_test}, }; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn default_approve(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r+").await?; @@ -586,7 +586,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_add_label(pool: sqlx::PgPool) { let gh = GitHub::default().append_to_default_config( r#" @@ -602,7 +602,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_on_behalf(pool: sqlx::PgPool) { let approve_user_id = 200; let approve_user = "user1"; @@ -631,7 +631,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_normalize_approver(pool: sqlx::PgPool) { let mut gh = GitHub::default(); gh.add_user(User::new(201, "foo")); @@ -658,7 +658,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_normalize_approver_multiple(pool: sqlx::PgPool) { let mut gh = GitHub::default(); for (id, name) in [(202, "foo"), (203, "bar"), (204, "baz")] { @@ -687,7 +687,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_with_unknown_reviewer(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { // Approve with a user that doesn't exist @@ -709,7 +709,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_with_unknown_team(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r=nonexistent-team").await?; @@ -730,7 +730,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_with_known_team(pool: sqlx::PgPool) { let mut gh = GitHub::default(); gh.add_team("team1"); @@ -752,7 +752,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_with_known_reviewer_different_case(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r=DEFAULT-USER").await?; @@ -769,7 +769,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn insufficient_permission_approve(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment(Comment::from("@bors try").with_author(User::unprivileged())) @@ -783,7 +783,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn insufficient_permission_set_priority(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment(Comment::from("@bors p=2").with_author(User::unprivileged())) @@ -798,7 +798,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_while_tree_is_closed(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors treeclosed=100").await?; @@ -819,7 +819,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_while_tree_is_closed_high_priority(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors treeclosed=100").await?; @@ -838,7 +838,7 @@ approved = ["+approved"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_do_not_unnecessarily_modify_labels(pool: sqlx::PgPool) { let gh = GitHub::default().append_to_default_config( r#" @@ -867,7 +867,7 @@ approved = ["+foo", "+baz", "-bar", "-foo2"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn label_respect_unless(pool: sqlx::PgPool) { let gh = GitHub::default().append_to_default_config( r#" @@ -894,7 +894,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r+").await?; @@ -921,7 +921,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_lacking_permissions(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -940,7 +940,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_closed_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -961,7 +961,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_unapproved_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r-").await?; @@ -974,7 +974,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_author(pool: sqlx::PgPool) { run_test( (pool, GitHub::unauthorized_pr_author()), @@ -1000,7 +1000,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_with_priority(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r+ p=10").await?; @@ -1015,7 +1015,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_on_behalf_with_priority(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r=user1 p=10").await?; @@ -1030,7 +1030,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn set_priority(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors p=5").await?; @@ -1040,7 +1040,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn priority_preserved_after_approve(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors p=5").await?; @@ -1055,7 +1055,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn priority_overridden_on_approve_with_priority(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors p=5").await?; @@ -1071,7 +1071,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn tree_closed_with_priority(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors treeclosed=5").await?; @@ -1097,7 +1097,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn insufficient_permission_tree_closed(pool: sqlx::PgPool) { let gh = GitHub::default(); gh.default_repo().lock().permissions = Permissions::empty(); @@ -1119,7 +1119,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } Comment::from(text).with_author(User::reviewer()) } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cannot_approve_without_delegation(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1134,7 +1134,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegate_author(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1162,7 +1162,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegatee_can_approve(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1180,7 +1180,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegatee_custom_user_can_approve(pool: sqlx::PgPool) { let user = User::new(1000, "user1"); BorsBuilder::new(pool) @@ -1204,7 +1204,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegate_error_message(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1217,7 +1217,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegatee_can_try(pool: sqlx::PgPool) { let gh = BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1240,7 +1240,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } insta::assert_snapshot!(gh.get_sha_history((), TRY_BRANCH_NAME), @"merge-0-pr-1-d7d45f1f-reauthored-to-bors"); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegatee_can_set_priority(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1256,7 +1256,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegate_insufficient_permission(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1271,7 +1271,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn undelegate_by_reviewer(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1294,7 +1294,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn undelegate_by_delegatee(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1313,7 +1313,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn reviewer_unapprove_delegated_approval(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1339,7 +1339,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn non_author_cannot_use_delegation(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1358,7 +1358,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegate_insufficient_permission_try_user(pool: sqlx::PgPool) { BorsBuilder::new(pool) .run_test(async |ctx: &mut BorsTester| { @@ -1373,7 +1373,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_with_rollup_value(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r+ rollup=never").await?; @@ -1388,7 +1388,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_with_rollup_bare(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r+ rollup").await?; @@ -1403,7 +1403,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_with_rollup_bare_maybe(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r+ rollup-").await?; @@ -1417,7 +1417,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_with_priority_rollup(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r+ p=10 rollup=never").await?; @@ -1433,7 +1433,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_on_behalf_with_rollup_bare(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r=user1 rollup").await?; @@ -1447,7 +1447,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_on_behalf_with_rollup_value(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r=user1 rollup=always").await?; @@ -1461,7 +1461,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_on_behalf_with_priority_rollup_value(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors r=user1 rollup=always priority=10") @@ -1477,7 +1477,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn set_rollup_default(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors rollup").await?; @@ -1488,7 +1488,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn set_rollup_with_value(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors rollup=maybe").await?; @@ -1499,7 +1499,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn set_rollup_try_permissions(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment(Comment::new((), "@bors rollup=never").with_author(User::try_user())) @@ -1511,7 +1511,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_preserved_after_approve(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors rollup").await?; @@ -1530,7 +1530,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_overridden_on_approve_with_rollup(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors rollup=never").await?; @@ -1550,7 +1550,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_store_sha(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.pr(()).await.get_gh_pr(); @@ -1563,7 +1563,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn reapproved_pr_uses_latest_sha(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.pr(()).await.get_gh_pr(); @@ -1586,7 +1586,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegate_try(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1610,7 +1610,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegate_try_legacy(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1634,7 +1634,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegated_try_can_build(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1655,7 +1655,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegated_try_can_not_approve(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1680,7 +1680,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegate_custom_user(pool: sqlx::PgPool) { let user = User::new(1000, "user1"); BorsBuilder::new(pool) @@ -1706,7 +1706,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn delegate_invalid_user(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::unauthorized_pr_author()) @@ -1723,7 +1723,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn multiple_commands_in_one_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment( @@ -1744,7 +1744,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_draft_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx @@ -1758,7 +1758,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_closed_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx @@ -1772,7 +1772,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_merged_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx @@ -1786,7 +1786,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_wip_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.edit_pr((), |pr| { @@ -1805,7 +1805,7 @@ approved = { modifications = ["+foo", "+baz"], unless = ["label1", "label2"] } .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_pr_with_blocked_label(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::default().append_to_default_config( @@ -1830,7 +1830,7 @@ labels_blocking_approval = ["proposed-final-comment-period"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_pr_with_blocked_labels(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::default().append_to_default_config( @@ -1857,7 +1857,7 @@ labels_blocking_approval = ["proposed-final-comment-period", "final-comment-peri .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_running_auto_build_pr_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1879,7 +1879,7 @@ labels_blocking_approval = ["proposed-final-comment-period", "final-comment-peri .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_running_auto_build_pr_failed_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_repo((), |pr| pr.workflow_cancel_error = true); @@ -1901,7 +1901,7 @@ labels_blocking_approval = ["proposed-final-comment-period", "final-comment-peri .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_running_auto_build_updates_check_run(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1923,7 +1923,7 @@ labels_blocking_approval = ["proposed-final-comment-period", "final-comment-peri .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_pr_with_merge_conflict_dirty(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| { @@ -1937,7 +1937,7 @@ labels_blocking_approval = ["proposed-final-comment-period", "final-comment-peri .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn approve_pr_with_merge_conflict_blocked(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| { @@ -1954,7 +1954,7 @@ labels_blocking_approval = ["proposed-final-comment-period", "final-comment-peri .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn reapprove_works_as_retry(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; diff --git a/src/bors/handlers/squash.rs b/src/bors/handlers/squash.rs index 1b1e30a5..1c52d1b5 100644 --- a/src/bors/handlers/squash.rs +++ b/src/bors/handlers/squash.rs @@ -432,7 +432,7 @@ mod tests { assert_eq!(author.email, expected_email); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_non_author_non_reviewer(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.post_comment(Comment::new((), "@bors squash").with_author(User::try_user())) @@ -446,7 +446,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_maintainers_can_edit_disabled(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| pr.maintainers_can_modify = false); @@ -460,7 +460,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_non_fork_pr(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| pr.head_repository = None); @@ -474,7 +474,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_tested_pr(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -489,7 +489,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_too_many_commits(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| { @@ -506,7 +506,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_single_commit(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.post_comment("@bors squash").await?; @@ -519,7 +519,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_two_commits(pool: sqlx::PgPool) { let gh = run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| { @@ -561,7 +561,7 @@ mod tests { "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_reviewer(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| pr.add_commits(vec![Commit::from_sha("foo")])); @@ -592,7 +592,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_pending_git_op_same_pr(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| pr.add_commits(vec![Commit::from_sha("foo")])); @@ -614,7 +614,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_twice(pool: sqlx::PgPool) { let gh = run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| pr.add_commits(vec![Commit::from_sha("foo")])); @@ -644,7 +644,7 @@ mod tests { "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_queue_full(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { let pr2 = open_fork_pr(ctx).await?; @@ -673,7 +673,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_hide_squash_started_comment(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| pr.add_commits(vec![Commit::from_sha("foo")])); @@ -692,7 +692,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_unapprove(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| { @@ -717,7 +717,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_custom_message(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| { @@ -739,7 +739,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_add_coauthored_by(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| { @@ -785,7 +785,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn squash_add_coauthored_by_from_commit_messages(pool: sqlx::PgPool) { run_test((pool, squash_state()), async |ctx: &mut BorsTester| { ctx.modify_pr_in_gh((), |pr| { diff --git a/src/bors/handlers/trybuild.rs b/src/bors/handlers/trybuild.rs index 0596e05b..e7c73a2e 100644 --- a/src/bors/handlers/trybuild.rs +++ b/src/bors/handlers/trybuild.rs @@ -277,7 +277,7 @@ mod tests { use crate::tests::{Comment, GitHub, User, WorkflowEvent, run_test}; use octocrab::params::checks::{CheckRunConclusion, CheckRunStatus}; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_success(pool: sqlx::PgPool) { run_test(pool.clone(), async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -298,7 +298,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_failure(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -313,7 +313,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_failure_job(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -341,7 +341,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_no_permissions(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment(Comment::from("@bors try").with_author(User::unprivileged())) @@ -355,7 +355,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_only_requires_try_permission(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment(Comment::from("@bors try").with_author(User::try_user())) @@ -373,7 +373,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_merge_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -390,7 +390,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_commit_message_strip_description(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.edit_pr((), |pr| { @@ -414,7 +414,7 @@ It fixes so many issues, sir." .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_commit_message_strip_description_keep_try_jobs(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.edit_pr((), |pr| { @@ -446,7 +446,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_commit_message_overwrite_try_jobs(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.edit_pr((), |pr| { @@ -476,7 +476,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_merge_branch_history(pool: sqlx::PgPool) { let gh = run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -497,7 +497,7 @@ try-job: Bar ), @"merge-0-pr-1-d7d45f1f-reauthored-to-bors"); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_merge_commit_author(pool: sqlx::PgPool) { let gh = run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -521,7 +521,7 @@ try-job: Bar "#); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_merge_explicit_parent(pool: sqlx::PgPool) { let gh = run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_repo((), |repo| { @@ -545,7 +545,7 @@ try-job: Bar "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_merge_last_parent(pool: sqlx::PgPool) { let gh = run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_repo((), |repo| { @@ -579,7 +579,7 @@ try-job: Bar "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_merge_last_parent_unknown(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx @@ -591,7 +591,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_merge_conflict(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_branch(TRY_MERGE_BRANCH_NAME, |branch| branch.merge_conflict = true); @@ -632,7 +632,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_merge_insert_into_db(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -652,7 +652,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_cancel_previous_build_no_workflows(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -669,7 +669,7 @@ try-job: Bar } // Make sure that the second try command knows about the result of the first one. - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn multiple_commands_in_one_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx @@ -691,7 +691,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_cancel_previous_build_running_workflows(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -714,7 +714,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_again_after_checks_finish(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -745,7 +745,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_cancel_no_running_build(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try cancel").await?; @@ -755,7 +755,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_cancel_cancel_workflows(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -778,7 +778,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_cancel_error(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_repo((), |repo| repo.workflow_cancel_error = true); @@ -796,7 +796,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_cancel_cancel_in_db(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.modify_repo((), |repo| repo.workflow_cancel_error = true); @@ -811,7 +811,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_cancel_ignore_finished_workflows(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -835,7 +835,7 @@ try-job: Bar .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_workflow_start_after_cancel(pool: sqlx::PgPool) { run_test(pool.clone(), async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -851,7 +851,7 @@ try-job: Bar assert_eq!(get_all_workflows(&pool).await.unwrap().len(), 0); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_build_failed_modify_labels(pool: sqlx::PgPool) { let gh = GitHub::default().append_to_default_config( r#" @@ -880,7 +880,7 @@ try_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_build_creates_check_run(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -899,7 +899,7 @@ try_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_build_updates_check_run_on_success(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -921,7 +921,7 @@ try_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_build_updates_check_run_on_failure(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -943,7 +943,7 @@ try_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_cancel_updates_check_run_to_cancelled(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -965,7 +965,7 @@ try_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn new_try_build_cancels_previous_and_updates_check_run(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -995,7 +995,7 @@ try_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn hide_try_build_started_comment_after_success(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -1009,7 +1009,7 @@ try_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn hide_try_build_started_comment_after_failure(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -1023,7 +1023,7 @@ try_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn hide_try_build_started_comment_after_restart(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -1039,7 +1039,7 @@ try_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn update_try_build_started_comment_after_workflow_starts(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; diff --git a/src/bors/handlers/workflow.rs b/src/bors/handlers/workflow.rs index 4bff231f..a9300743 100644 --- a/src/bors/handlers/workflow.rs +++ b/src/bors/handlers/workflow.rs @@ -234,7 +234,7 @@ mod tests { use crate::tests::{BorsBuilder, BorsTester, GitHub, default_repo_name}; use crate::tests::{WorkflowEvent, run_test}; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn workflow_started_unknown_build(pool: sqlx::PgPool) { run_test(pool.clone(), async |ctx: &mut BorsTester| { ctx.create_branch("unknown"); @@ -246,7 +246,7 @@ mod tests { assert_eq!(get_all_workflows(&pool).await.unwrap().len(), 0); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn workflow_completed_unknown_build(pool: sqlx::PgPool) { run_test(pool.clone(), async |ctx: &mut BorsTester| { ctx.create_branch("unknown"); @@ -258,7 +258,7 @@ mod tests { assert_eq!(get_all_workflows(&pool).await.unwrap().len(), 0); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_workflow_started(pool: sqlx::PgPool) { run_test(pool.clone(), async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -272,7 +272,7 @@ mod tests { assert_eq!(suite.status, WorkflowStatus::Pending); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_workflow_start_twice(pool: sqlx::PgPool) { run_test(pool.clone(), async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -289,7 +289,7 @@ mod tests { } // First start both workflows, then finish both of them. - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_success_multiple_workflows_per_suite_1(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -320,7 +320,7 @@ mod tests { } // First start and finish the first workflow, then do the same for the second one. - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_success_multiple_workflows_per_suite_2(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -351,7 +351,7 @@ mod tests { } // Finish the build early when we encounter the first failure - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_failure_multiple_workflows_early(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -372,7 +372,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn min_ci_time_mark_too_short_workflow_as_failed(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::default().append_to_default_config( @@ -400,7 +400,7 @@ min_ci_time = 10 .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn min_ci_time_ignore_failed_workflow(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::default().append_to_default_config( @@ -425,7 +425,7 @@ min_ci_time = 10 .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn min_ci_time_ignore_long_enough_workflow(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::default().append_to_default_config( @@ -454,7 +454,7 @@ min_ci_time = 20 .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn build_success_duration(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; @@ -481,7 +481,7 @@ min_ci_time = 20 .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn build_failed_duration(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors try").await?; diff --git a/src/bors/merge_queue.rs b/src/bors/merge_queue.rs index 802d4462..0038e736 100644 --- a/src/bors/merge_queue.rs +++ b/src/bors/merge_queue.rs @@ -820,7 +820,7 @@ mod tests { tests::{BorsTester, BranchPushBehaviour, BranchPushError, Comment}, }; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn disabled_merge_queue(pool: sqlx::PgPool) { BorsBuilder::new(pool) .github(GitHub::default().with_default_config( @@ -843,7 +843,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_check_run_created(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -860,7 +860,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_started_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -874,7 +874,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_success_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -897,7 +897,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_success_comment_duration_hours_minutes(pool: sqlx::PgPool) { // Test with hours and minutes (4800 seconds = 1h 20m) run_test(pool, async |ctx: &mut BorsTester| { @@ -923,7 +923,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_success_comment_duration_all_units(pool: sqlx::PgPool) { // Test with hours, minutes and seconds (12345 seconds = 3h 25m 45s) run_test(pool, async |ctx: &mut BorsTester| { @@ -949,7 +949,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_success_comment_duration_seconds_only(pool: sqlx::PgPool) { // Test with just seconds (45 seconds) run_test(pool, async |ctx: &mut BorsTester| { @@ -975,7 +975,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_failure_comment(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -991,7 +991,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_insert_into_db(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1011,7 +1011,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_succeeds_and_merges_in_db(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1025,7 +1025,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_branch_history(pool: sqlx::PgPool) { let gh = run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1053,7 +1053,7 @@ merge_queue_enabled = false ), @"merge-0-pr-1-d7d45f1f-reauthored-to-bors"); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_commit_author(pool: sqlx::PgPool) { let gh = run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1077,7 +1077,7 @@ merge_queue_enabled = false /// Make sure that when running bors concurrently, we will not start an auto build for a PR /// more than once. - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_concurrent_bors_instances(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1097,7 +1097,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn merge_queue_sequential_order(pool: sqlx::PgPool) { let gh = run_test(pool, async |ctx: &mut BorsTester| { let prs = [ @@ -1134,7 +1134,7 @@ merge_queue_enabled = false "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn merge_queue_priority_order(pool: sqlx::PgPool) { let gh = run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -1167,7 +1167,7 @@ merge_queue_enabled = false "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_push_conflict(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1187,7 +1187,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_push_validation_failed(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1207,7 +1207,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_push_error_transient_error(pool: sqlx::PgPool) { let gh = run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1225,7 +1225,7 @@ merge_queue_enabled = false insta::assert_snapshot!(gh.get_sha_history((), default_branch_name()), @"main-sha1"); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_push_error_fails_in_db(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1246,7 +1246,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_push_error_retry_recovers_and_merges(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1275,7 +1275,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_start_merge_conflict(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx @@ -1301,7 +1301,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_mergeable_state_sanity_check_fails(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -1324,7 +1324,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_mergeable_state_sanity_check_fails_conflict_source(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -1361,7 +1361,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_status_sanity_check_fails(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr = ctx.open_pr((), |_| {}).await?; @@ -1377,7 +1377,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_sha_mismatch_sanity_check_fails(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1402,7 +1402,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_success_updates_check_run(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1419,7 +1419,7 @@ merge_queue_enabled = false .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_success_labels(pool: sqlx::PgPool) { let github = GitHub::default().append_to_default_config( r#" @@ -1449,7 +1449,7 @@ auto_build_succeeded = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_failed_labels(pool: sqlx::PgPool) { let github = GitHub::default().append_to_default_config( r#" @@ -1481,7 +1481,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn auto_build_failure_updates_check_run(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1501,7 +1501,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn finish_auto_build_while_tree_is_closed_1(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { // Start an auto build with the default priority (0) @@ -1526,7 +1526,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn finish_auto_build_while_tree_is_closed_2(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { // Start an auto build with the default priority (0) @@ -1552,7 +1552,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn tree_closed_merge_open(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.post_comment("@bors treeclosed=100").await?; @@ -1588,7 +1588,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn run_empty_queue(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { // This PR should not be in the queue @@ -1604,7 +1604,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn update_auto_build_started_comment_after_workflow_starts(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1628,7 +1628,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn hide_auto_build_started_comment_after_workflow_finish(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1646,7 +1646,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] // Recover from a situation where an approved PR goes to the head of the queue, but it received // a new push in the meantime, but bors missed the webhook about that push. - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn recover_approved_sha_mismatch_missed_webhook(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr(default_repo_name(), |_| {}).await?; @@ -1677,7 +1677,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn recover_wrong_pr_status_missed_webhook(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr(default_repo_name(), |_| {}).await?; @@ -1705,7 +1705,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn try_build_while_auto_build_is_running(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1721,7 +1721,7 @@ auto_build_failed = ["+foo", "+bar", "-baz"] .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn commit_message_skip_ignore_block(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.edit_pr((), |pr| { @@ -1765,7 +1765,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cancel_try_again(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1787,7 +1787,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn cancel_change_order(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -1825,7 +1825,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn do_not_merge_timed_out_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?; @@ -1850,7 +1850,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn wait_for_unknown_mergeability_status(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -1878,7 +1878,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn unapprove_conflicted_pr(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -1901,7 +1901,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn github_reopens_merged_pr(pool: sqlx::PgPool) { // Sometimes, GitHub does not notice that a pull request was actually merged, and it still // claims that it is open. diff --git a/src/database/operations.rs b/src/database/operations.rs index 56519bac..06aa42bb 100644 --- a/src/database/operations.rs +++ b/src/database/operations.rs @@ -1333,7 +1333,7 @@ mod tests { use crate::github::{GithubRepoName, PullRequestNumber}; use sqlx::PgPool; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn upsert_pr_do_not_clear_mergeable_stale_flag(pool: PgPool) { let make_pr = |mergeable_state| UpsertPullRequestParams { pr_number: PullRequestNumber(1), diff --git a/src/github/rollup.rs b/src/github/rollup.rs index b1cc8182..04b9068f 100644 --- a/src/github/rollup.rs +++ b/src/github/rollup.rs @@ -444,7 +444,7 @@ mod tests { use http::StatusCode; use std::collections::{HashMap, HashSet}; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_missing_fork(pool: sqlx::PgPool) { let mut gh = GitHub::default(); gh.add_user(rollup_user()); @@ -470,7 +470,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_non_rollupable_pr(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr1 = ctx.open_pr((), |_| {}).await?; @@ -488,7 +488,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_nonexistent_pr(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { ctx.api_request(rollup_request( @@ -504,7 +504,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_too_many_prs(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let prs = (1..60).map(PullRequestNumber).collect::>(); @@ -521,7 +521,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_missing_review_permissions(pool: sqlx::PgPool) { let mut gh = GitHub::default(); gh.add_user(rollup_user()); @@ -539,7 +539,7 @@ mod tests { .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_merge_conflict(pool: sqlx::PgPool) { let gh = run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { ctx.modify_repo(fork_repo(), |repo| { @@ -599,7 +599,7 @@ mod tests { "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_different_base_branch(pool: sqlx::PgPool) { let gh = run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let beta = ctx.create_branch("beta"); @@ -639,7 +639,7 @@ mod tests { "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_recover_merge_error(pool: sqlx::PgPool) { let gh = run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -683,7 +683,7 @@ mod tests { "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup(pool: sqlx::PgPool) { let gh = run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -726,7 +726,7 @@ mod tests { /// Ensure that a PR can be associated to multiple rollups. /// This can happen when opening a new rollup similar to an existing one, before closing the old one. - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn multiple_rollups_same_pr(pool: sqlx::PgPool) { let gh = run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -767,7 +767,7 @@ mod tests { "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_order_by_priority(pool: sqlx::PgPool) { let gh = run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -807,7 +807,7 @@ mod tests { "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_duplicates(pool: sqlx::PgPool) { let gh = run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -836,7 +836,7 @@ mod tests { "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_remove_homu_ignore_block(pool: sqlx::PgPool) { let gh = run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx @@ -892,7 +892,7 @@ also include this pls" "); } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_marked_as_rollup_never(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -907,7 +907,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_mark_as_rollup_always(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -924,7 +924,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_mark_as_rollup_always_in_approve(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -941,7 +941,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_draft_pr(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -959,7 +959,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_unapprove_member(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -991,7 +991,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_unapprove_member_contained_in_multiple_rollups(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -1033,7 +1033,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_unapprove_member_rollup_not_approved(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -1058,7 +1058,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_unapprove_member_cancel_auto_build(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -1090,7 +1090,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_close_on_member_push(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -1125,7 +1125,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_close_on_member_close(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; @@ -1158,7 +1158,7 @@ also include this pls" .await; } - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn rollup_member_sha_failed_sanity_check(pool: sqlx::PgPool) { run_test((pool, rollup_state()), async |ctx: &mut BorsTester| { let pr2 = ctx.open_pr((), |_| {}).await?; diff --git a/src/lib.rs b/src/lib.rs index 05417ca2..b22d230b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,5 +24,15 @@ pub use permissions::TeamApiClient; pub use server::ServerState; pub use server::create_app; +/// This migrator serves for including a single place in the test code that stores all migrations +/// loaded from disk. All sqlx tests should then reference it using +/// `#[sqlx::test(migrator = "crate::MIGRATOR"]`. +/// +/// This makes tests much faster to rebuild, otherwise each test would load the migrations and +/// crucially include their copy in the source code for each test, which bloats the binary and +/// makes compilation slower. +#[cfg(test)] +static MIGRATOR: sqlx::migrate::Migrator = sqlx::migrate!(); + #[cfg(test)] mod tests; diff --git a/src/server/mod.rs b/src/server/mod.rs index 691c33a2..c2106b27 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -484,7 +484,7 @@ mod tests { use crate::tests::{ApiRequest, default_repo_name}; use crate::tests::{BorsTester, run_test}; - #[sqlx::test] + #[sqlx::test(migrator = "crate::MIGRATOR")] async fn api_queue_page(pool: sqlx::PgPool) { run_test(pool, async |ctx: &mut BorsTester| { ctx.approve(()).await?;