test.pgproto.auth_test
Name
test_user_blocking_after_a_series_of_unsuccessful_auth_attempts
Execution time
0.568 s
System output
cluster = Cluster("127.0.0.1", n=1)
def test_user_blocking_after_a_series_of_unsuccessful_auth_attempts(cluster: Cluster):
user = "user"
password = "P@ssw0rd"
host = "127.0.0.1"
port = "5433"
cluster.set_config_file(
yaml=f"""
cluster:
name: test
tier:
default:
instance:
pg:
listen: "{host}:{port}"
"""
)
i1 = cluster.add_instance(wait_online=False, pg_port=int(port))
user_banned_lc = log_crawler(
i1, "Maximum number of login attempts exceeded; user blocked"
)
i1.start()
> i1.wait_online()
cluster = Cluster("127.0.0.1", n=1)
host = '127.0.0.1'
i1 = Instance(i1, listen=127.0.0.1:5433 cluster=cluster-5-38, process.pid=67113)
password = 'P@ssw0rd'
port = '5433'
user = 'user'
user_banned_lc = <conftest.log_crawler object at 0x7b50072bcad0>
test/pgproto/auth_test.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/conftest.py:1388: in wait_online
raise e from e
deadline = 6124190.012271675
expected_incarnation = None
fetch_current_state = <function Instance.wait_online.<locals>.fetch_current_state at 0x7b500656ede0>
last_state = None
next_retry = 6124160.212273005
now = 6124160.012272725
rps = 5
self = Instance(i1, listen=127.0.0.1:5433 cluster=cluster-5-38, process.pid=67113)
start = 6124160.012271675
timeout = 30
test/conftest.py:1373: in wait_online
state = fetch_current_state()
deadline = 6124190.012271675
expected_incarnation = None
fetch_current_state = <function Instance.wait_online.<locals>.fetch_current_state at 0x7b500656ede0>
last_state = None
next_retry = 6124160.212273005
now = 6124160.012272725
rps = 5
self = Instance(i1, listen=127.0.0.1:5433 cluster=cluster-5-38, process.pid=67113)
start = 6124160.012271675
timeout = 30
test/conftest.py:1350: in fetch_current_state
myself = self.instance_info()
self = Instance(i1, listen=127.0.0.1:5433 cluster=cluster-5-38, process.pid=67113)
test/conftest.py:1316: in instance_info
info = self.call(".proc_instance_info", timeout=timeout)
self = Instance(i1, listen=127.0.0.1:5433 cluster=cluster-5-38, process.pid=67113)
timeout = 10
test/conftest.py:719: in call
self.check_process_alive()
args = ()
fn = '.proc_instance_info'
password = None
self = Instance(i1, listen=127.0.0.1:5433 cluster=cluster-5-38, process.pid=67113)
timeout = 10
user = None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Instance(i1, listen=127.0.0.1:5433 cluster=cluster-5-38, process.pid=67113)
def check_process_alive(self):
if self.process is None:
raise ProcessDead("process was not started")
try:
# Note: The process may have crashed due to the RPC, but there may
# be a race between when the python connector receives the
# connection reset error and when the OS will finish cleaning up
# the process. So we introduce a tiny timeout here (which may still not
# be enough in every case).
exit_code = self.process.wait(timeout=1) # type: ignore
except subprocess.TimeoutExpired:
# it's fine, the process is still running
pass
else:
message = f"process exited unexpectedly, {exit_code=}"
pid = self.process.pid
bt = os.path.join(self.cwd, f"picodata-{pid}.backtrace")
if os.path.exists(bt):
with open(bt, "r") as f:
backtrace = f.read()
message += "\n\n"
message += backtrace
> raise ProcessDead(message)
E conftest.ProcessDead: process exited unexpectedly, exit_code=1
bt = '/tmp/pytest-of-root/pytest-0/popen-gw5/test_user_blocking_after_a_ser0/picodata-67113.backtrace'
exit_code = 1
message = 'process exited unexpectedly, exit_code=1'
pid = 67113
self = Instance(i1, listen=127.0.0.1:5433 cluster=cluster-5-38, process.pid=67113)
test/conftest.py:1301: ProcessDead