Skip to content
Snippets Groups Projects
Commit 31afd055 authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

fix(test_postgresql): type errors

parent 0e574985
No related branches found
No related tags found
No related merge requests found
...@@ -89,7 +89,7 @@ def get_nodes(conf: dict) -> dict: ...@@ -89,7 +89,7 @@ def get_nodes(conf: dict) -> dict:
name = elements[1] name = elements[1]
address = elements[2].split(":") address = elements[2].split(":")
host = address[0] host = address[0]
port = address[1] port = int(address[1])
rephacheck = elements[7] rephacheck = elements[7]
# update dictionary # update dictionary
...@@ -146,8 +146,8 @@ def check_primary(nodes: dict) -> tuple: ...@@ -146,8 +146,8 @@ def check_primary(nodes: dict) -> tuple:
""" """
for node in nodes.keys(): for node in nodes.keys():
host = nodes[node]["address"] host = nodes[node]["host"]
port = nodes[node]["rephacheck"] port = int(nodes[node]["rephacheck"])
if get_node_state(host, port) == "primary": if get_node_state(host, port) == "primary":
return True, node return True, node
...@@ -164,8 +164,8 @@ def check_standby(nodes: dict) -> tuple: ...@@ -164,8 +164,8 @@ def check_standby(nodes: dict) -> tuple:
""" """
for node in nodes.keys(): for node in nodes.keys():
host = nodes[node]["address"] host = nodes[node]["host"]
port = nodes[node]["rephacheck"] port = int(nodes[node]["rephacheck"])
if get_node_state(host, port) == "standby": if get_node_state(host, port) == "standby":
return True, node return True, node
...@@ -182,8 +182,8 @@ def check_witness(nodes: dict) -> tuple: ...@@ -182,8 +182,8 @@ def check_witness(nodes: dict) -> tuple:
""" """
for node in nodes.keys(): for node in nodes.keys():
host = nodes[node]["address"] host = nodes[node]["host"]
port = nodes[node]["rephacheck"] port = int(nodes[node]["rephacheck"])
if get_node_state(host, port) == "witness": if get_node_state(host, port) == "witness":
return True, node return True, node
...@@ -200,8 +200,8 @@ def check_fenced(nodes: dict) -> tuple: ...@@ -200,8 +200,8 @@ def check_fenced(nodes: dict) -> tuple:
""" """
for node in nodes.keys(): for node in nodes.keys():
host = nodes[node]["address"] host = nodes[node]["host"]
port = nodes[node]["rephacheck"] port = int(nodes[node]["rephacheck"])
if get_node_state(host, port) == "fenced": if get_node_state(host, port) == "fenced":
return True, node return True, node
...@@ -390,7 +390,7 @@ def check_ha(db_conn: dict, errors: int = 0, warnings: int = 0) -> tuple: ...@@ -390,7 +390,7 @@ def check_ha(db_conn: dict, errors: int = 0, warnings: int = 0) -> tuple:
# check remotes # check remotes
for node in nodes: for node in nodes:
node_host = nodes[node]["address"] node_host = nodes[node]["host"]
node_port = nodes[node]["port"] node_port = nodes[node]["port"]
if not check_listen(node_host, node_port): if not check_listen(node_host, node_port):
print("{}Cannot bind {}:{}{}".format(RED, node_host, node_port, DEF)) print("{}Cannot bind {}:{}{}".format(RED, node_host, node_port, DEF))
...@@ -497,9 +497,9 @@ def main(): ...@@ -497,9 +497,9 @@ def main():
conf = es_utils.load_conf() conf = es_utils.load_conf()
# get database configuration # get database configuration
db_host = conf.get("DB_HOST", "127.0.0.1") db_host = conf.get("DB_HOST") if conf.get("DB_HOST") else "127.0.0.1"
db_port = int(conf.get("DB_PORT", 5432)) db_port = int(conf.get("DB_PORT")) if conf.get("DB_PORT") else 5432
db_user = conf.get("DB_USER", "postgres") db_user = conf.get("DB_USER") if conf.get("DB_USER") else "postgres"
db_pass = conf.get("DB_PG_ROOT_PWD") db_pass = conf.get("DB_PG_ROOT_PWD")
db_conf = {"host": db_host, "port": db_port, "user": db_user, "pass": db_pass} db_conf = {"host": db_host, "port": db_port, "user": db_user, "pass": db_pass}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment