2022-08-22 23:54:21 +00:00
|
|
|
version: '2.3'
|
|
|
|
|
|
|
|
services:
|
2023-04-27 14:08:40 +00:00
|
|
|
balena-supervisor-sut:
|
2022-08-22 23:54:21 +00:00
|
|
|
build:
|
|
|
|
context: ./
|
2022-11-02 18:56:48 +00:00
|
|
|
dockerfile: Dockerfile.template
|
|
|
|
args:
|
|
|
|
ARCH: ${ARCH:-amd64}
|
2023-04-27 14:08:40 +00:00
|
|
|
command: ['/wait-for-it.sh', '--', '/usr/src/app/entry.sh']
|
2022-10-31 21:31:43 +00:00
|
|
|
stop_grace_period: 3s
|
2022-11-02 18:56:48 +00:00
|
|
|
# Use bridge networking for the tests
|
|
|
|
environment:
|
|
|
|
DOCKER_HOST: tcp://docker:2375
|
2023-08-02 15:21:11 +00:00
|
|
|
DBUS_SYSTEM_BUS_ADDRESS: unix:path=/shared/dbus/system_bus_socket
|
2023-02-21 06:11:27 +00:00
|
|
|
# Required to skip device mounting in test env
|
|
|
|
TEST: 1
|
2022-11-02 18:56:48 +00:00
|
|
|
depends_on:
|
|
|
|
- docker
|
2023-08-02 15:21:11 +00:00
|
|
|
- mock-systemd
|
2022-11-02 18:56:48 +00:00
|
|
|
volumes:
|
2023-08-02 15:21:11 +00:00
|
|
|
- dbus:/shared/dbus
|
2024-03-06 06:53:58 +00:00
|
|
|
- tmp:/mnt/root/tmp/balena-supervisor/services
|
2022-11-02 18:56:48 +00:00
|
|
|
- ./test/data/root:/mnt/root
|
2023-02-21 06:11:27 +00:00
|
|
|
- ./test/data/root/mnt/boot:/mnt/boot
|
2022-11-02 18:56:48 +00:00
|
|
|
- ./test/lib/wait-for-it.sh:/wait-for-it.sh
|
|
|
|
tmpfs:
|
2022-11-08 23:41:52 +00:00
|
|
|
- /data # sqlite3 database
|
2023-10-02 19:47:50 +00:00
|
|
|
- /mnt/root/tmp
|
2022-08-22 23:54:21 +00:00
|
|
|
|
2023-08-02 15:21:11 +00:00
|
|
|
# The service setup
|
|
|
|
mock-systemd:
|
|
|
|
image: ghcr.io/balena-os/mock-systemd-bus
|
|
|
|
# Necessary to run systemd in a container
|
|
|
|
privileged: true
|
2022-09-29 20:52:29 +00:00
|
|
|
volumes:
|
2023-08-02 15:21:11 +00:00
|
|
|
- dbus:/shared/dbus
|
2022-09-29 20:52:29 +00:00
|
|
|
environment:
|
2023-08-02 15:21:11 +00:00
|
|
|
DBUS_SYSTEM_BUS_ADDRESS: unix:path=/shared/dbus/system_bus_socket
|
|
|
|
MOCK_SYSTEMD_UNITS: openvpn.service avahi.socket
|
2022-08-25 17:12:53 +00:00
|
|
|
|
2022-08-22 23:54:21 +00:00
|
|
|
docker:
|
2024-04-23 23:21:52 +00:00
|
|
|
image: docker:dind
|
2022-10-31 21:31:43 +00:00
|
|
|
stop_grace_period: 3s
|
2022-08-22 23:54:21 +00:00
|
|
|
privileged: true
|
|
|
|
environment:
|
|
|
|
DOCKER_TLS_CERTDIR: ''
|
2022-11-02 18:56:48 +00:00
|
|
|
command: --tls=false # --debug
|
2022-08-22 23:54:21 +00:00
|
|
|
|
2024-04-23 23:21:52 +00:00
|
|
|
mdns:
|
|
|
|
image: ydkn/avahi:latest
|
|
|
|
# This hostname should be resolved
|
|
|
|
hostname: my-device
|
|
|
|
|
2022-08-22 23:54:21 +00:00
|
|
|
sut:
|
|
|
|
# Build the supervisor code for development and testing
|
|
|
|
build:
|
|
|
|
context: ./
|
|
|
|
dockerfile: Dockerfile.template
|
|
|
|
target: test
|
|
|
|
args:
|
|
|
|
# Change this if testing in another architecture
|
2022-09-29 20:52:29 +00:00
|
|
|
ARCH: ${ARCH:-amd64}
|
2022-11-02 18:56:48 +00:00
|
|
|
command:
|
|
|
|
[
|
|
|
|
'./test/lib/wait-for-it.sh',
|
|
|
|
'--supervisor',
|
|
|
|
'--',
|
|
|
|
'npm',
|
|
|
|
'run',
|
2023-04-27 14:08:40 +00:00
|
|
|
'test:integration',
|
2022-11-02 18:56:48 +00:00
|
|
|
]
|
2022-08-22 23:54:21 +00:00
|
|
|
depends_on:
|
2023-04-27 14:08:40 +00:00
|
|
|
- balena-supervisor-sut
|
2022-08-22 23:54:21 +00:00
|
|
|
- docker
|
2023-08-02 15:21:11 +00:00
|
|
|
- mock-systemd
|
2024-04-23 23:21:52 +00:00
|
|
|
- mdns
|
2022-10-31 21:31:43 +00:00
|
|
|
stop_grace_period: 3s
|
2022-09-29 20:52:29 +00:00
|
|
|
volumes:
|
2023-08-02 15:21:11 +00:00
|
|
|
- dbus:/shared/dbus
|
2024-03-06 06:53:58 +00:00
|
|
|
- tmp:/mnt/root/tmp/balena-supervisor/services
|
2022-08-22 23:54:21 +00:00
|
|
|
# Set required supervisor configuration variables here
|
|
|
|
environment:
|
|
|
|
DOCKER_HOST: tcp://docker:2375
|
2023-08-02 15:21:11 +00:00
|
|
|
DBUS_SYSTEM_BUS_ADDRESS: unix:path=/shared/dbus/system_bus_socket
|
2023-04-27 14:08:40 +00:00
|
|
|
BALENA_SUPERVISOR_ADDRESS: http://balena-supervisor-sut:48484
|
2022-08-24 20:02:19 +00:00
|
|
|
# Required by migrations
|
2023-02-21 06:11:27 +00:00
|
|
|
CONFIG_MOUNT_POINT: /mnt/boot/config.json
|
|
|
|
# Required to set mountpoints normally set in entry.sh
|
|
|
|
ROOT_MOUNTPOINT: /mnt/root
|
2022-08-25 17:12:53 +00:00
|
|
|
BOOT_MOUNTPOINT: /mnt/boot
|
2023-10-09 19:47:22 +00:00
|
|
|
HOST_OS_VERSION_PATH: /mnt/root/etc/os-release
|
2023-02-21 06:46:15 +00:00
|
|
|
STATE_MOUNTPOINT: /mnt/state
|
|
|
|
DATA_MOUNTPOINT: /mnt/data
|
|
|
|
DATABASE_PATH: /data/database.sqlite
|
2022-08-22 23:54:21 +00:00
|
|
|
# Set required mounts as tmpfs or volumes here
|
|
|
|
# if specific files need to be backed up between tests,
|
|
|
|
# make sure to add them to the `testfs` configuration under
|
|
|
|
# .mochapodrc.yml
|
|
|
|
tmpfs:
|
|
|
|
- /data
|
2022-08-24 20:02:19 +00:00
|
|
|
- /mnt/root
|
2023-02-21 06:11:27 +00:00
|
|
|
- /mnt/boot
|
2023-02-21 06:46:15 +00:00
|
|
|
- /mnt/state
|
|
|
|
- /mnt/data
|
2022-09-29 20:52:29 +00:00
|
|
|
|
|
|
|
volumes:
|
2024-03-06 06:53:58 +00:00
|
|
|
# Use tmpfs to avoid files remaining between runs
|
2022-09-29 20:52:29 +00:00
|
|
|
dbus:
|
|
|
|
driver_opts:
|
2024-03-06 06:53:58 +00:00
|
|
|
type: tmpfs
|
|
|
|
device: tmpfs
|
|
|
|
tmp:
|
|
|
|
driver_opts:
|
2022-09-29 20:52:29 +00:00
|
|
|
type: tmpfs
|
|
|
|
device: tmpfs
|