Skip to content

Commit

Permalink
Get implementations tests (under integration) ready to go
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoblath committed Dec 4, 2024
1 parent bb8445c commit b8c6301
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The integration tests are specified in `run-tests.sh`. They're run using the [b

You can run the tests directly with `docker compose`:

> DLPY_IMG_TAG=[image tag] DLCPP_IMG_TAG=[image tag] docker compose -f docker-compose.yaml -f docker-compose-test.yaml up
> DLPY_IMG_TAG=[image tag] DLCPP_IMG_TAG=[image tag] docker compose -f docker-compose.yaml -f docker-compose-test.yaml -f docker-compose-services.yaml up

Or you can use the convenience script, `do-testing.sh`:

Expand Down
8 changes: 8 additions & 0 deletions tests/integration/do-testing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ fi

TEST_BASIC_EXIT_CODE=`docker wait integration-test-basic-1`
TEST_CORE_EXIT_CODE=`docker wait integration-test-core-1`
TEST_IMPLEMENTATIONS_EXIT_CODE=`docker wait integration-test-implementations-1`

docker logs integration-test-basic-1
docker logs integration-test-core-1
docker logs integration-test-implementations-1

A_TEST_FAILED=0
if [ -z ${TEST_BASIC_EXIT_CODE+x} ] || [ "$TEST_BASIC_EXIT_CODE" -ne 0 ] ; then
Expand All @@ -46,6 +48,12 @@ if [ -z ${TEST_CORE_EXIT_CODE+x} ] || [ "$TEST_CORE_EXIT_CODE" -ne 0 ] ; then
docker logs integration-alert_consumer-1
A_TEST_FAILED=1
fi
if [ -z ${TEST_IMPLEMENTATIONS_EXIT_CODE+x} ] || [ "$TEST_IMPLEMENTATIONS_EXIT_CODE" -ne 0 ] ; then
docker logs integration-test-core-1
docker logs integration-key-value-store-1
docker logs integration-alert_consumer-1
A_TEST_FAILED=1
fi

if [ "$A_TEST_FAILED" -ne 0 ] ; then
docker logs integration-rabbit-broker-1
Expand Down
27 changes: 22 additions & 5 deletions tests/integration/docker-compose-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
- rabbit-broker
- simple-service
volumes:
- ./run-tests-basic.bats:/root/run-tests-basic.bats
- ./tests/run-tests-basic.bats:/root/run-tests-basic.bats
- ./dripline_mesh.yaml:/root/.dripline_mesh.yaml
environment:
- DRIPLINE_USER=dripline
Expand All @@ -22,11 +22,11 @@ services:
image: ghcr.io/driplineorg/dripline-python:${DLPY_IMG_TAG:-latest-dev}
depends_on:
- rabbit-broker
# - key-value-store
# - base-service
- key-value-store
- base-service
- alert-consumer
volumes:
- ./run-tests-core.bats:/root/run-tests-core.bats
- ./tests/run-tests-core.bats:/root/run-tests-core.bats
- ./dripline_mesh.yaml:/root/.dripline_mesh.yaml
environment:
- DRIPLINE_USER=dripline
Expand All @@ -36,4 +36,21 @@ services:
/root/run-tests-core.bats &&
/bin/true"
configs:
- dl_pw.txt
- dl_pw.txt

test-implementations:
image: ghcr.io/driplineorg/dripline-python:${DLPY_IMG_TAG:-latest-dev}
depends_on:
- rabbit-broker
- scpi-service
- sensor-logger
volumes:
- ./tests/run-tests-implementations.bats:/root/run-tests-implementations.bats
- ./dripline_mesh.yaml:/root/.dripline_mesh.yaml
environment:
- DRIPLINE_USER=dripline
- DRIPLINE_PASSWORD=dripline
command: >
bash -c "sleep 1 &&
/root/run-tests-implementations.bats &&
/bin/true"
1 change: 0 additions & 1 deletion tests/integration/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ services:

http-server:
image: ghcr.io/driplineorg/dripline-python:${DLPY_IMG_TAG:-latest-dev}
# build: . use if developing/testing locally
depends_on:
rabbit-broker:
condition: service_healthy
Expand Down
7 changes: 3 additions & 4 deletions tests/integration/tests/run-tests-core.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@
# load 'test_helper/bats-assert/load'
#}

#disabled() {
@test "ping base" {
dl-agent -vv cmd dlpy_service -s ping
}

#disabled() {
@test "ping my_store" {
dl-agent -vv cmd my_store -s ping
}

#disabled() {
@test "get peaches" {
dl-agent -vv get peaches
}

#disabled() {
@test "set peaches" {
dl-agent -vv set peaches 500
}
Expand All @@ -29,6 +25,9 @@
dl-agent -vv cmd alert_consumer -s ping
}

# We don't have a great test available to see that the alert_consumer saw the alert
# For now we'll just test that it's still running with a ping
@test "alert alert_consumer" {
dl-agent -vv alert an_alert
dl-agent -vv cmd alert_consumer -s ping
}
10 changes: 5 additions & 5 deletions tests/integration/tests/run-tests-implementations.bats
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#! /usr/bin/env bats

@test "ping my_device" {
dl-agent -vv -u dripline --password-file /dl_pw.txt cmd my_device -s ping
dl-agent -vv cmd my_device -s ping
}

@test "get idn" {
dl-agent -vv -u dripline --password-file /dl_pw.txt get idn
dl-agent -vv get idn
}

@test "get voltage" {
dl-agent -vv -u dripline --password-file /dl_pw.txt get voltage
dl-agent -vv get voltage
}

@test "get idn" {
dl-agent -vv -u dripline --password-file /dl_pw.txt set voltage 10.1
@test "set voltage" {
dl-agent -vv set voltage 10.1
}

0 comments on commit b8c6301

Please sign in to comment.