Skip to content

Commit

Permalink
Merge pull request syslog-ng#5014 from syslog-ng/fix-ci-python
Browse files Browse the repository at this point in the history
CI Python Fixes
  • Loading branch information
therandomstring authored Jul 11, 2024
2 parents 012bec5 + 367553b commit 7ed2cdc
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion tests/functional/messagegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def initSender(self):
if sys.platform == 'linux2':
self.sock.setsockopt(SOL_SOCKET, SO_SNDTIMEO, struct.pack('ll', 3, 0))
if not self.dgram and self.ssl:
self.sock = ssl.wrap_socket(self.sock)
self.sock = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2).wrap_socket(self.sock)


def sendMessage(self, msg):
Expand Down
8 changes: 4 additions & 4 deletions tests/light/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
exclude: '^$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.1
rev: v4.6.0
hooks:
- id: trailing-whitespace
files: 'tests/light/'
- id: end-of-file-fixer
files: 'tests/light/'
- repo: https://github.com/pycqa/flake8
rev: 3.7.7
rev: 7.1.0
hooks:
- id: flake8
args: [--ignore=E501]
files: 'tests/light/'
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.4.0
rev: v3.13.0
hooks:
- id: reorder-python-imports
args: [--application-directories=tests/light/]
files: 'tests/light/'
- repo: https://github.com/asottile/add-trailing-comma
rev: v1.0.0
rev: v3.1.0
hooks:
- id: add-trailing-comma
args: [--py36-plus]
Expand Down
2 changes: 1 addition & 1 deletion tests/light/functional_tests/filterx/test_filterx_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


def render_filterx_exprs(expressions):
return '\n'.join(f"filterx {{ { expr } }};" for expr in expressions)
return '\n'.join(f"filterx {{ {expr} }};" for expr in expressions)


def create_config(config, init_exprs, true_exprs=(), false_exprs=(), final_exprs=(), msg="foobar"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
("'-2'", SYSLOG_NG_DEFAULT_PRI),
("'test'", SYSLOG_NG_DEFAULT_PRI),
("''", SYSLOG_NG_DEFAULT_PRI),
], ids=["min_value", "valid_value", "max_value", "invalid_big_number", "invalid_negative", "invalid_letters", "empty_value", ],
], ids=["min_value", "valid_value", "max_value", "invalid_big_number", "invalid_negative", "invalid_letters", "empty_value"],
)
def test_set_pri(config, syslog_ng, log_message, bsd_formatter, pri_number, expected_pri):
input_message = bsd_formatter.format_message(log_message.priority(38))
Expand Down
3 changes: 2 additions & 1 deletion tests/light/src/common/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ async def start(self):
self._server = server_res

async def stop(self):
logger.debug("Disconnecting client")
await self.close_client()
logger.debug("Shutting down SingleConnectionStreamServer")
await self._stop_server()
await self.close_client()

async def close_client(self):
"""After a client connection is accepted, new connections will be rejected until this method is called"""
Expand Down
6 changes: 3 additions & 3 deletions tests/light/src/driver_io/message_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class FramedStreamReader(object):
# FileIO and this method too operate on partial string matches
# TODO: LogMessage instances should be used instead, matching the full msg body
def _list_remove_partially_matching_element(list, elem):
for l in list:
if l in elem:
list.remove(l)
for match in list:
if match in elem:
list.remove(match)
return True
return False
21 changes: 12 additions & 9 deletions tests/light/src/helpers/loggen/loggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@


class Loggen(object):

instanceIndex = -1

@staticmethod
def __get_new_instance_index():
Loggen.instanceIndex += 1
Expand All @@ -41,10 +41,10 @@ def __init__(self):
self.loggen_bin_path = tc_parameters.INSTANCE_PATH.get_loggen_bin()

def __decode_start_parameters(
self, inet, unix, stream, dgram, use_ssl, dont_parse, read_file, skip_tokens, loop_reading,
rate, interval, permanent, syslog_proto, proxied, sdata, no_framing, active_connections,
idle_connections, ipv6, debug, number, csv, quiet, size, reconnect, proxied_tls_passthrough,
proxy_src_ip, proxy_dst_ip, proxy_src_port, proxy_dst_port,
self, inet, unix, stream, dgram, use_ssl, dont_parse, read_file, skip_tokens, loop_reading,
rate, interval, permanent, syslog_proto, proxied, sdata, no_framing, active_connections,
idle_connections, ipv6, debug, number, csv, quiet, size, reconnect, proxied_tls_passthrough,
proxy_src_ip, proxy_dst_ip, proxy_src_port, proxy_dst_port,
):

start_parameters = []
Expand Down Expand Up @@ -145,10 +145,13 @@ def __decode_start_parameters(
return start_parameters

def start(
self, target, port, inet=None, unix=None, stream=None, dgram=None, use_ssl=None, dont_parse=None, read_file=None, skip_tokens=None, loop_reading=None,
rate=None, interval=None, permanent=None, syslog_proto=None, proxied=None, sdata=None, no_framing=None, active_connections=None,
idle_connections=None, ipv6=None, debug=None, number=None, csv=None, quiet=None, size=None, reconnect=None, proxied_tls_passthrough=None,
proxy_src_ip=None, proxy_dst_ip=None, proxy_src_port=None, proxy_dst_port=None,
self, target, port, inet=None, unix=None, stream=None, dgram=None, use_ssl=None, dont_parse=None,
read_file=None, skip_tokens=None, loop_reading=None,
rate=None, interval=None, permanent=None, syslog_proto=None, proxied=None, sdata=None, no_framing=None,
active_connections=None,
idle_connections=None, ipv6=None, debug=None, number=None, csv=None, quiet=None, size=None, reconnect=None,
proxied_tls_passthrough=None,
proxy_src_ip=None, proxy_dst_ip=None, proxy_src_port=None, proxy_dst_port=None,
):

if self.loggen_proc is not None and self.loggen_proc.is_running():
Expand Down

0 comments on commit 7ed2cdc

Please sign in to comment.