Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove un-needed max_attempts arg #123

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions core/replay/connection_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ def initiate_connection(self, username):
else:
interface = "psql"
r = ReplayPrep(self.config)
credentials = r.get_connection_credentials(
username, database=self.connection_log.database_name
)
credentials = r.get_connection_credentials(username, database=self.connection_log.database_name)

try:
try:
Expand Down
6 changes: 1 addition & 5 deletions core/replay/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ def main():
# test connection
try:
# use the first user as a test
prep.get_connection_credentials(
connection_logs[0].username,
database=connection_logs[0].database_name,
max_attempts=1,
)
prep.get_connection_credentials(connection_logs[0].username, database=connection_logs[0].database_name)
except CredentialsException as e:
logger.error(
f"Unable to retrieve credentials using GetClusterCredentials ({str(e)}). "
Expand Down
4 changes: 1 addition & 3 deletions core/replay/unload_sys_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ def __init__(self, config, replay_id):
def unload_system_table(self):
# TODO: wrap this in retries and proper logging
prep = ReplayPrep(self.config)
credentials = prep.get_connection_credentials(
self.config["master_username"], max_attempts=3
)
credentials = prep.get_connection_credentials(self.config["master_username"])
try:
conn = db_connect(
self.default_interface,
Expand Down
6 changes: 2 additions & 4 deletions core/tests/test_unload_sys_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
conn.cursor.return_value = cursor


def mock_get_connection_cred(self, val, max_attempts):
def mock_get_connection_cred(self, val):
return {
"host": "somehost",
"port": 5437,
Expand Down Expand Up @@ -82,9 +82,7 @@ def test_unload_system_table_with_unload_query(self, mock_boto, mock_debug):

unload_object.unload_system_table()

mock_debug.assert_called_once_with(
"Executed unload query: stl_unload"
)
mock_debug.assert_called_once_with("Executed unload query: stl_unload")

@patch.object(ReplayPrep, "get_connection_credentials", mock_get_connection_cred)
@patch("core.replay.unload_sys_table.db_connect", mock_db_connect_error)
Expand Down