Skip to content

Commit cb537d9

Browse files
authored
Fix Docker tests' compatibility with the new AdvancedConfiguration (#428)
* Update validation scripts to work with new version of advanced conf example Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Remove comment Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --------- Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>
1 parent 351aa53 commit cb537d9

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

ddsrouter_test/compose/scripts/execute_and_validate_subscriber.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,15 @@ def _subscriber_parse_output(stdout, stderr):
136136
:return: List of received messages
137137
"""
138138

139-
msgs_regex = re.compile(r'^Message\sHelloWorld\s+\d+\sRECEIVED$')
139+
msgs_regex_basic = re.compile(r'^Message\sHelloWorld\s+\d+\sRECEIVED$')
140+
msgs_regex_adv = re.compile(r'Sample received: HelloWorld\s+\d+\s+\(\d+ Bytes\)')
140141
match_regex = re.compile(r'^Subscriber matched \[.+\].$')
141142
unmatch_regex = re.compile(r'^Subscriber unmatched \[.+\].$')
142143

143144
filtered_data = {'messages': [], 'matches': 0, 'unmatches': 0}
144145

145146
for line in stdout.splitlines():
146-
if msgs_regex.match(line):
147+
if msgs_regex_basic.match(line) or msgs_regex_adv.match(line):
147148
filtered_data['messages'].append(line)
148149

149150
elif match_regex.match(line):
@@ -241,18 +242,21 @@ def check_transient(data):
241242
:param data: List of strings
242243
:return: True if transient has been fulfilled, false in case on error
243244
"""
244-
# Convert every line into just the number
245-
ini_str_size = len('Message HelloWorld ')
246-
end_str_size = len(' RECEIVED')
247-
numbers_received = [
248-
line[ini_str_size:-end_str_size]
249-
for line in data]
250-
251-
# NOTE: idx starts in 0 and messages start in 1
252-
for idx, number in enumerate(numbers_received):
253-
if (idx + 1) != int(number):
245+
msg_pattern = re.compile(r'HelloWorld\s+(\d+)')
246+
247+
for idx, line in enumerate(data):
248+
match = msg_pattern.search(line)
249+
250+
if not match:
251+
log.logger.warn(
252+
f'Message received in position {idx + 1} is not valid')
253+
return False
254+
255+
message_id = int(match.group(1))
256+
257+
if idx + 1 != message_id:
254258
log.logger.warn(
255-
f'Message received in position {idx+1} is {number}')
259+
f'Message received in position {idx + 1} is {message_id}')
256260
return False
257261

258262
log.logger.debug('All messages received and in correct order.')

ddsrouter_test/compose/test_cases/forwarding_routes/topic_routes/ddsrouter.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ routes:
2525

2626
topic-routes:
2727
- name: topic1
28-
type: HelloWorld
28+
type: AdvancedConfiguration
2929
routes:
3030
- src: Local_80
3131
dst:

0 commit comments

Comments
 (0)