File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
tests/integration/resource_manager Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -164,3 +164,16 @@ class _DatabaseUpdateRequest(FireboltBaseModel):
164164 return Database .parse_obj_with_service (
165165 response .json ()["database" ], self ._service
166166 )
167+
168+ def get_default_engine (self ) -> Optional [Engine ]:
169+ """
170+ Returns: default engine of the database, or None if default engine is missing
171+ """
172+ rm = self ._service .resource_manager
173+ default_engines = [
174+ rm .engines .get (binding .engine_id )
175+ for binding in rm .bindings .get_many (database_id = self .database_id )
176+ if binding .is_default_engine
177+ ]
178+
179+ return None if len (default_engines ) == 0 else default_engines [0 ]
Original file line number Diff line number Diff line change 1+ from firebolt .common import Settings
2+ from firebolt .service .manager import ResourceManager
3+
4+
5+ def test_database_get_default_engine (
6+ rm_settings : Settings ,
7+ database_name : str ,
8+ stopped_engine_name : str ,
9+ engine_name : str ,
10+ ):
11+ """
12+ Checks that the default engine is either running or stopped engine
13+ """
14+ rm = ResourceManager (rm_settings )
15+
16+ db = rm .databases .get_by_name (database_name )
17+
18+ engine = db .get_default_engine ()
19+ assert engine is not None , "default engine is None, but shouldn't"
20+ assert engine .name in [
21+ stopped_engine_name ,
22+ engine_name ,
23+ ], "Returned default engine name is neither of known engines"
You can’t perform that action at this time.
0 commit comments