Skip to content

Commit

Permalink
Short timeouts for ssl server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
strtgbb committed Jul 24, 2024
1 parent efaa175 commit 7237261
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
8 changes: 8 additions & 0 deletions ssl_server/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ def argparser(parser):
r".*SSLV3_ALERT_HANDSHAKE_FAILURE.*",
)
],
":/https server:checks/:onnection:should:": [
(
Error,
"Takes too long on 24.3+ https://github.com/ClickHouse/ClickHouse/issues/62887",
check_clickhouse_version(">=24.3"),
r"ExpectTimeoutError.+https_server[\w]+connection.+node.query\($",
)
],
}

xflags = {}
Expand Down
18 changes: 14 additions & 4 deletions ssl_server/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ def create_crt_and_key(

@TestStep(Then)
def https_server_url_function_connection(
self, success=True, options=None, node=None, port=None
self, success=True, options=None, node=None, port=None, timeout=15
):
"""Check reading data from an https server with specified clickhouse-server config."""
if node is None:
Expand All @@ -1062,12 +1062,19 @@ def https_server_url_function_connection(
node.query(
f"SELECT * FROM url('https://127.0.0.1:{port}/data', 'CSV') FORMAT CSV",
message=message,
timeout=timeout,
)


@TestStep(Given)
def https_server_https_dictionary_connection(
self, name=None, node=None, success=True, options=None, port=None
self,
name=None,
node=None,
success=True,
options=None,
port=None,
timeout=5,
):
"""Check reading data from a dictionary sourced from an https server"""
if node is None:
Expand All @@ -1091,11 +1098,14 @@ def https_server_https_dictionary_connection(
try:
with When("I create a dictionary using an https source"):
node.query(
f"CREATE DICTIONARY {name} (c1 Int64) PRIMARY KEY c1 SOURCE(HTTP(URL 'https://127.0.0.1:{port}/data' FORMAT 'CSV')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT())"
f"CREATE DICTIONARY {name} (c1 Int64) PRIMARY KEY c1 SOURCE(HTTP(URL 'https://127.0.0.1:{port}/data' FORMAT 'CSV')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT())",
timeout=timeout,
)

with Then("I select data from the dictionary"):
node.query(f"SELECT * FROM {name} FORMAT CSV", message=message)
node.query(
f"SELECT * FROM {name} FORMAT CSV", message=message, timeout=timeout
)

finally:
with Finally("I remove the dictionary"):
Expand Down
6 changes: 6 additions & 0 deletions ssl_server/tests/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def https_server_dictionary_checks(self):
"disableProtocols": "sslv2,sslv3,tlsv1,tlsv1_1,tlsv1_2,tlsv1_3",
},
success=False,
timeout=5,
)

with Check(f"TLSv1.2 suite connection should work"):
Expand All @@ -74,6 +75,7 @@ def https_server_dictionary_checks(self):
"disableProtocols": "sslv2,sslv3,tlsv1_1,tlsv1_2,tlsv1_3",
},
success=False,
timeout=5,
)

with Check("TLSv1.1 suite connection should be rejected"):
Expand All @@ -83,6 +85,7 @@ def https_server_dictionary_checks(self):
"disableProtocols": "sslv2,sslv3,tlsv1,tlsv1_2,tlsv1_3",
},
success=False,
timeout=5,
)

with Check("TLSv1.3 suite connection should be rejected"):
Expand All @@ -92,6 +95,7 @@ def https_server_dictionary_checks(self):
"disableProtocols": "sslv2,sslv3,tlsv1,tlsv1_1,tlsv1_2",
},
success=False,
timeout=5,
)

with Check(f"just disabling TLSv1 suite connection should work"):
Expand Down Expand Up @@ -121,6 +125,7 @@ def https_server_dictionary_checks(self):
"disableProtocols": "sslv2,sslv3,tlsv1,tlsv1_1,tlsv1_3",
},
success=True,
timeout=5,
)

for cipher in all_ciphers:
Expand All @@ -132,6 +137,7 @@ def https_server_dictionary_checks(self):
https_server_https_dictionary_connection(
options={"cipherList": cipher, "disableProtocols": ""},
success=False,
timeout=5,
)


Expand Down
8 changes: 7 additions & 1 deletion ssl_server/tests/url_table_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ def https_server_url_function_checks(self):
ciphers=default_ciphers,
)

with Check("Connection with no protocols should be rejected"):
with Check("connection with no protocols should be rejected"):
https_server_url_function_connection(
options={
"disableProtocols": "sslv2,sslv3,tlsv1,tlsv1_1,tlsv1_2,tlsv1_3",
},
success=False,
timeout=5,
)

with Check(f"TLSv1.2 suite connection should work"):
Expand All @@ -64,6 +65,7 @@ def https_server_url_function_checks(self):
"disableProtocols": "sslv2,sslv3,tlsv1_1,tlsv1_2,tlsv1_3",
},
success=False,
timeout=5,
)

with Check("TLSv1.1 suite connection should be rejected"):
Expand All @@ -73,6 +75,7 @@ def https_server_url_function_checks(self):
"disableProtocols": "sslv2,sslv3,tlsv1,tlsv1_2,tlsv1_3",
},
success=False,
timeout=5,
)

with Check("TLSv1.3 suite connection should be rejected"):
Expand All @@ -82,6 +85,7 @@ def https_server_url_function_checks(self):
"disableProtocols": "sslv2,sslv3,tlsv1,tlsv1_1,tlsv1_2",
},
success=False,
timeout=5,
)

with Check(f"just disabling TLSv1 suite connection should work"):
Expand Down Expand Up @@ -111,6 +115,7 @@ def https_server_url_function_checks(self):
"disableProtocols": "sslv2,sslv3,tlsv1,tlsv1_1,tlsv1_3",
},
success=True,
timeout=5,
)

for cipher in all_ciphers:
Expand All @@ -122,6 +127,7 @@ def https_server_url_function_checks(self):
https_server_url_function_connection(
options={"cipherList": cipher, "disableProtocols": ""},
success=False,
timeout=5,
)


Expand Down

0 comments on commit 7237261

Please sign in to comment.