Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Cleanup S3 bucket after bottomless test #565

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions sqld/src/test/bottomless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn start_db(step: u32, config: &Config) -> JoinHandle<()> {
})
}

#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn backup_restore() {
let _ = env_logger::builder().is_test(true).try_init();
const BUCKET: &str = "testbackuprestore";
Expand All @@ -44,6 +44,7 @@ async fn backup_restore() {
bucket_name: BUCKET.to_string(),
max_batch_interval: Duration::from_millis(250),
restore_transaction_page_swap_after: 1, // in this test swap should happen at least once
aws_endpoint: Some(S3_URL.to_string()),
..bottomless::replicator::Options::from_env().unwrap()
}),
db_path: PATH.into(),
Expand Down Expand Up @@ -192,7 +193,7 @@ async fn backup_restore() {
}
}

#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn rollback_restore() {
let _ = env_logger::builder().is_test(true).try_init();
const BUCKET: &str = "testrollbackrestore";
Expand Down Expand Up @@ -230,6 +231,7 @@ async fn rollback_restore() {
bucket_name: BUCKET.to_string(),
max_batch_interval: Duration::from_millis(250),
restore_transaction_page_swap_after: 1, // in this test swap should happen at least once
aws_endpoint: Some(S3_URL.to_string()),
..bottomless::replicator::Options::from_env().unwrap()
}),
db_path: PATH.into(),
Expand Down Expand Up @@ -416,7 +418,8 @@ impl S3BucketCleaner {

impl Drop for S3BucketCleaner {
fn drop(&mut self) {
//FIXME: running line below on tokio::test runtime will hang.
//let _ = block_on(Self::cleanup(self.0));
tokio::task::block_in_place(|| {
let _ = tokio::runtime::Handle::current().block_on(Self::cleanup(self.0));
});
}
}