Skip to content

Commit

Permalink
Fix timing issue ownership tests (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
angelrti authored Jun 11, 2024
1 parent f078f3f commit 8c763c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion interoperability_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# This parameter is used to save the samples the Publisher sends.
# MAX_SAMPLES_SAVED is the maximum number of samples saved.
MAX_SAMPLES_SAVED = 100
MAX_SAMPLES_SAVED = 500

def run_subscriber_shape_main(
name_executable: str,
Expand Down Expand Up @@ -445,6 +445,7 @@ def run_test(
'publisher_finished':publishers_finished[publisher_number]}))
publisher_number += 1
entity_type.append(f'Publisher_{publisher_number}')
time.sleep(1)

elif('-S ' in parameters[i] or parameters[i].endswith('-S')):
# Wait 1 second before running the subscriber to avoid conflicts between
Expand Down
7 changes: 5 additions & 2 deletions test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ def test_ownership_receivers(child_sub, samples_sent, timeout):
second_received = False
list_data_received_second = []
list_data_received_first = []
max_samples_received = 125
max_samples_received = 500
samples_read = 0

for x in range(0, max_samples_received, 1):
while(samples_read < max_samples_received):
# take the topic, color, position and size of the ShapeType.
# child_sub.before contains x and y, and child_sub.after contains
# [shapesize]
Expand Down Expand Up @@ -119,6 +120,8 @@ def test_ownership_receivers(child_sub, samples_sent, timeout):
if index == 1:
break

samples_read += 1

# A potential case is that the reader gets data from one writer and
# then start receiving from a different writer with a higher
# ownership. This avoids returning RECEIVING_FROM_BOTH if this is
Expand Down

0 comments on commit 8c763c9

Please sign in to comment.