Skip to content

Commit b9ee708

Browse files
Georgi RusevGeorgi Rusev
Georgi Rusev
authored and
Georgi Rusev
committed
added comments
1 parent b1961c9 commit b9ee708

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

python/arcticdb/util/environment_setup.py

+32-3
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ class StorageSetup:
9191
Place here what is needed for proper initialization
9292
of each storage
9393
94-
For shared storages
95-
94+
Abstracts storage space allocation from how user access it
9695
'''
9796
_instance = None
9897
_aws_default_factory: BaseS3StorageFixtureFactory = None
@@ -180,6 +179,33 @@ def get_arctic_uri(cls, storage: Storage, storage_space: StorageSpace, add_to_pr
180179

181180

182181
class TestLibraryManager:
182+
"""
183+
This class provides thin isolation of tests from storage and from arctic.
184+
This provides following benefits:
185+
186+
- Any changes in the structure of how things are stored would not reflect the test case.
187+
- New types of storages can be added quickly and without impact for the test
188+
- Same tests can quickly be executed against new types of storages, or just experiment
189+
with new storages by simply changing storage type
190+
- A test ca be executed in test mode through `set_test_more` until it reaches production
191+
state. then simply removing this from the test makes it production. That isolates well
192+
production data from test data
193+
194+
The class provides very limited set of functions which are more than enough to make any
195+
end 2 end tests with ASV or other frameworks. The only thing it discourages is use of
196+
Arctic directly. That is with single goal to protect shared storage from unintentional damage.
197+
All work should be done through `get_library` function. There are methods for setting library options,
198+
and additional `has_library` method that would eliminate the need of direct use of Arctic object
199+
200+
As there could be very few cases that could require use of Arctic object directly, such protected
201+
methods do exist, but their use makes any test potentially either unsafe or one that should be
202+
handled with extra care
203+
204+
The class provides additional 2 class methods which should be handled with care. As they create
205+
always new connection any concurrent modifications with them and running tests would most
206+
probably end with errors.
207+
208+
"""
183209

184210
def __init__(self, storage: Storage, name_benchmark: str, library_options: LibraryOptions = None) :
185211
"""
@@ -189,7 +215,6 @@ def __init__(self, storage: Storage, name_benchmark: str, library_options: Libra
189215
self.library_options: LibraryOptions = library_options
190216
self.name_benchmark: str = name_benchmark
191217
self._test_mode = False
192-
self._uris_cache: List[str] = []
193218
self._ac_cache = {}
194219
StorageSetup()
195220

@@ -576,6 +601,10 @@ def get_next_timestamp_number(self, sequence_df_list: List[pd.DataFrame], freq:
576601
return next
577602

578603
class TestsForTestLibraryManager:
604+
"""
605+
This class contains tests for the framework. All changes to the framework
606+
should be done with running those tests at the end
607+
"""
579608

580609
@classmethod
581610
def test_test_mode(cls):

0 commit comments

Comments
 (0)