Skip to content
Merged
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
46 changes: 46 additions & 0 deletions server/tests/boot_log.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod common;

use common::{config, forge};
use lfsx_server::config::{Config, Dialect, Storage};

#[derive(Clone, Default)]
struct Captured(std::sync::Arc<std::sync::Mutex<Vec<u8>>>);
Expand Down Expand Up @@ -52,3 +53,48 @@ async fn a_boot_says_what_access_is_configured_once() {
"{logged}"
);
}

#[tokio::test]
async fn a_boot_says_the_objects_are_in_a_bucket_once() {
let root = tempfile::tempdir().unwrap();
let (api_url, _forge) = forge().await;
let config = Config {
storage: Storage::Bucket {
dialect: Dialect::S3 {
endpoint: "http://127.0.0.1:9".into(),
bucket: "lfsx".into(),
region: "us-east-1".into(),
access_key: "key".into(),
secret_key: "secret".into(),
path_style: true,
},
presign: false,
cache: None,
locking: true,
},
..config(&root, &api_url)
};

let captured = Captured::default();
{
let _guard = tracing::subscriber::set_default(
tracing_subscriber::fmt()
.with_writer(captured.clone())
.with_max_level(tracing::Level::INFO)
.with_ansi(false)
.finish(),
);

lfsx_server::store(&config);
let _app = lfsx_server::app(config.clone());
}
let logged = String::from_utf8(captured.0.lock().unwrap().clone()).unwrap();

assert_eq!(
logged
.matches("objects and locks are stored in a bucket")
.count(),
1,
"{logged}"
);
}
Loading