From 2e42dfdd4b152ece0463ba647cc6bf481d605c0b Mon Sep 17 00:00:00 2001 From: Artur Shellunts Date: Fri, 4 Nov 2022 16:21:11 +0100 Subject: [PATCH] Add test for pion-to-pion example Also add new GitHub Actions workflow to run tests for example apps --- .github/workflows/examples-tests.yaml | 19 +++++++++++++++++++ examples/pion-to-pion/docker-compose.yml | 2 ++ examples/pion-to-pion/test.sh | 14 ++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 .github/workflows/examples-tests.yaml create mode 100755 examples/pion-to-pion/test.sh diff --git a/.github/workflows/examples-tests.yaml b/.github/workflows/examples-tests.yaml new file mode 100644 index 00000000000..1791be42e49 --- /dev/null +++ b/.github/workflows/examples-tests.yaml @@ -0,0 +1,19 @@ +name: Examples Tests +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + pion-to-pion-test: + name: Test + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: test + run: cd examples/pion-to-pion && ./test.sh + diff --git a/examples/pion-to-pion/docker-compose.yml b/examples/pion-to-pion/docker-compose.yml index 959ed8fdecf..fff78574fe0 100644 --- a/examples/pion-to-pion/docker-compose.yml +++ b/examples/pion-to-pion/docker-compose.yml @@ -1,10 +1,12 @@ version: '3' services: answer: + container_name: answer build: ./answer command: answer -offer-address offer:50000 offer: + container_name: offer depends_on: - answer build: ./offer diff --git a/examples/pion-to-pion/test.sh b/examples/pion-to-pion/test.sh new file mode 100755 index 00000000000..0ae41c3ddfb --- /dev/null +++ b/examples/pion-to-pion/test.sh @@ -0,0 +1,14 @@ +#!/bin/bash -eu + +docker compose up -d + +function on_exit { + docker compose logs + docker compose rm -fsv +} + +trap on_exit EXIT + +TIMEOUT=10 +timeout $TIMEOUT docker compose logs -f | grep -q "answer | Message from DataChannel" +timeout $TIMEOUT docker compose logs -f | grep -q "offer | Message from DataChannel"