MCPcopy Create free account
hub / github.com/chatmail/core / test_migration_flags

Function test_migration_flags

src/sql/sql_tests.rs:176–208  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174
175#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
176async fn test_migration_flags() -> Result<()> {
177 let t = TestContext::new().await;
178 t.evtracker.get_info_contains("Opened database").await;
179
180 // as migrations::run() was already executed on context creation,
181 // another call should not result in any action needed.
182 // this test catches some bugs where dbversion was forgotten to be persisted.
183 let recode_avatar = migrations::run(&t, &t.sql).await?;
184 assert!(!recode_avatar);
185
186 info!(&t, "test_migration_flags: XXX END MARKER");
187
188 loop {
189 let evt = t
190 .evtracker
191 .get_matching(|evt| matches!(evt, EventType::Info(_)))
192 .await;
193 match evt {
194 EventType::Info(msg) => {
195 assert!(
196 !msg.contains("[migration]"),
197 "Migrations were run twice, you probably forgot to update the db version"
198 );
199 if msg.contains("test_migration_flags: XXX END MARKER") {
200 break;
201 }
202 }
203 _ => unreachable!(),
204 }
205 }
206
207 Ok(())
208}
209
210#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
211async fn test_check_passphrase() -> Result<()> {

Callers

nothing calls this directly

Calls 3

runFunction · 0.70
get_info_containsMethod · 0.45
get_matchingMethod · 0.45

Tested by

no test coverage detected