@@ -88,20 +88,27 @@ def stream_query_result(driver, query):
88
88
return result , error
89
89
90
90
91
- @pytest .fixture (scope = 'function ' )
92
- def prepared_test_env (ydb_cluster , ydb_root , ydb_database , ydb_client ):
91
+ @pytest .fixture (scope = 'module ' )
92
+ def prepared_root_db (ydb_cluster , ydb_root , ydb_endpoint ):
93
93
cluster_admin = ydb .AuthTokenCredentials (ydb_cluster .config .default_clusteradmin )
94
94
95
95
# prepare root database
96
- with ydb_client (ydb_root , credentials = cluster_admin ) as driver :
96
+ driver_config = ydb .DriverConfig (ydb_endpoint , ydb_root , credentials = cluster_admin )
97
+ with ydb .Driver (driver_config ) as driver :
97
98
pool = ydb .SessionPool (driver )
98
99
with pool .checkout () as session :
99
100
session .execute_scheme ("create user clusteradmin password '1234'" )
100
101
session .execute_scheme ("create user clusteruser password '1234'" )
101
102
103
+
104
+ @pytest .fixture (scope = 'module' )
105
+ def prepared_tenant_db (ydb_cluster , ydb_endpoint , ydb_database_module_scope ):
106
+ cluster_admin = ydb .AuthTokenCredentials (ydb_cluster .config .default_clusteradmin )
107
+
102
108
# prepare tenant database
103
- database_path = ydb_database
104
- with ydb_client (database_path , credentials = cluster_admin ) as driver :
109
+ database_path = ydb_database_module_scope
110
+ driver_config = ydb .DriverConfig (ydb_endpoint , database_path , credentials = cluster_admin )
111
+ with ydb .Driver (driver_config ) as driver :
105
112
pool = ydb .SessionPool (driver )
106
113
with pool .checkout () as session :
107
114
# add users
@@ -139,8 +146,8 @@ def login_user(endpoint, database, user, password):
139
146
('dbadmin' , True ),
140
147
('ordinaryuser' , False )
141
148
])
142
- def test_tenant_auth_groups_access (ydb_endpoint , ydb_root , prepared_test_env , ydb_client , user , expected_access ):
143
- tenant_database = prepared_test_env
149
+ def test_tenant_auth_groups_access (ydb_endpoint , ydb_root , prepared_root_db , prepared_tenant_db , ydb_client , user , expected_access ):
150
+ tenant_database = prepared_tenant_db
144
151
145
152
# user could be either from the root or tenant database,
146
153
# but they must obtain auth token by logging in the database they live in
0 commit comments