holado 0.2.8__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of holado might be problematic. Click here for more details.
- holado/common/handlers/undefined.py +7 -1
- {holado-0.2.8.dist-info → holado-0.3.0.dist-info}/METADATA +4 -1
- {holado-0.2.8.dist-info → holado-0.3.0.dist-info}/RECORD +106 -99
- holado_ais/ais/ais_messages.py +97 -6
- holado_ais/tests/behave/steps/ais/ais_manager_steps.py +1 -1
- holado_ais/tests/behave/steps/ais/ais_messages_steps.py +45 -6
- holado_binary/ipc/bit_series.py +3 -3
- holado_binary/tests/behave/steps/ipc/binary_steps.py +1 -1
- holado_binary/tests/behave/steps/ipc/bit_series_steps.py +4 -3
- holado_context/tests/behave/steps/private/common/context_steps.py +1 -1
- holado_core/common/resource/persisted_data_manager.py +13 -16
- holado_core/common/resource/resource_manager.py +10 -10
- holado_core/common/tables/converters/table_converter.py +47 -9
- holado_core/common/tables/table_manager.py +6 -7
- holado_core/common/tables/table_with_header.py +6 -0
- holado_core/tests/behave/steps/common/common_steps.py +2 -1
- holado_core/tests/behave/steps/common/config_steps.py +1 -1
- holado_core/tests/behave/steps/common/resource_steps.py +1 -1
- holado_core/tests/behave/steps/common/tables_steps.py +18 -2
- holado_data/data/generator/generator_manager.py +39 -0
- holado_data/tests/behave/steps/data/generator_steps.py +1 -1
- holado_data/tests/behave/steps/tools/utils_steps.py +1 -2
- holado_db/tests/behave/steps/tools/db/db_client_steps.py +1 -1
- holado_db/tests/behave/steps/tools/db/postgresql_client_steps.py +1 -1
- holado_db/tests/behave/steps/tools/db/sqlite_client_steps.py +1 -1
- holado_db/tools/db/clients/base/db_client.py +81 -28
- holado_db/tools/db/clients/postgresql/postgresql_client.py +17 -7
- holado_db/tools/db/query/base/query_builder.py +58 -7
- holado_db/tools/db/query/pypika/pypika_query_builder.py +73 -21
- holado_docker/tests/behave/steps/tools/docker_steps.py +1 -1
- holado_grpc/tests/behave/steps/api/grpc_client_steps.py +1 -1
- holado_grpc/tests/behave/steps/private/api/grpc_steps.py +1 -1
- holado_json/tests/behave/steps/ipc/json_steps.py +1 -1
- holado_keycloak/tests/behave/steps/tools/keycloak_client_steps.py +1 -1
- holado_multitask/tests/behave/steps/multiprocessing_steps.py +1 -1
- holado_multitask/tests/behave/steps/multithreading_steps.py +1 -1
- holado_protobuf/ipc/protobuf/types/google/protobuf.py +1 -1
- holado_protobuf/tests/behave/steps/ipc/protobuf_steps.py +1 -1
- holado_python/common/tools/datetime.py +31 -12
- holado_python/standard_library/socket/blocking_socket.py +37 -24
- holado_python/standard_library/socket/message_socket.py +11 -3
- holado_python/standard_library/socket/non_blocking_socket.py +24 -24
- holado_python/standard_library/socket/socket.py +132 -19
- holado_python/standard_library/ssl/resources/certificates/NOTES.txt +1 -1
- holado_python/standard_library/ssl/resources/certificates/rootCACert.pem +24 -0
- holado_python/standard_library/ssl/resources/certificates/tcpbin.crt +21 -0
- holado_python/standard_library/ssl/resources/certificates/tcpbin.key +28 -0
- holado_python/standard_library/ssl/ssl.py +138 -21
- holado_python/tests/behave/steps/convert_steps.py +1 -1
- holado_python/tests/behave/steps/iterable_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/csv_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/datetime_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/hashlib_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/multiprocessing_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/queue_steps.py +1 -1
- holado_python/tests/behave/steps/standard_library/socket_steps.py +132 -18
- holado_python/tests/behave/steps/standard_library/ssl_steps.py +87 -16
- holado_rabbitmq/tests/behave/steps/tools/rabbitmq_client_steps.py +48 -20
- holado_rabbitmq/tests/behave/steps/tools/rabbitmq_server_steps.py +1 -1
- holado_rabbitmq/tools/rabbitmq/rabbitmq_client.py +19 -13
- holado_rabbitmq/tools/rabbitmq/rabbitmq_manager.py +2 -29
- holado_redis/tests/behave/steps/tools/redis_client_steps.py +1 -1
- holado_rest/tests/behave/steps/api/rest_client_steps.py +1 -1
- holado_rest/tests/behave/steps/private/api/rest_steps.py +1 -1
- holado_s3/tests/behave/steps/private/tools/s3_steps.py +1 -1
- holado_s3/tests/behave/steps/tools/s3_client_steps.py +1 -1
- holado_s3/tests/behave/steps/tools/s3_server_steps.py +1 -1
- holado_scripting/tests/behave/steps/common/tools/variable_convert_steps.py +3 -2
- holado_scripting/tests/behave/steps/common/tools/variable_new_steps.py +1 -1
- holado_scripting/tests/behave/steps/common/tools/variable_steps.py +1 -1
- holado_scripting/tests/behave/steps/common/tools/variable_verify_steps.py +1 -1
- holado_scripting/tests/behave/steps/scenario/function_steps.py +1 -1
- holado_scripting/tests/behave/steps/scenario/if_steps.py +1 -1
- holado_scripting/tests/behave/steps/scenario/loop_steps.py +1 -1
- holado_sftp/tests/behave/steps/private/tools/sftp_steps.py +1 -1
- holado_sftp/tests/behave/steps/tools/sftp_client_steps.py +1 -1
- holado_sftp/tests/behave/steps/tools/sftp_server_steps.py +1 -1
- holado_swagger/tests/behave/steps/swagger_hub/mockserver_steps.py +1 -1
- holado_system/system/command/command.py +14 -9
- holado_system/tests/behave/steps/system/commands_steps.py +1 -1
- holado_system/tests/behave/steps/system/file_steps.py +1 -1
- holado_system/tests/behave/steps/system/system_steps.py +1 -1
- holado_test/scenario/step_tools.py +1 -1
- holado_test/scenario/tester_tools.py +6 -3
- holado_test/tests/behave/steps/scenario/exception_steps.py +1 -1
- holado_test/tests/behave/steps/scenario/scenario_steps.py +1 -1
- holado_test/tests/behave/steps/scenario/tester_steps.py +4 -4
- holado_value/common/tables/converters/value_table_converter.py +52 -8
- holado_value/common/tables/value_table_manager.py +0 -10
- holado_ws/tests/behave/steps/api/web_service_steps.py +1 -1
- holado_yaml/tests/behave/steps/yaml_steps.py +1 -1
- holado_yaml/yaml/yaml_manager.py +2 -2
- test_holado/features/NonReg/common/tables/table.feature +30 -24
- test_holado/features/NonReg/holado_ais/ais_message-bitarray_to_nmea.feature +1 -1
- test_holado/features/NonReg/holado_python/standard_library/socket/local_echo_server/socket_reset.feature +191 -0
- test_holado/features/NonReg/holado_python/standard_library/{socket_with_ssl.feature → socket/local_echo_server/socket_with_tls_and_verify.feature} +53 -30
- test_holado/features/NonReg/holado_python/standard_library/socket/local_echo_server/socket_with_tls_without_verify.feature +299 -0
- test_holado/features/NonReg/holado_python/standard_library/{socket.feature → socket/local_echo_server/socket_without_tls.feature} +2 -2
- test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_with_mtls.feature +214 -0
- test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_with_tls.feature +184 -0
- test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_without_tls.feature +169 -0
- test_holado/features/NonReg/tools/RabbitMQ.feature +9 -9
- test_holado/features/NonReg/tools/RabbitMQ_steps.feature +8 -8
- test_holado/logging.conf +5 -3
- holado_core/common/transport/__init__.py +0 -0
- holado_core/common/transport/crc.py +0 -40
- {holado-0.2.8.dist-info → holado-0.3.0.dist-info}/WHEEL +0 -0
- {holado-0.2.8.dist-info → holado-0.3.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -15,16 +15,11 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
import logging
|
|
20
|
+
from holado_python.standard_library.ssl.ssl import SslManager
|
|
20
21
|
from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
|
|
21
22
|
from holado_value.common.tables.converters.value_table_converter import ValueTableConverter
|
|
22
|
-
from holado_python.standard_library.socket.blocking_socket import TCPBlockingSocketClient
|
|
23
|
-
from holado_python.standard_library.socket.echo_server import EchoTCPBlockingSocketServer
|
|
24
|
-
from holado_python.standard_library.socket.message_socket import MessageTCPNonBlockingSocketClient
|
|
25
|
-
from holado_core.common.handlers.wait import WaitFuncResultVerifying, WaitEndChange
|
|
26
|
-
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
27
|
-
from holado_python.standard_library.ssl.ssl import SslManager
|
|
28
23
|
|
|
29
24
|
logger = logging.getLogger(__name__)
|
|
30
25
|
|
|
@@ -40,28 +35,104 @@ def __get_variable_manager():
|
|
|
40
35
|
|
|
41
36
|
|
|
42
37
|
|
|
43
|
-
@Given(r"(?P<var_name>{Variable}) =
|
|
38
|
+
@Given(r"(?P<var_name>{Variable}) = default CA certs file path")
|
|
44
39
|
def step_impl(context, var_name):
|
|
45
|
-
"""Return path to cert file
|
|
46
|
-
Note: It
|
|
40
|
+
"""Return path to default cert file.
|
|
41
|
+
Note: It uses ssl.get_default_verify_paths method.
|
|
47
42
|
"""
|
|
48
43
|
var_name = StepTools.evaluate_variable_name(var_name)
|
|
49
44
|
|
|
50
|
-
|
|
45
|
+
default_certs = SslManager.get_default_certificates()
|
|
51
46
|
|
|
52
|
-
__get_variable_manager().register_variable(var_name,
|
|
47
|
+
__get_variable_manager().register_variable(var_name, default_certs[0])
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@Given(r"(?P<var_name>{Variable}) = default certs directory path")
|
|
51
|
+
def step_impl(context, var_name):
|
|
52
|
+
"""Return path to default certs folder.
|
|
53
|
+
Note: It uses ssl.get_default_verify_paths method.
|
|
54
|
+
"""
|
|
55
|
+
var_name = StepTools.evaluate_variable_name(var_name)
|
|
56
|
+
|
|
57
|
+
default_certs = SslManager.get_default_certificates()
|
|
58
|
+
|
|
59
|
+
__get_variable_manager().register_variable(var_name, default_certs[1])
|
|
53
60
|
|
|
54
61
|
|
|
55
|
-
@Given(r"(?P<var_name>{Variable}) =
|
|
62
|
+
@Given(r"(?P<var_name>{Variable}) = CA certs file path \(from certifi package\)")
|
|
56
63
|
def step_impl(context, var_name):
|
|
57
|
-
"""Return path to
|
|
58
|
-
Note: It is an autosigned certificate.
|
|
64
|
+
"""Return path to CA certs file from 'certifi' package.
|
|
59
65
|
"""
|
|
60
66
|
var_name = StepTools.evaluate_variable_name(var_name)
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
cacerts_path = SslManager.get_certifi_ca_certs_file_path()
|
|
63
69
|
|
|
70
|
+
__get_variable_manager().register_variable(var_name, cacerts_path)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# @Given(r"(?P<var_name>{Variable}) = certfile path for localhost")
|
|
74
|
+
# def step_impl(context, var_name):
|
|
75
|
+
# """Return path to cert file for localhost stored in internal resources.
|
|
76
|
+
# Note: It is an autosigned certificate.
|
|
77
|
+
# """
|
|
78
|
+
# var_name = StepTools.evaluate_variable_name(var_name)
|
|
79
|
+
#
|
|
80
|
+
# cert_paths = SslManager.get_localhost_certificate()
|
|
81
|
+
#
|
|
82
|
+
# __get_variable_manager().register_variable(var_name, cert_paths[0])
|
|
83
|
+
#
|
|
84
|
+
#
|
|
85
|
+
# @Given(r"(?P<var_name>{Variable}) = keyfile path for localhost")
|
|
86
|
+
# def step_impl(context, var_name):
|
|
87
|
+
# """Return path to key file for localhost stored in internal resources.
|
|
88
|
+
# Note: It is an autosigned certificate.
|
|
89
|
+
# """
|
|
90
|
+
# var_name = StepTools.evaluate_variable_name(var_name)
|
|
91
|
+
#
|
|
92
|
+
# cert_paths = SslManager.get_localhost_certificate()
|
|
93
|
+
#
|
|
94
|
+
# __get_variable_manager().register_variable(var_name, cert_paths[1])
|
|
95
|
+
|
|
96
|
+
@Given(r"generate new self-signed key files for localhost")
|
|
97
|
+
def step_impl(context):
|
|
98
|
+
"""Generate public and private keys for a localhost use.
|
|
99
|
+
"""
|
|
100
|
+
table = BehaveStepTools.convert_step_table_2_value_table_with_header(context.table)
|
|
101
|
+
kwargs = ValueTableConverter.convert_name_value_table_2_dict(table)
|
|
102
|
+
|
|
103
|
+
SslManager.generate_new_self_signed_key_files_for_localhost(**kwargs)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@Given(r"(?P<var_name>{Variable}) = certfile path for tcpbin.com")
|
|
107
|
+
def step_impl(context, var_name):
|
|
108
|
+
"""Return path to cert file for tcpbin.com stored in internal resources.
|
|
109
|
+
Note: If certificate has expired, a new one is generated.
|
|
110
|
+
"""
|
|
111
|
+
var_name = StepTools.evaluate_variable_name(var_name)
|
|
112
|
+
|
|
113
|
+
cert_paths = SslManager.get_tcpbin_certificates()
|
|
114
|
+
|
|
115
|
+
__get_variable_manager().register_variable(var_name, cert_paths[0])
|
|
116
|
+
|
|
117
|
+
@Given(r"(?P<var_name>{Variable}) = keyfile path for tcpbin.com")
|
|
118
|
+
def step_impl(context, var_name):
|
|
119
|
+
"""Return path to key file for tcpbin.com stored in internal resources.
|
|
120
|
+
Note: If certificate has expired, a new one is generated.
|
|
121
|
+
"""
|
|
122
|
+
var_name = StepTools.evaluate_variable_name(var_name)
|
|
123
|
+
|
|
124
|
+
cert_paths = SslManager.get_tcpbin_certificates()
|
|
125
|
+
|
|
64
126
|
__get_variable_manager().register_variable(var_name, cert_paths[1])
|
|
65
127
|
|
|
128
|
+
@Given(r"(?P<var_name>{Variable}) = CA certfile path for tcpbin.com")
|
|
129
|
+
def step_impl(context, var_name):
|
|
130
|
+
"""Return path to cert file for tcpbin.com stored in internal resources.
|
|
131
|
+
Note: If certificate has expired, a new one is generated.
|
|
132
|
+
"""
|
|
133
|
+
var_name = StepTools.evaluate_variable_name(var_name)
|
|
134
|
+
|
|
135
|
+
cert_paths = SslManager.get_tcpbin_certificates()
|
|
66
136
|
|
|
137
|
+
__get_variable_manager().register_variable(var_name, cert_paths[2])
|
|
67
138
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
from holado_value.common.tables.comparators.table_2_value_table_comparator import Table2ValueTable_Comparator
|
|
17
17
|
from holado_test.scenario.step_tools import StepTools
|
|
18
18
|
from holado.common.context.session_context import SessionContext
|
|
19
|
-
from holado_test.behave.behave import *
|
|
19
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
20
20
|
from holado_rabbitmq.tools.rabbitmq import rabbitmq_client
|
|
21
21
|
from holado_core.common.tables.table_manager import TableManager
|
|
22
22
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
@@ -369,43 +369,41 @@ if rabbitmq_client.RMQClient.is_available():
|
|
|
369
369
|
rate = counter / (end - beg)
|
|
370
370
|
logger.print(f"[Queue {q_name} -> Publisher {pub_name}] Mean rate: {int(rate)} msg/s ; Nb messages: {counter}")
|
|
371
371
|
|
|
372
|
-
@When(r"
|
|
373
|
-
def step_impl(context, var_con, timeout_sec, polling_sec
|
|
372
|
+
@When(r"await consumer (?P<var_con>{Variable}) receives a message(?: \(timeout: (?P<timeout_sec>{Float}) s(?: ; polling: (?P<polling_sec>{Float}) s)?\))?")
|
|
373
|
+
def step_impl(context, var_con, timeout_sec, polling_sec):
|
|
374
374
|
con = StepTools.evaluate_variable_value(var_con)
|
|
375
375
|
timeout_sec = StepTools.evaluate_scenario_parameter(timeout_sec)
|
|
376
376
|
polling_sec = StepTools.evaluate_scenario_parameter(polling_sec)
|
|
377
|
-
do_raise = StepTools.evaluate_scenario_parameter(do_raise)
|
|
378
377
|
|
|
379
|
-
__get_rabbitmq_manager().
|
|
378
|
+
__get_rabbitmq_manager().await_message_reception([con], timeout_seconds=timeout_sec, polling_seconds=polling_sec)
|
|
380
379
|
|
|
381
|
-
@When(r"
|
|
382
|
-
def step_impl(context, list_consumers, timeout_sec, polling_sec
|
|
380
|
+
@When(r"await consumers (?P<list_consumers>{List}) receive a message(?: \(timeout: (?P<timeout_sec>{Float}) s(?: ; polling: (?P<polling_sec>{Float}) s)?\))?")
|
|
381
|
+
def step_impl(context, list_consumers, timeout_sec, polling_sec):
|
|
383
382
|
consumers = StepTools.evaluate_list_scenario_parameter(list_consumers, "list_consumers")
|
|
384
383
|
timeout_sec = StepTools.evaluate_scenario_parameter(timeout_sec)
|
|
385
384
|
polling_sec = StepTools.evaluate_scenario_parameter(polling_sec)
|
|
386
|
-
do_raise = StepTools.evaluate_scenario_parameter(do_raise)
|
|
387
385
|
|
|
388
|
-
__get_rabbitmq_manager().
|
|
386
|
+
__get_rabbitmq_manager().await_message_reception(consumers, timeout_seconds=timeout_sec, polling_seconds=polling_sec)
|
|
389
387
|
|
|
390
|
-
@When(r"
|
|
391
|
-
def step_impl(context, var_con, first_timeout_sec, window_sec, polling_sec
|
|
388
|
+
@When(r"await consumer (?P<var_con>{Variable}) receives (?:(?P<no_str>no) )?messages(?: \((?:first timeout: (?P<first_timeout_sec>{Float}) s)?(?: ; )?(?:window: (?P<window_sec>{Float}) s)?(?: ; )?(?:polling: (?P<polling_sec>{Float}) s)?\))?")
|
|
389
|
+
def step_impl(context, var_con, no_str, first_timeout_sec, window_sec, polling_sec):
|
|
392
390
|
con = StepTools.evaluate_variable_value(var_con)
|
|
393
391
|
first_timeout_sec = StepTools.evaluate_scenario_parameter(first_timeout_sec)
|
|
394
392
|
window_sec = StepTools.evaluate_scenario_parameter(window_sec)
|
|
395
393
|
polling_sec = StepTools.evaluate_scenario_parameter(polling_sec)
|
|
396
|
-
do_raise =
|
|
394
|
+
do_raise = no_str is None
|
|
397
395
|
|
|
398
|
-
__get_rabbitmq_manager().
|
|
396
|
+
__get_rabbitmq_manager().await_messages_reception([con], first_timeout_seconds=first_timeout_sec, window_seconds=window_sec, polling_seconds=polling_sec, raise_exception=do_raise)
|
|
399
397
|
|
|
400
|
-
@When(r"
|
|
401
|
-
def step_impl(context, list_consumers, first_timeout_sec, window_sec, polling_sec
|
|
398
|
+
@When(r"await consumers (?P<list_consumers>{List}) receive (?:(?P<no_str>no) )?messages(?: \((?:first timeout: (?P<first_timeout_sec>{Float}) s)?(?: ; )?(?:window: (?P<window_sec>{Float}) s)?(?: ; )?(?:polling: (?P<polling_sec>{Float}) s)?\))?")
|
|
399
|
+
def step_impl(context, list_consumers, no_str, first_timeout_sec, window_sec, polling_sec):
|
|
402
400
|
consumers = StepTools.evaluate_list_scenario_parameter(list_consumers, "list_consumers")
|
|
403
401
|
first_timeout_sec = StepTools.evaluate_scenario_parameter(first_timeout_sec)
|
|
404
402
|
window_sec = StepTools.evaluate_scenario_parameter(window_sec)
|
|
405
403
|
polling_sec = StepTools.evaluate_scenario_parameter(polling_sec)
|
|
406
|
-
do_raise =
|
|
404
|
+
do_raise = no_str is None
|
|
407
405
|
|
|
408
|
-
__get_rabbitmq_manager().
|
|
406
|
+
__get_rabbitmq_manager().await_messages_reception(consumers, first_timeout_seconds=first_timeout_sec, window_seconds=window_sec, polling_seconds=polling_sec, raise_exception=do_raise)
|
|
409
407
|
|
|
410
408
|
@Then(r"consumer (?P<var_con>{Variable}) doesn't receive any message \(timeout: (?P<timeout_sec>{Float}) s ; polling: (?P<polling_sec>{Float}) s\)")
|
|
411
409
|
def step_impl(context, var_con, timeout_sec, polling_sec):
|
|
@@ -413,7 +411,7 @@ if rabbitmq_client.RMQClient.is_available():
|
|
|
413
411
|
timeout_sec = StepTools.evaluate_scenario_parameter(timeout_sec)
|
|
414
412
|
polling_sec = StepTools.evaluate_scenario_parameter(polling_sec)
|
|
415
413
|
|
|
416
|
-
nb = __get_rabbitmq_manager().
|
|
414
|
+
nb = __get_rabbitmq_manager().await_message_reception([con], timeout_seconds=timeout_sec, polling_seconds=polling_sec, raise_exception=False)
|
|
417
415
|
if nb > 0:
|
|
418
416
|
raise FunctionalException(f"Consumer has received {nb} messages")
|
|
419
417
|
|
|
@@ -423,7 +421,7 @@ if rabbitmq_client.RMQClient.is_available():
|
|
|
423
421
|
timeout_sec = StepTools.evaluate_scenario_parameter(timeout_sec)
|
|
424
422
|
polling_sec = StepTools.evaluate_scenario_parameter(polling_sec)
|
|
425
423
|
|
|
426
|
-
nb = __get_rabbitmq_manager().
|
|
424
|
+
nb = __get_rabbitmq_manager().await_message_reception(consumers, timeout_seconds=timeout_sec, polling_seconds=polling_sec, raise_exception=False)
|
|
427
425
|
if nb > 0:
|
|
428
426
|
raise FunctionalException(f"Consumer has received {nb} messages")
|
|
429
427
|
|
|
@@ -533,5 +531,35 @@ if rabbitmq_client.RMQClient.is_available():
|
|
|
533
531
|
def step_impl(context, queue, var_client):
|
|
534
532
|
queue = StepTools.evaluate_scenario_parameter(queue)
|
|
535
533
|
client = StepTools.evaluate_variable_value(var_client)
|
|
536
|
-
client.
|
|
534
|
+
client.purge_queue(queue)
|
|
537
535
|
|
|
536
|
+
@Step(r"delete and recreate stream queue (?P<queue>{Str}) \(RMQ client: (?P<var_client>{Variable})\)")
|
|
537
|
+
def step_impl(context, queue, var_client):
|
|
538
|
+
queue_name = StepTools.evaluate_scenario_parameter(queue)
|
|
539
|
+
client = StepTools.evaluate_variable_value(var_client)
|
|
540
|
+
client.delete_queue(queue_name)
|
|
541
|
+
client._queue_declare(
|
|
542
|
+
channel=client.connection.channel(),
|
|
543
|
+
queue=queue_name,
|
|
544
|
+
queue_args={
|
|
545
|
+
'durable': True,
|
|
546
|
+
"x-queue-type": "stream",
|
|
547
|
+
"x-stream-max-segment-size-bytes": 100000000
|
|
548
|
+
})
|
|
549
|
+
|
|
550
|
+
@Step(r"bind queue (?P<queue>{Str}) to exchange (?P<exchange>{Str})(?: with routine key (?P<routine_key>{Str}))? \(RMQ client: (?P<var_client>{Variable})\)")
|
|
551
|
+
def step_impl(context, queue, exchange, routine_key, var_client):
|
|
552
|
+
queue_name = StepTools.evaluate_scenario_parameter(queue)
|
|
553
|
+
exchange = StepTools.evaluate_scenario_parameter(exchange)
|
|
554
|
+
routine_key = StepTools.evaluate_scenario_parameter(routine_key)
|
|
555
|
+
client = StepTools.evaluate_variable_value(var_client)
|
|
556
|
+
bind_args={
|
|
557
|
+
'routing_key': routine_key
|
|
558
|
+
}
|
|
559
|
+
client._queue_bind(
|
|
560
|
+
channel=client.connection.channel(),
|
|
561
|
+
queue=queue_name,
|
|
562
|
+
exchange=exchange,
|
|
563
|
+
bind_args=bind_args
|
|
564
|
+
)
|
|
565
|
+
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
|
-
from holado_test.behave.behave import *
|
|
17
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
18
18
|
from holado_rabbitmq.tools.rabbitmq import rabbitmq_server
|
|
19
19
|
import logging
|
|
20
20
|
from holado_test.scenario.step_tools import StepTools
|
|
@@ -209,7 +209,7 @@ class RMQClient(DeleteableObject):
|
|
|
209
209
|
def _new_publisher_with_connection(self, connection, queue, queue_args=None, exchange="", exchange_args=None, routing_key=None, nb_runners=None):
|
|
210
210
|
pub_channel = connection.channel()
|
|
211
211
|
|
|
212
|
-
queue_name = self.
|
|
212
|
+
queue_name = self._prepare_queue(pub_channel, queue, queue_args, exchange, exchange_args, bind_args=None)
|
|
213
213
|
if self.connection.publisher_confirms:
|
|
214
214
|
pub_channel.set_confirm_delivery()
|
|
215
215
|
else:
|
|
@@ -236,7 +236,7 @@ class RMQClient(DeleteableObject):
|
|
|
236
236
|
|
|
237
237
|
if self.is_consuming:
|
|
238
238
|
raise FunctionalException(f"[{self.name}] Not allowed to create a new consumer while consuming is started")
|
|
239
|
-
queue_name = self.
|
|
239
|
+
queue_name = self._prepare_queue(con_channel, queue, queue_args, exchange, exchange_args, bind_args)
|
|
240
240
|
res = RMQConsumer(self, connection, con_channel, queue_name, message_callback)
|
|
241
241
|
self.__consumer_and_kwargs.append( self.__new_object_kwargs(res, queue=queue, message_callback=message_callback, queue_args=queue_args, exchange=exchange, exchange_args=exchange_args, bind_args=bind_args) )
|
|
242
242
|
return res
|
|
@@ -249,7 +249,7 @@ class RMQClient(DeleteableObject):
|
|
|
249
249
|
|
|
250
250
|
if self.is_consuming:
|
|
251
251
|
raise FunctionalException(f"[{self.name}] Not allowed to create a new consumer while consuming is started")
|
|
252
|
-
queue_name = self.
|
|
252
|
+
queue_name = self._prepare_queue(con_channel, queue, queue_args, exchange, exchange_args, bind_args)
|
|
253
253
|
res = RMQBufferConsumer(self, connection, con_channel, queue_name)
|
|
254
254
|
self.__buffer_consumer_and_kwargs.append( self.__new_object_kwargs(res, queue=queue, queue_args=queue_args, exchange=exchange, exchange_args=exchange_args, bind_args=bind_args) )
|
|
255
255
|
return res
|
|
@@ -324,25 +324,31 @@ class RMQClient(DeleteableObject):
|
|
|
324
324
|
if Tools.do_log(logger, logging.DEBUG):
|
|
325
325
|
logger.debug(f"[{self.name}] Finished stop data events processing")
|
|
326
326
|
|
|
327
|
-
def
|
|
327
|
+
def _prepare_queue(self, channel, queue, queue_args=None, exchange="", exchange_args=None, bind_args=None):
|
|
328
328
|
if exchange is not None and exchange != "":
|
|
329
|
-
self.
|
|
329
|
+
self._exchange_declare(channel, exchange, exchange_args)
|
|
330
330
|
|
|
331
331
|
if queue is not None and queue != "":
|
|
332
|
-
self.
|
|
332
|
+
self._queue_declare(channel, queue, queue_args)
|
|
333
333
|
queue_name = queue
|
|
334
334
|
else:
|
|
335
335
|
q_args = dict(queue_args) if queue_args else {}
|
|
336
336
|
q_args['exclusive'] = True
|
|
337
|
-
result = self.
|
|
337
|
+
result = self._queue_declare(channel, queue, q_args)
|
|
338
338
|
queue_name = result.method.queue
|
|
339
339
|
|
|
340
340
|
if exchange is not None and exchange != "":
|
|
341
|
-
self.
|
|
341
|
+
self._queue_bind(channel, queue_name, exchange, bind_args)
|
|
342
342
|
|
|
343
343
|
return queue_name
|
|
344
|
-
|
|
345
|
-
def
|
|
344
|
+
|
|
345
|
+
def delete_queue(self, queue):
|
|
346
|
+
self.connection.channel().queue_delete(queue=queue)
|
|
347
|
+
|
|
348
|
+
def purge_queue(self, queue):
|
|
349
|
+
self.connection.channel().queue_purge(queue)
|
|
350
|
+
|
|
351
|
+
def _exchange_declare(self, channel, exchange, exchange_args=None):
|
|
346
352
|
kwargs = {}
|
|
347
353
|
arguments = None
|
|
348
354
|
if exchange_args:
|
|
@@ -352,7 +358,7 @@ class RMQClient(DeleteableObject):
|
|
|
352
358
|
kwargs[name] = arguments.pop(name)
|
|
353
359
|
return channel.exchange_declare(exchange, arguments=arguments, **kwargs)
|
|
354
360
|
|
|
355
|
-
def
|
|
361
|
+
def _queue_declare(self, channel, queue, queue_args=None):
|
|
356
362
|
kwargs = {}
|
|
357
363
|
arguments = None
|
|
358
364
|
if queue_args:
|
|
@@ -362,7 +368,7 @@ class RMQClient(DeleteableObject):
|
|
|
362
368
|
kwargs[name] = arguments.pop(name)
|
|
363
369
|
return channel.queue_declare(queue, arguments=arguments, **kwargs)
|
|
364
370
|
|
|
365
|
-
def
|
|
371
|
+
def _queue_bind(self, channel, queue, exchange, bind_args=None):
|
|
366
372
|
kwargs = {}
|
|
367
373
|
arguments = None
|
|
368
374
|
if bind_args:
|
|
@@ -374,7 +380,7 @@ class RMQClient(DeleteableObject):
|
|
|
374
380
|
|
|
375
381
|
def get_queue_message_count(self, queue):
|
|
376
382
|
channel = self.connection.channel()
|
|
377
|
-
status = self.
|
|
383
|
+
status = self._queue_declare(channel, queue, {'passive':True})
|
|
378
384
|
return status.method.message_count
|
|
379
385
|
|
|
380
386
|
def is_queue_empty(self, queue, raise_exception=False):
|
|
@@ -36,39 +36,12 @@ class RMQManager:
|
|
|
36
36
|
return res
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def
|
|
39
|
+
def await_message_reception(self, consumers, timeout_seconds=None, polling_seconds=None, raise_exception=True):
|
|
40
40
|
"""Wait until one of the buffer consumers has received a message.
|
|
41
41
|
@param consumers: list of buffer consumers
|
|
42
42
|
@param timeout_seconds: wait timeout
|
|
43
43
|
@param polling_seconds: time to wait between pollings of received messages of all consumers
|
|
44
44
|
"""
|
|
45
|
-
# res = 0
|
|
46
|
-
#
|
|
47
|
-
# if timeout_seconds is None:
|
|
48
|
-
# timeout_seconds = Config.timeout_seconds
|
|
49
|
-
# if polling_seconds is None:
|
|
50
|
-
# polling_seconds = timeout_seconds / 1000
|
|
51
|
-
# if polling_seconds > 0.01:
|
|
52
|
-
# polling_seconds = 0.01
|
|
53
|
-
#
|
|
54
|
-
# # Wait first message
|
|
55
|
-
# dt_begin = datetime.now()
|
|
56
|
-
# dt_last_poll = dt_begin
|
|
57
|
-
# while (dt_last_poll - dt_begin).total_seconds() < timeout_seconds:
|
|
58
|
-
# nb_msg_by_consumer = {c.name: c.nb_messages for c in consumers if c.nb_messages > 0}
|
|
59
|
-
# dt_last_poll = datetime.now()
|
|
60
|
-
# if len(nb_msg_by_consumer) > 0:
|
|
61
|
-
# if Tools.do_log(logger, logging.DEBUG):
|
|
62
|
-
# logger.debug(f"Received messages: " + " ; ".join(f"{k}:{v}" for k,v in nb_msg_by_consumer.items()))
|
|
63
|
-
# res = sum(nb_msg_by_consumer.values())
|
|
64
|
-
# if res > 0:
|
|
65
|
-
# break
|
|
66
|
-
# time.sleep(polling_seconds)
|
|
67
|
-
#
|
|
68
|
-
# if res == 0 and raise_exception:
|
|
69
|
-
# names = ",".join([c.name for c in consumers])
|
|
70
|
-
# raise FunctionalException(f"[{names}] No message was received (timeout: {timeout_seconds} seconds)")
|
|
71
|
-
# return res
|
|
72
45
|
if raise_exception is None:
|
|
73
46
|
raise_exception = True
|
|
74
47
|
|
|
@@ -90,7 +63,7 @@ class RMQManager:
|
|
|
90
63
|
|
|
91
64
|
#TODO EKL: add a first_accepted_seconds and a accepted_window_seconds to be able to raise an exception that first or next message arrived but too late
|
|
92
65
|
#TODO EKL: change use of polling_seconds to something like a timer, rather than waiting polling_seconds
|
|
93
|
-
def
|
|
66
|
+
def await_messages_reception(self, consumers, first_timeout_seconds=None, window_seconds=None, polling_seconds=None, raise_exception=True):
|
|
94
67
|
"""Wait until buffer consumers stop to receive messages.
|
|
95
68
|
It begins by waiting a first message in any consumer, since their creation or last reset.
|
|
96
69
|
If no consumer receives a first message during first_timeout_seconds period, wait stops.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
20
20
|
from holado_scripting.text.interpreter.text_interpreter import TextInterpreter
|
|
21
21
|
from holado_scripting.common.tools.variable_manager import VariableManager
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
20
20
|
from holado_rest.api.rest.rest_client import RestClient
|
|
21
21
|
import json
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
#################################################
|
|
14
14
|
|
|
15
15
|
from holado.common.context.session_context import SessionContext
|
|
16
|
-
from holado_test.behave.behave import *
|
|
16
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
17
17
|
import os.path
|
|
18
18
|
import logging
|
|
19
19
|
from holado_test.scenario.step_tools import StepTools
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
|
-
from holado_test.behave.behave import *
|
|
17
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
18
18
|
from holado_scripting.common.tools.variable_manager import VariableManager
|
|
19
19
|
import logging
|
|
20
20
|
from holado_test.scenario.step_tools import StepTools
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
20
20
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
21
21
|
from holado_scripting.common.tools.variable_manager import VariableManager
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
|
-
from holado_test.behave.behave import *
|
|
17
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
18
18
|
from holado_s3.tools.s3.moto_server import MotoServer
|
|
19
19
|
import logging
|
|
20
20
|
from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
20
20
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
21
21
|
import base64
|
|
@@ -26,6 +26,7 @@ from holado_value.common.tables.value_table_with_header import ValueTableWithHea
|
|
|
26
26
|
from holado_value.common.tables.value_table import ValueTable
|
|
27
27
|
from holado_core.common.tools.tools import Tools
|
|
28
28
|
from holado_python.standard_library.typing import Typing
|
|
29
|
+
from holado_value.common.tables.value_table_manager import ValueTableManager
|
|
29
30
|
|
|
30
31
|
logger = logging.getLogger(__name__)
|
|
31
32
|
|
|
@@ -98,7 +99,7 @@ def step_impl(context, var_name, object_value):
|
|
|
98
99
|
row = None
|
|
99
100
|
|
|
100
101
|
if row is not None:
|
|
101
|
-
if
|
|
102
|
+
if ValueTableManager.is_value_table(table):
|
|
102
103
|
res = [c.value for c in row]
|
|
103
104
|
else:
|
|
104
105
|
res = [c.content for c in row]
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
from holado_value.common.tables.value_table_manager import ValueTableManager
|
|
17
17
|
from holado_test.scenario.step_tools import StepTools
|
|
18
18
|
from holado.common.context.session_context import SessionContext
|
|
19
|
-
from holado_test.behave.behave import *
|
|
19
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
20
20
|
import logging
|
|
21
21
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
22
22
|
from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
20
20
|
import logging
|
|
21
21
|
import copy
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.tables.table_manager import TableManager
|
|
20
20
|
from holado_value.common.tables.comparators.table_2_value_table_comparator import Table2ValueTable_Comparator
|
|
21
21
|
from holado_core.common.tools.comparators.comparator import CompareOperator
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import logging
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
17
|
from holado_test.scenario.step_tools import StepTools
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.block.scope_steps import ScopeSteps
|
|
20
20
|
from holado_core.common.tools.tools import Tools
|
|
21
21
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import logging
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
17
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.tools.converters.converter import Converter
|
|
20
20
|
from holado_python.standard_library.typing import Typing
|
|
21
21
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import logging
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
17
|
from holado_test.scenario.step_tools import StepTools
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.block.scope_steps import ScopeForSteps, ScopeWhileSteps
|
|
20
20
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
21
21
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
|
-
from holado_test.behave.behave import *
|
|
17
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
18
18
|
import os.path
|
|
19
19
|
import logging
|
|
20
20
|
from holado_test.scenario.step_tools import StepTools
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
20
20
|
from holado_sftp.tools.sftp.sftp_client import SFTPClient
|
|
21
21
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
from holado.common.context.session_context import SessionContext
|
|
17
|
-
from holado_test.behave.behave import *
|
|
17
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
18
18
|
from holado_sftp.tools.sftp.sftp_server import SFTPServer
|
|
19
19
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
20
20
|
import logging
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from holado_test.scenario.step_tools import StepTools
|
|
17
17
|
from holado.common.context.session_context import SessionContext
|
|
18
|
-
from holado_test.behave.behave import *
|
|
18
|
+
from holado_test.behave.behave import * # @UnusedWildImport
|
|
19
19
|
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
20
20
|
from holado_rest.api.rest.rest_client import RestClient
|
|
21
21
|
import json
|