- Notifications
You must be signed in to change notification settings - Fork37
Pbckp 152 multihost#78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
02c33751512afd0d62e0e8be1b3a51f05def1310884f38bd50da2ee22bc17f0f9b6bdbac77ef7b048041e098b971c405ef8c373e672e6d5d2c2d2c51b4f74a2e916df0528541089ab9b190d0840c26f770796bc40f1403412aa7ba4e7f4b0File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,10 +5,10 @@ | ||
| import tempfile | ||
| from contextlib import contextmanager | ||
| from .consts import TMP_CACHE | ||
| from .operations.os_ops import OsOperations | ||
| from .operations.local_ops import LocalOperations | ||
| class GlobalConfig(object): | ||
| @@ -43,6 +43,9 @@ class GlobalConfig(object): | ||
| _cached_initdb_dir = None | ||
| """ underlying class attribute for cached_initdb_dir property """ | ||
| os_ops = LocalOperations() | ||
| """ OsOperation object that allows work on remote host """ | ||
| @property | ||
| def cached_initdb_dir(self): | ||
| """ path to a temp directory for cached initdb. """ | ||
| @@ -54,6 +57,7 @@ def cached_initdb_dir(self, value): | ||
| if value: | ||
| cached_initdb_dirs.add(value) | ||
| return testgres_config.cached_initdb_dir | ||
| @property | ||
| def temp_dir(self): | ||
| @@ -118,6 +122,11 @@ def copy(self): | ||
| return copy.copy(self) | ||
| @staticmethod | ||
| def set_os_ops(os_ops: OsOperations): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Didn't found calls to test_os_ops() with RemoteOperations. Is it as expected? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It is in test_simple_remote.py:59 | ||
| testgres_config.os_ops = os_ops | ||
| testgres_config.cached_initdb_dir = os_ops.mkdtemp(prefix=TMP_CACHE) | ||
| # cached dirs to be removed | ||
| cached_initdb_dirs = set() | ||
| @@ -135,7 +144,7 @@ def copy(self): | ||
| @atexit.register | ||
| def _rm_cached_initdb_dirs(): | ||
| for d in cached_initdb_dirs: | ||
| testgres_config.os_ops.rmdirs(d, ignore_errors=True) | ||
| def push_config(**options): | ||
| @@ -198,4 +207,4 @@ def configure_testgres(**options): | ||
| # NOTE: assign initial cached dir for initdb | ||
| testgres_config.cached_initdb_dir =testgres_config.os_ops.mkdtemp(prefix=TMP_CACHE) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| import datetime | ||
| import struct | ||
| import uuid | ||
| from .config import testgres_config as tconf | ||
| def default_dbname(): | ||
| """ | ||
| @@ -17,8 +17,7 @@ def default_username(): | ||
| """ | ||
| Return default username (current user). | ||
| """ | ||
| return tconf.os_ops.get_user() | ||
| def generate_app_name(): | ||
| @@ -44,7 +43,7 @@ def generate_system_id(): | ||
| system_id = 0 | ||
| system_id |= (secs << 32) | ||
| system_id |= (usecs << 12) | ||
| system_id |= (tconf.os_ops.get_pid() & 0xFFF) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. no override tconf.os_ops for RemoteOperations. is it as expected? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It's setting up in testgres_config.set_os_ops(os_ops=os_ops) and inside PostgresNode testgres_config.os_ops = self.os_ops | ||
| # pack ULL in native byte order | ||
| return struct.pack('=Q', system_id) | ||
Uh oh!
There was an error while loading.Please reload this page.