fix: Remove some calls to iox_object_store.database_name

pull/24376/head
Carol (Nichols || Goulding) 2021-10-08 09:41:43 -04:00
parent 222f452a8a
commit fbe76935f4
2 changed files with 13 additions and 7 deletions

View File

@ -188,6 +188,7 @@ mod tests {
#[tokio::test] #[tokio::test]
async fn test_rebuild_successfull() { async fn test_rebuild_successfull() {
let iox_object_store = make_iox_object_store().await; let iox_object_store = make_iox_object_store().await;
let db_name = Arc::from("db1");
// build catalog with some data // build catalog with some data
let (catalog, mut state) = let (catalog, mut state) =
@ -197,11 +198,11 @@ mod tests {
{ {
let mut transaction = catalog.open_transaction().await; let mut transaction = catalog.open_transaction().await;
let info = create_parquet_file(&iox_object_store, ChunkId::new_test(0)).await; let info = create_parquet_file(&db_name, &iox_object_store, ChunkId::new_test(0)).await;
state.insert(info.clone()).unwrap(); state.insert(info.clone()).unwrap();
transaction.add_parquet(&info); transaction.add_parquet(&info);
let info = create_parquet_file(&iox_object_store, ChunkId::new_test(1)).await; let info = create_parquet_file(&db_name, &iox_object_store, ChunkId::new_test(1)).await;
state.insert(info.clone()).unwrap(); state.insert(info.clone()).unwrap();
transaction.add_parquet(&info); transaction.add_parquet(&info);
@ -215,7 +216,7 @@ mod tests {
{ {
let mut transaction = catalog.open_transaction().await; let mut transaction = catalog.open_transaction().await;
let info = create_parquet_file(&iox_object_store, ChunkId::new_test(2)).await; let info = create_parquet_file(&db_name, &iox_object_store, ChunkId::new_test(2)).await;
state.insert(info.clone()).unwrap(); state.insert(info.clone()).unwrap();
transaction.add_parquet(&info); transaction.add_parquet(&info);
@ -275,6 +276,7 @@ mod tests {
#[tokio::test] #[tokio::test]
async fn test_rebuild_no_metadata() { async fn test_rebuild_no_metadata() {
let iox_object_store = make_iox_object_store().await; let iox_object_store = make_iox_object_store().await;
let db_name = Arc::from("db1");
// build catalog with same data // build catalog with same data
let catalog = let catalog =
@ -283,7 +285,8 @@ mod tests {
.unwrap(); .unwrap();
// file w/o metadata // file w/o metadata
create_parquet_file_without_metadata(&iox_object_store, ChunkId::new_test(0)).await; create_parquet_file_without_metadata(&db_name, &iox_object_store, ChunkId::new_test(0))
.await;
// wipe catalog // wipe catalog
drop(catalog); drop(catalog);
@ -357,6 +360,7 @@ mod tests {
} }
pub async fn create_parquet_file( pub async fn create_parquet_file(
db_name: &Arc<str>,
iox_object_store: &Arc<IoxObjectStore>, iox_object_store: &Arc<IoxObjectStore>,
chunk_id: ChunkId, chunk_id: ChunkId,
) -> CatalogParquetInfo { ) -> CatalogParquetInfo {
@ -385,7 +389,7 @@ mod tests {
let (path, file_size_bytes, metadata) = storage let (path, file_size_bytes, metadata) = storage
.write_to_object_store( .write_to_object_store(
ChunkAddr { ChunkAddr {
db_name: iox_object_store.database_name().into(), db_name: Arc::clone(db_name),
table_name, table_name,
partition_key, partition_key,
chunk_id, chunk_id,
@ -404,6 +408,7 @@ mod tests {
} }
pub async fn create_parquet_file_without_metadata( pub async fn create_parquet_file_without_metadata(
db_name: &Arc<str>,
iox_object_store: &Arc<IoxObjectStore>, iox_object_store: &Arc<IoxObjectStore>,
chunk_id: ChunkId, chunk_id: ChunkId,
) -> (ParquetFilePath, IoxParquetMetaData) { ) -> (ParquetFilePath, IoxParquetMetaData) {
@ -426,7 +431,7 @@ mod tests {
let md = IoxParquetMetaData::from_file_bytes(data.clone()).unwrap(); let md = IoxParquetMetaData::from_file_bytes(data.clone()).unwrap();
let storage = Storage::new(Arc::clone(iox_object_store)); let storage = Storage::new(Arc::clone(iox_object_store));
let chunk_addr = ChunkAddr { let chunk_addr = ChunkAddr {
db_name: Arc::from(iox_object_store.database_name()), db_name: Arc::clone(db_name),
table_name: Arc::from("table1"), table_name: Arc::from("table1"),
partition_key: Arc::from("part1"), partition_key: Arc::from("part1"),
chunk_id, chunk_id,

View File

@ -488,6 +488,7 @@ mod tests {
let partition_key = Arc::from("my_partition"); let partition_key = Arc::from("my_partition");
let chunk_id = ChunkId::new_test(33); let chunk_id = ChunkId::new_test(33);
let iox_object_store = make_iox_object_store().await; let iox_object_store = make_iox_object_store().await;
let db_name = Arc::from("db1");
let storage = Storage::new(Arc::clone(&iox_object_store)); let storage = Storage::new(Arc::clone(&iox_object_store));
// write the data in // write the data in
@ -515,7 +516,7 @@ mod tests {
let (path, _file_size_bytes, _metadata) = storage let (path, _file_size_bytes, _metadata) = storage
.write_to_object_store( .write_to_object_store(
ChunkAddr { ChunkAddr {
db_name: iox_object_store.database_name().into(), db_name: Arc::clone(&db_name),
table_name, table_name,
partition_key, partition_key,
chunk_id, chunk_id,