()
| 900 | |
| 901 | #[test] |
| 902 | fn remove_empty_table_succeeds() -> anyhow::Result<()> { |
| 903 | let auth_ctx = AuthCtx::for_testing(); |
| 904 | let stdb = TestDB::durable()?; |
| 905 | |
| 906 | let old = single_table_module(); |
| 907 | let new = empty_module(); |
| 908 | |
| 909 | let mut tx = begin_mut_tx(&stdb); |
| 910 | for def in old.tables() { |
| 911 | create_table_from_def(&stdb, &mut tx, &old, def)?; |
| 912 | } |
| 913 | stdb.commit_tx(tx)?; |
| 914 | |
| 915 | let mut tx = begin_mut_tx(&stdb); |
| 916 | let plan = ponder_migrate(&old, &new)?; |
| 917 | let res = update_database(&stdb, &mut tx, auth_ctx, plan, &TestLogger)?; |
| 918 | |
| 919 | assert!( |
| 920 | matches!(res, UpdateResult::RequiresClientDisconnect), |
| 921 | "removing a table should disconnect clients" |
| 922 | ); |
| 923 | assert!(stdb.table_id_from_name_mut(&tx, "droppable")?.is_none()); |
| 924 | assert!( |
| 925 | tx.pending_schema_changes() |
| 926 | .iter() |
| 927 | .any(|c| matches!(c, PendingSchemaChange::TableRemoved(..))), |
| 928 | "dropping a table should produce a TableRemoved pending schema change: {:?}", |
| 929 | tx.pending_schema_changes() |
| 930 | ); |
| 931 | Ok(()) |
| 932 | } |
| 933 | |
| 934 | #[test] |
| 935 | fn remove_nonempty_table_fails() -> anyhow::Result<()> { |
nothing calls this directly
no test coverage detected
searching dependent graphs…