Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
Signed-off-by: tempate <danieldiaz@eprosima.com>
  • Loading branch information
Tempate authored and juanlofer-eprosima committed Sep 18, 2024
1 parent 8600297 commit b209bc5
Show file tree
Hide file tree
Showing 37 changed files with 903 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ddsrouter_test/compose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@ set(TESTS
forwarding_routes/topic_routes
forwarding_routes/repeater

remove_unused_entities/disconnect
remove_unused_entities/disconnect_wan
remove_unused_entities/persist_diff_domain
remove_unused_entities/persist_same_domain
remove_unused_entities/reconnect
remove_unused_entities/reconnect_wan
remove_unused_entities/reader/disconnect
remove_unused_entities/reader/disconnect_wan
remove_unused_entities/reader/persist_diff_domain
remove_unused_entities/reader/persist_same_domain
remove_unused_entities/reader/reconnect
remove_unused_entities/reader/reconnect_wan
remove_unused_entities/writer/disconnect
remove_unused_entities/writer/disconnect_wan
remove_unused_entities/writer/persist_diff_domain
remove_unused_entities/writer/persist_same_domain
remove_unused_entities/writer/reconnect
remove_unused_entities/writer/reconnect_wan

frequency/max-tx-rate/specs
frequency/max-tx-rate/participant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ participants:

specs:
remove-unused-entities: true
discovery-trigger: reader
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Test description:
# This test checks that tracks get deleted when their last publisher disconnects.
#
# Test architecture:
#
# 1. Check that the subscribers connect to the publisher.
#
# ┌───────────────────┐ ┌────────────────────┐
# │ Domain 80 │ │ Domain 81 │
# │ ┌──────────────┐ ┌┼────────────┼┐ ┌───────────────┐ │
# │ │publisher_0_t0│ ││ ddsrouter ││ │subscriber_1_t0│ │
# │ │ ─┼─┼┤► ─┼┼─┤► │ │
# │ │(local) │ ││ (local) ││ │(local) │ │
# │ └──────────────┘ └┼──────────┬─┼┘ └───────────────┘ │
# │ │ │ │ │
# └───────────────────┘ │ │ ┌───────────────┐ │
# │ │ │subscriber_2_t0│ │
# └─┼──┤► │ │
# │ │(local) │ │
# │ └───────────────┘ │
# │ │
# └────────────────────┘
#
# 2. Check that when the publisher disconnects the track gets deleted.
#
# ┌───────────────────┐ ┌────────────────────┐
# │ Domain 80 │ │ Domain 81 │
# │ ┌┼─────────────┼┐ ┌───────────────┐ │
# │ ││ ddsrouter ││ │subscriber_2_t0| │
# │ ││ ││ │ │ │
# │ ││ (local) ││ │(local) │ │
# │ └┼─────────────┼┘ └───────────────┘ │
# │ │ │ │
# └───────────────────┘ └────────────────────┘
#

services:

# ROUTER
ddsrouter:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: ddsrouter
networks:
- std_net
volumes:
- ./ddsrouter.yaml:/config.yaml
command: ddsrouter -c /config.yaml --timeout 10

# DOMAIN 80
publisher_0_t0:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: publisher_0_t0
depends_on:
- ddsrouter
networks:
- std_net
volumes:
- ../../../../scripts:/scripts
command: python3 /scripts/execute_and_validate_publisher.py --exe install/AdvancedConfigurationExample/examples/cpp/dds/AdvancedConfigurationExample/AdvancedConfigurationExample --timeout 4 --args "--samples 40 --domain 80 --topic topic0 --interval 100"

# DOMAIN 81

# Subscriber to verify the track has been created
subscriber_1_t0:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: subscriber_1_t0
depends_on:
- ddsrouter
networks:
- std_net
volumes:
- ../../../../scripts:/scripts
command: python3 /scripts/execute_and_validate_subscriber.py --exe install/AdvancedConfigurationExample/examples/cpp/dds/AdvancedConfigurationExample/AdvancedConfigurationExample --samples 10 --timeout 8 --args "--domain 81 --samples 10 --topic topic0"

# Subscriber to verify the track has been deleted
subscriber_2_t0:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: subscriber_2_t0
depends_on:
- ddsrouter
networks:
- std_net
volumes:
- ../../../../scripts:/scripts
command: python3 /scripts/execute_and_validate_subscriber.py --exe install/AdvancedConfigurationExample/examples/cpp/dds/AdvancedConfigurationExample/AdvancedConfigurationExample --n-unmatches 1 --timeout 8 --args "--domain 81 --topic topic0"

networks:
std_net:
default:
driver: none
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: v4.0

participants:

- name: Local_80
kind: local
domain: 80

- name: Local_81
kind: local
domain: 81

specs:
remove-unused-entities: true
discovery-trigger: writer
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Test description:
# This test checks that the removal of unused entities frees up bandwidth
# over a WAN connection when there aren't any publishers. To achieve it, the
# test sets up four routers, a subscriber, and a publisher. It then checks
# that the subscriber receives the data from the publisher, and then it stops
# the connection and checks if the tracks have been destroyed.
#
# Test architecture:
#
# ┌─────────────────────────────────────────┐
# │ cloud_edge_net │
# │ ┌─────────────────┐ ┌─────────────────┐ │
# │ │ddsrouter_cloud_0│ │ddsrouter_cloud_1│ │
# │ │ ─┼─┤► │ │
# │ │(wan + wan) │ │(wan + wan) │ │
# │ └──────────────▲──┘ └──────────────┬──┘ │
# │ │ │ │
# │ ┌──────────────┼──┐ ┌──────────────┼──┐ │
# │ │ Domain 80 │ │ │ Domain 81 │ │ │
# │ │ │ │ │ │ │ │
# │ │ edge_0_net │ │ │ edge_1_net │ │ │
# │ │ ┌────────────┴┐ │ │ ┌────────────▼┐ │ │
# │ │ │ddsrouter_0 │ │ │ │ddsrouter_1 │ │ │
# │ │ │ │ │ │ │ │ │ │
# │ │ │(local + wan)│ │ │ │(local + wan)│ │ │
# │ │ └──────────▲──┘ │ │ └──────────┬──┘ │ │
# │ │ │ │ │ │ │ │
# └─┼────────────┼────┼─┼────────────┼────┼─┘
# │ │ │ │ │ │
# │ ┌──────────┴──┐ │ │ ┌──────────▼──┐ │
# │ │publisher_t0 │ │ │ │subscriber_t0│ │
# │ │ │ │ │ │ │ │
# │ │(local) │ │ │ │(local) │ │
# │ └─────────────┘ │ │ └─────────────┘ │
# │ │ │ │
# └─────────────────┘ └─────────────────┘

services:

# CLOUD
ddsrouter_cloud_0:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: ddsrouter_cloud_0
networks:
- cloud_edge_net
volumes:
- ./ddsrouter_cloud_0.yaml:/config.yaml
command: ddsrouter -c /config.yaml --timeout 8

ddsrouter_cloud_1:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: ddsrouter_cloud_1
depends_on:
- ddsrouter_cloud_0
networks:
- cloud_edge_net
volumes:
- ./ddsrouter_cloud_1.yaml:/config.yaml
command: ddsrouter -c /config.yaml --timeout 8

# DOMAIN 80
ddsrouter_edge_0:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: ddsrouter_edge_0
depends_on:
- ddsrouter_cloud_0
networks:
- cloud_edge_net
- edge_0_net
volumes:
- ./ddsrouter_edge_0.yaml:/config.yaml
command: ddsrouter -c /config.yaml --timeout 8

publisher_0:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: publisher_0
depends_on:
- ddsrouter_edge_0
networks:
- edge_0_net
volumes:
- ../../../../scripts:/scripts
command: python3 /scripts/execute_and_validate_publisher.py --exe install/AdvancedConfigurationExample/examples/cpp/dds/AdvancedConfigurationExample/AdvancedConfigurationExample --timeout 4 --args "--samples 40 --domain 80 --topic topic0 --interval 100"

# DOMAIN 81
ddsrouter_edge_1:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: ddsrouter_edge_1
depends_on:
- ddsrouter_cloud_1
networks:
- cloud_edge_net
- edge_1_net
volumes:
- ./ddsrouter_edge_1.yaml:/config.yaml
command: ddsrouter -c /config.yaml --timeout 8

# Subscriber to verify the track has been created
subscriber_1:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: subscriber_1
depends_on:
- ddsrouter_edge_1
networks:
- edge_1_net
volumes:
- ../../../../scripts:/scripts
command: python3 /scripts/execute_and_validate_subscriber.py --exe install/AdvancedConfigurationExample/examples/cpp/dds/AdvancedConfigurationExample/AdvancedConfigurationExample --samples 10 --timeout 8 --args "--domain 81 --samples 10 --topic topic0"

# Subscriber to verify the track has been deleted
subscriber_2:
image: ${DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE}
container_name: subscriber_2
depends_on:
- ddsrouter_edge_1
networks:
- edge_1_net
volumes:
- ../../../../scripts:/scripts
command: python3 /scripts/execute_and_validate_subscriber.py --exe install/AdvancedConfigurationExample/examples/cpp/dds/AdvancedConfigurationExample/AdvancedConfigurationExample --n-unmatches 1 --timeout 8 --args "--domain 81 --topic topic0"

networks:
edge_0_net:
edge_1_net:
cloud_edge_net:
default:
driver: none
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: v4.0

participants:

- name: Cloud_Participant_0
kind: wan
listening-addresses:
- domain: ddsrouter_cloud_0
port: 11666
transport: udp

- name: Cloud_Participant_1
kind: wan
listening-addresses:
- domain: ddsrouter_cloud_0
port: 21666
transport: udp

specs:
remove-unused-entities: true
discovery-trigger: writer
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: v4.0

participants:

- name: Cloud_Participant_0
kind: wan
listening-addresses:
- domain: ddsrouter_cloud_1
port: 31666
transport: udp

- name: Cloud_Participant_1
kind: wan
connection-addresses:
- domain: ddsrouter_cloud_0
port: 21666
transport: udp

specs:
remove-unused-entities: true
discovery-trigger: writer
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: v4.0

participants:

- name: Local_80
kind: local
domain: 80

- name: Edge_Participant
kind: wan
connection-addresses:
- domain: ddsrouter_cloud_0
port: 11666
transport: udp

specs:
remove-unused-entities: true
discovery-trigger: writer
Loading

0 comments on commit b209bc5

Please sign in to comment.