Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediaserver
envsetup
Commits
57176f2b
Commit
57176f2b
authored
6 years ago
by
Nicolas KAROLAK
Browse files
Options
Downloads
Patches
Plain Diff
Revert "fix(tests): rm type hints in test_postgresql"
This reverts commit
83b7c7dc
.
parent
83b7c7dc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_postgresql.py
+19
-15
19 additions, 15 deletions
tests/test_postgresql.py
with
19 additions
and
15 deletions
tests/test_postgresql.py
+
19
−
15
View file @
57176f2b
...
...
@@ -16,7 +16,7 @@ RED = "\033[91m"
DEF
=
"
\033
[0m
"
def
is_ha
(
port
)
->
bool
:
def
is_ha
(
port
:
int
)
->
bool
:
"""
Check wether this setup is using higlhy-available databases.
:param port: Port number
...
...
@@ -28,7 +28,7 @@ def is_ha(port) -> bool:
return
port
==
54321
def
get_haproxy_conf
(
path
=
"
/etc/haproxy/haproxy.cfg
"
)
->
dict
:
def
get_haproxy_conf
(
path
:
str
=
"
/etc/haproxy/haproxy.cfg
"
)
->
dict
:
"""
Get HAProxy configuration in a dictionary.
:param path: HAProxy configuration file, defaults to
"
/etc/haproxy/haproxy.cfg
"
...
...
@@ -66,7 +66,7 @@ def get_haproxy_conf(path="/etc/haproxy/haproxy.cfg") -> dict:
return
conf
def
get_nodes
(
conf
)
->
dict
:
def
get_nodes
(
conf
:
dict
)
->
dict
:
"""
Get the list of nodes from HAProxy configuration.
:param conf: The HAProxy configuration file content
...
...
@@ -100,7 +100,7 @@ def get_nodes(conf) -> dict:
return
servers
def
check_odd_number
(
number
)
->
bool
:
def
check_odd_number
(
number
:
int
)
->
bool
:
"""
Check if we have an odd number of nodes, ensuring we can have a quorum.
:param number: The number of nodes in the cluster
...
...
@@ -114,7 +114,7 @@ def check_odd_number(number) -> bool:
return
modulo
!=
0
def
get_node_state
(
host
,
por
t
)
->
str
:
def
get_node_state
(
host
:
str
,
port
:
in
t
)
->
str
:
"""
Get the curent state of node from its RepHACheck daemon.
:param node: The node
'
s hostname or IP address
...
...
@@ -136,7 +136,7 @@ def get_node_state(host, port) -> str:
return
state
def
check_primary
(
nodes
)
->
tuple
:
def
check_primary
(
nodes
:
dict
)
->
tuple
:
"""
Check if we have a primary in the nodes.
:param nodes: The dictionary containing nodes and their informations
...
...
@@ -154,7 +154,7 @@ def check_primary(nodes) -> tuple:
return
False
,
None
def
check_standby
(
nodes
)
->
tuple
:
def
check_standby
(
nodes
:
dict
)
->
tuple
:
"""
Check if we have a standby in the nodes.
:param nodes: The dictionary containing nodes and their informations
...
...
@@ -172,7 +172,7 @@ def check_standby(nodes) -> tuple:
return
False
,
None
def
check_witness
(
nodes
)
->
tuple
:
def
check_witness
(
nodes
:
dict
)
->
tuple
:
"""
Check if we have a witness in the nodes.
:param nodes: The dictionary containing nodes and their informations
...
...
@@ -190,7 +190,7 @@ def check_witness(nodes) -> tuple:
return
False
,
None
def
check_fenced
(
nodes
)
->
tuple
:
def
check_fenced
(
nodes
:
dict
)
->
tuple
:
"""
Check if the cluster have a fenced node.
:param nodes: The dictionary containing nodes and their informations
...
...
@@ -209,7 +209,9 @@ def check_fenced(nodes) -> tuple:
# pylint: disable=bad-continuation
def
check_write
(
host
,
port
,
user
,
pswd
,
name
=
"
postgres
"
)
->
bool
:
def
check_write
(
host
:
str
,
port
:
int
,
user
:
str
,
pswd
:
str
,
name
:
str
=
"
postgres
"
)
->
bool
:
"""
Check if we can write data on this node.
:param host: Database server
'
s hostname or IP address
...
...
@@ -251,7 +253,9 @@ def check_write(host, port, user, pswd, name="postgres") -> bool:
# pylint: disable=bad-continuation
def
check_read
(
host
,
port
,
user
,
pswd
,
name
=
"
postgres
"
)
->
bool
:
def
check_read
(
host
:
str
,
port
:
int
,
user
:
str
,
pswd
:
str
,
name
:
str
=
"
postgres
"
)
->
bool
:
"""
Check if we can read data on this node.
:param host: Database server
'
s hostname or IP address
...
...
@@ -291,7 +295,7 @@ def check_read(host, port, user, pswd, name="postgres") -> bool:
return
True
def
check_replication
(
primary
,
standby
)
->
bool
:
def
check_replication
(
primary
:
dict
,
standby
:
dict
)
->
bool
:
"""
Check if replication is working between the primary and standby servers.
:param primary: Connection details for primary server
...
...
@@ -330,7 +334,7 @@ def check_replication(primary, standby) -> bool:
return
True
def
check_listen
(
host
,
por
t
)
->
bool
:
def
check_listen
(
host
:
str
,
port
:
in
t
)
->
bool
:
"""
Check if server is listening (TCP only).
:param host: The hostname or IP address to bind
...
...
@@ -349,7 +353,7 @@ def check_listen(host, port) -> bool:
return
result
==
0
def
check_ha
(
db_conn
,
errors
=
0
,
warnings
=
0
)
->
tuple
:
def
check_ha
(
db_conn
:
dict
,
errors
:
int
=
0
,
warnings
:
int
=
0
)
->
tuple
:
"""
Run all tests for a highly-available setup.
:param db_conn: Database connection parameters
...
...
@@ -426,7 +430,7 @@ def check_ha(db_conn, errors=0, warnings=0) -> tuple:
return
errors
,
warnings
def
check_local
(
db_conn
,
errors
=
0
,
warnings
=
0
)
->
tuple
:
def
check_local
(
db_conn
:
dict
,
errors
:
int
=
0
,
warnings
:
int
=
0
)
->
tuple
:
"""
Run all tests for a highly-available setup.
:param db_conn: Database connection parameters
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment