mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-20 17:52:51 +00:00
Run test supervisor under a different service name
The docker compose V2 spec no longer accepts `network_mode: bridge`, which means we can no longer override the network configuration of the `balena-supervisor` service for tests. For this reason we now create a separate service to run the built supervisor `balena-supervisor-sut` and run API tests against this service instead of the default `balena-supervisor`. Change-type: patch
This commit is contained in:
parent
f6e0683032
commit
33b29cfa22
@ -1,20 +1,15 @@
|
||||
version: '2.3'
|
||||
|
||||
services:
|
||||
# Override the supervisor service configuration. The tests will
|
||||
# be run through the `sut` service
|
||||
balena-supervisor:
|
||||
balena-supervisor-sut:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile.template
|
||||
args:
|
||||
ARCH: ${ARCH:-amd64}
|
||||
command: [ '/wait-for-it.sh', '--', '/usr/src/app/entry.sh' ]
|
||||
command: ['/wait-for-it.sh', '--', '/usr/src/app/entry.sh']
|
||||
stop_grace_period: 3s
|
||||
# Use bridge networking for the tests
|
||||
network_mode: 'bridge'
|
||||
networks:
|
||||
- default
|
||||
environment:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DBUS_SYSTEM_BUS_ADDRESS: unix:path=/run/dbus/system_bus_socket
|
||||
@ -77,10 +72,10 @@ services:
|
||||
'--',
|
||||
'npm',
|
||||
'run',
|
||||
'test:integration'
|
||||
'test:integration',
|
||||
]
|
||||
depends_on:
|
||||
- balena-supervisor
|
||||
- balena-supervisor-sut
|
||||
- docker
|
||||
- dbus
|
||||
- dbus-services
|
||||
@ -91,7 +86,7 @@ services:
|
||||
environment:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DBUS_SYSTEM_BUS_ADDRESS: unix:path=/run/dbus/system_bus_socket
|
||||
BALENA_SUPERVISOR_ADDRESS: http://balena-supervisor:48484
|
||||
BALENA_SUPERVISOR_ADDRESS: http://balena-supervisor-sut:48484
|
||||
# Required by migrations
|
||||
CONFIG_MOUNT_POINT: /mnt/boot/config.json
|
||||
# Required to set mountpoints normally set in entry.sh
|
||||
@ -118,6 +113,3 @@ volumes:
|
||||
# Use tmpfs to avoid files remaining between runs
|
||||
type: tmpfs
|
||||
device: tmpfs
|
||||
|
||||
networks:
|
||||
default:
|
||||
|
@ -18,9 +18,9 @@
|
||||
"test:legacy": "mocha --config test/legacy/.mocharc.js",
|
||||
"test:node": "npm run test:unit && npm run test:integration && npm run test:legacy",
|
||||
"test:env": "ARCH=$(./build-utils/detect-arch.sh) docker compose -f docker-compose.test.yml -f docker-compose.dev.yml up --build; npm run compose:down",
|
||||
"test:compose": "ARCH=$(./build-utils/detect-arch.sh) docker compose -f docker-compose.yml -f docker-compose.test.yml up --build --remove-orphans --exit-code-from=sut ; npm run compose:down",
|
||||
"test:compose": "ARCH=$(./build-utils/detect-arch.sh) docker compose -f docker-compose.yml -f docker-compose.test.yml up sut --build --remove-orphans --exit-code-from=sut ; npm run compose:down",
|
||||
"test": "npm run lint && npm run test:build && npm run test:unit",
|
||||
"compose:down": "docker compose -f docker-compose.test.yml down --volumes",
|
||||
"compose:down": "docker compose -f docker-compose.yml -f docker-compose.test.yml down --volumes",
|
||||
"prettify": "balena-lint -e ts -e js --fix src/ test/ typings/ build-utils/ webpack.config.js",
|
||||
"release": "tsc --project tsconfig.release.json && mv build/src/* build",
|
||||
"sync": "ts-node --files sync/sync.ts",
|
||||
|
Loading…
x
Reference in New Issue
Block a user