testgres 1.16.3__tar.gz → 1.16.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {testgres-1.16.3/testgres.egg-info → testgres-1.16.4}/PKG-INFO +1 -1
- {testgres-1.16.3 → testgres-1.16.4}/src/__init__.py +1 -1
- {testgres-1.16.3 → testgres-1.16.4}/src/node.py +10 -1
- {testgres-1.16.3 → testgres-1.16.4/testgres.egg-info}/PKG-INFO +1 -1
- {testgres-1.16.3 → testgres-1.16.4}/tests/test_testgres_common.py +84 -1
- {testgres-1.16.3 → testgres-1.16.4}/LICENSE +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/README.md +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/pyproject.toml +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/setup.cfg +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/api.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/backup.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/cache.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/config.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/connection.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/consts.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/decorators.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/defaults.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/enums.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/exceptions.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/file_line_reader.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/internal_node_utils.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/internal_utils.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/platforms/darwin/internal_platform_utils.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/platforms/internal_platform_utils.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/platforms/internal_platform_utils_factory.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/platforms/internal_platform_utils_provider.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/platforms/linux/internal_platform_utils.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/platforms/win32/internal_platform_utils.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/port_manager__generic.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/port_manager__generic2.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/impl/port_manager__this_host.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/logger.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/node_app.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/node_state.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/port_manager.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/pubsub.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/raise_error.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/standby.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/src/utils.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/testgres.egg-info/SOURCES.txt +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/testgres.egg-info/dependency_links.txt +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/testgres.egg-info/requires.txt +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/testgres.egg-info/top_level.txt +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/tests/test_api.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/tests/test_config.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/tests/test_os_ops_common.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/tests/test_os_ops_local.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/tests/test_os_ops_remote.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/tests/test_raise_error.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/tests/test_testgres_local.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/tests/test_testgres_remote.py +0 -0
- {testgres-1.16.3 → testgres-1.16.4}/tests/test_utils.py +0 -0
|
@@ -60,7 +60,7 @@ from testgres.operations.os_ops import OsProcessController
|
|
|
60
60
|
from testgres.operations.local_ops import LocalOperations
|
|
61
61
|
from testgres.operations.remote_ops import RemoteOperations
|
|
62
62
|
|
|
63
|
-
__version__ = "1.16.
|
|
63
|
+
__version__ = "1.16.4"
|
|
64
64
|
|
|
65
65
|
__all__ = [
|
|
66
66
|
"get_new_node",
|
|
@@ -95,6 +95,7 @@ except ImportError:
|
|
|
95
95
|
InternalError = pglib.InternalError
|
|
96
96
|
ProgrammingError = pglib.ProgrammingError
|
|
97
97
|
OperationalError = pglib.OperationalError
|
|
98
|
+
InterfaceError = pglib.InterfaceError
|
|
98
99
|
|
|
99
100
|
|
|
100
101
|
assert TimeoutException == QueryTimeoutException
|
|
@@ -1172,6 +1173,7 @@ class PostgresNode:
|
|
|
1172
1173
|
QueryException,
|
|
1173
1174
|
ProgrammingError,
|
|
1174
1175
|
OperationalError,
|
|
1176
|
+
InterfaceError, # pg8000
|
|
1175
1177
|
}
|
|
1176
1178
|
|
|
1177
1179
|
self.poll_query_until(
|
|
@@ -1182,7 +1184,14 @@ class PostgresNode:
|
|
|
1182
1184
|
max_attempts=max_attempts,
|
|
1183
1185
|
)
|
|
1184
1186
|
except: # noqa: E722
|
|
1185
|
-
self.
|
|
1187
|
+
state = self._get_node_state()
|
|
1188
|
+
|
|
1189
|
+
if state.node_status == NodeStatus.Running:
|
|
1190
|
+
assert type(state.pid) is int
|
|
1191
|
+
self.stop()
|
|
1192
|
+
else:
|
|
1193
|
+
self._manually_started_pm_pid = state.pid
|
|
1194
|
+
|
|
1186
1195
|
raise
|
|
1187
1196
|
return
|
|
1188
1197
|
|
|
@@ -127,7 +127,7 @@ class TestTestgresCommon:
|
|
|
127
127
|
# Author: Mark G.
|
|
128
128
|
assert v.major == 1
|
|
129
129
|
assert v.minor == 16
|
|
130
|
-
assert v.micro ==
|
|
130
|
+
assert v.micro == 4
|
|
131
131
|
|
|
132
132
|
assert str(v) == testgres_version
|
|
133
133
|
return
|
|
@@ -458,6 +458,89 @@ class TestTestgresCommon:
|
|
|
458
458
|
|
|
459
459
|
return
|
|
460
460
|
|
|
461
|
+
def test_failure_during_slow_start(self, node_svc: PostgresNodeService):
|
|
462
|
+
assert isinstance(node_svc, PostgresNodeService)
|
|
463
|
+
|
|
464
|
+
C_MAX_ATTEMPTS = 3
|
|
465
|
+
|
|
466
|
+
nAttempt = 0
|
|
467
|
+
|
|
468
|
+
while True:
|
|
469
|
+
assert nAttempt <= C_MAX_ATTEMPTS
|
|
470
|
+
|
|
471
|
+
if nAttempt == C_MAX_ATTEMPTS:
|
|
472
|
+
logging.warning("Test did not fail during wait stage.")
|
|
473
|
+
break
|
|
474
|
+
|
|
475
|
+
nAttempt += 1
|
|
476
|
+
|
|
477
|
+
logging.info("------------------ ATTEMPT {}".format(
|
|
478
|
+
nAttempt,
|
|
479
|
+
))
|
|
480
|
+
|
|
481
|
+
if self.helper_step_of_failure_during_slow_start(node_svc):
|
|
482
|
+
break
|
|
483
|
+
|
|
484
|
+
continue
|
|
485
|
+
return
|
|
486
|
+
|
|
487
|
+
def helper_step_of_failure_during_slow_start(
|
|
488
|
+
self,
|
|
489
|
+
node_svc: PostgresNodeService,
|
|
490
|
+
) -> bool:
|
|
491
|
+
assert isinstance(node_svc, PostgresNodeService)
|
|
492
|
+
|
|
493
|
+
with __class__.helper__get_node(node_svc) as node:
|
|
494
|
+
node.init()
|
|
495
|
+
assert not node.is_started
|
|
496
|
+
assert node.status() == NodeStatus.Stopped
|
|
497
|
+
|
|
498
|
+
bad_command = (
|
|
499
|
+
"if [ ! -f fail_counter ]; then echo 1 > fail_counter; set -e; sleep 5; expr 1 / 0; exit 0; fi; "
|
|
500
|
+
"COUNT=$(cat fail_counter); "
|
|
501
|
+
"if [ $COUNT -lt 3 ]; then echo $((COUNT+1)) > fail_counter; set -e; sleep 5; expr 1 / 0; exit 0; "
|
|
502
|
+
"else kill -6 $$; fi"
|
|
503
|
+
)
|
|
504
|
+
|
|
505
|
+
# Enable recovery mode to ensure Postgres calls this command
|
|
506
|
+
if node.version >= PgVer("12"):
|
|
507
|
+
node.os_ops.write(
|
|
508
|
+
node.os_ops.build_path(node.data_dir, "postgresql.conf"),
|
|
509
|
+
f"\nrestore_command = '{bad_command}'\n",
|
|
510
|
+
truncate=False,
|
|
511
|
+
)
|
|
512
|
+
node.os_ops.write(
|
|
513
|
+
node.os_ops.build_path(node.data_dir, "standby.signal"),
|
|
514
|
+
"",
|
|
515
|
+
truncate=True,
|
|
516
|
+
)
|
|
517
|
+
else:
|
|
518
|
+
node.os_ops.write(
|
|
519
|
+
node.os_ops.build_path(node.data_dir, "recovery.conf"),
|
|
520
|
+
f"restore_command = '{bad_command}'\n",
|
|
521
|
+
truncate=True,
|
|
522
|
+
)
|
|
523
|
+
|
|
524
|
+
with pytest.raises(expected_exception=Exception) as x:
|
|
525
|
+
node.slow_start(max_attempts=10)
|
|
526
|
+
|
|
527
|
+
TestServices.PrintExceptionOK(x.value)
|
|
528
|
+
|
|
529
|
+
assert not node.is_started
|
|
530
|
+
assert node.status() == NodeStatus.Stopped
|
|
531
|
+
pass
|
|
532
|
+
|
|
533
|
+
assert x is not None
|
|
534
|
+
assert isinstance(x.value, Exception)
|
|
535
|
+
assert x.value.__context__ is None
|
|
536
|
+
|
|
537
|
+
if type(x.value) is StartNodeException:
|
|
538
|
+
assert x.value.description == "Cannot detect postmaster pid."
|
|
539
|
+
return False
|
|
540
|
+
|
|
541
|
+
assert type(x.value) is QueryTimeoutException
|
|
542
|
+
return True
|
|
543
|
+
|
|
461
544
|
def test_restart(self, node_svc: PostgresNodeService):
|
|
462
545
|
assert isinstance(node_svc, PostgresNodeService)
|
|
463
546
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|