@@ -22,15 +22,18 @@ use opendatafabric::*;
22
22
23
23
/////////////////////////////////////////////////////////////////////////////////////////
24
24
25
- fn create_catalog_with_local_workspace ( tempdir : & Path ) -> dill:: Catalog {
25
+ fn create_catalog_with_local_workspace ( tempdir : & Path , is_multitenant : bool ) -> dill:: Catalog {
26
+ let datasets_dir = tempdir. join ( "datasets" ) ;
27
+ std:: fs:: create_dir ( & datasets_dir) . unwrap ( ) ;
28
+
26
29
dill:: CatalogBuilder :: new ( )
27
30
. add :: < EventBus > ( )
28
31
. add :: < DependencyGraphServiceInMemory > ( )
29
32
. add_builder (
30
33
DatasetRepositoryLocalFs :: builder ( )
31
- . with_root ( tempdir . join ( "datasets" ) )
34
+ . with_root ( datasets_dir )
32
35
. with_current_account_subject ( Arc :: new ( CurrentAccountSubject :: new_test ( ) ) )
33
- . with_multi_tenant ( false ) ,
36
+ . with_multi_tenant ( is_multitenant ) ,
34
37
)
35
38
. bind :: < dyn DatasetRepository , DatasetRepositoryLocalFs > ( )
36
39
. add :: < QueryServiceImpl > ( )
@@ -42,12 +45,16 @@ fn create_catalog_with_local_workspace(tempdir: &Path) -> dill::Catalog {
42
45
43
46
/////////////////////////////////////////////////////////////////////////////////////////
44
47
45
- async fn create_test_dataset ( catalog : & dill:: Catalog , tempdir : & Path ) {
48
+ async fn create_test_dataset (
49
+ catalog : & dill:: Catalog ,
50
+ tempdir : & Path ,
51
+ account_name : Option < AccountName > ,
52
+ ) {
46
53
let dataset_repo = catalog. get_one :: < dyn DatasetRepository > ( ) . unwrap ( ) ;
47
54
48
55
let dataset = dataset_repo
49
56
. create_dataset (
50
- & DatasetAlias :: new ( None , DatasetName :: new_unchecked ( "foo" ) ) ,
57
+ & DatasetAlias :: new ( account_name , DatasetName :: new_unchecked ( "foo" ) ) ,
51
58
MetadataFactory :: metadata_block ( MetadataFactory :: seed ( DatasetKind :: Root ) . build ( ) )
52
59
. build_typed ( ) ,
53
60
)
@@ -103,8 +110,8 @@ async fn create_test_dataset(catalog: &dill::Catalog, tempdir: &Path) {
103
110
#[ test_log:: test( tokio:: test) ]
104
111
async fn test_dataset_schema_local_fs ( ) {
105
112
let tempdir = tempfile:: tempdir ( ) . unwrap ( ) ;
106
- let catalog = create_catalog_with_local_workspace ( tempdir. path ( ) ) ;
107
- create_test_dataset ( & catalog, tempdir. path ( ) ) . await ;
113
+ let catalog = create_catalog_with_local_workspace ( tempdir. path ( ) , true ) ;
114
+ create_test_dataset ( & catalog, tempdir. path ( ) , None ) . await ;
108
115
109
116
let schema = kamu_adapter_graphql:: schema_quiet ( ) ;
110
117
let res = schema
@@ -162,8 +169,8 @@ async fn test_dataset_schema_local_fs() {
162
169
#[ test_log:: test( tokio:: test) ]
163
170
async fn test_dataset_tail_local_fs ( ) {
164
171
let tempdir = tempfile:: tempdir ( ) . unwrap ( ) ;
165
- let catalog = create_catalog_with_local_workspace ( tempdir. path ( ) ) ;
166
- create_test_dataset ( & catalog, tempdir. path ( ) ) . await ;
172
+ let catalog = create_catalog_with_local_workspace ( tempdir. path ( ) , true ) ;
173
+ create_test_dataset ( & catalog, tempdir. path ( ) , None ) . await ;
167
174
168
175
let schema = kamu_adapter_graphql:: schema_quiet ( ) ;
169
176
let res = schema
@@ -203,8 +210,8 @@ async fn test_dataset_tail_local_fs() {
203
210
#[ test_log:: test( tokio:: test) ]
204
211
async fn test_dataset_tail_empty_local_fs ( ) {
205
212
let tempdir = tempfile:: tempdir ( ) . unwrap ( ) ;
206
- let catalog = create_catalog_with_local_workspace ( tempdir. path ( ) ) ;
207
- create_test_dataset ( & catalog, tempdir. path ( ) ) . await ;
213
+ let catalog = create_catalog_with_local_workspace ( tempdir. path ( ) , true ) ;
214
+ create_test_dataset ( & catalog, tempdir. path ( ) , None ) . await ;
208
215
209
216
let schema = kamu_adapter_graphql:: schema_quiet ( ) ;
210
217
let res = schema
0 commit comments