-
Notifications
You must be signed in to change notification settings - Fork 63
/
docker-compose.test.yml
116 lines (110 loc) · 3.08 KB
/
docker-compose.test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
version: '2.3'
services:
balena-supervisor-sut:
build:
context: ./
dockerfile: Dockerfile.template
args:
ARCH: ${ARCH:-amd64}
command: ['/wait-for-it.sh', '--', '/usr/src/app/entry.sh']
stop_grace_period: 3s
# Use bridge networking for the tests
environment:
DOCKER_HOST: tcp://docker:2375
DBUS_SYSTEM_BUS_ADDRESS: unix:path=/shared/dbus/system_bus_socket
# Required to skip device mounting in test env
TEST: 1
depends_on:
- docker
- mock-systemd
volumes:
- dbus:/shared/dbus
- tmp:/mnt/root/tmp/balena-supervisor/services
- ./test/data/root:/mnt/root
- ./test/data/root/mnt/boot:/mnt/boot
- ./test/lib/wait-for-it.sh:/wait-for-it.sh
tmpfs:
- /data # sqlite3 database
- /mnt/root/tmp
# The service setup
mock-systemd:
image: ghcr.io/balena-os/mock-systemd-bus
# Necessary to run systemd in a container
privileged: true
volumes:
- dbus:/shared/dbus
environment:
DBUS_SYSTEM_BUS_ADDRESS: unix:path=/shared/dbus/system_bus_socket
MOCK_SYSTEMD_UNITS: openvpn.service avahi.socket
docker:
image: docker:dind
stop_grace_period: 3s
privileged: true
environment:
DOCKER_TLS_CERTDIR: ''
command: --tls=false # --debug
mdns:
image: ydkn/avahi:latest
# This hostname should be resolved
hostname: my-device
sut:
# Build the supervisor code for development and testing
build:
context: ./
dockerfile: Dockerfile.template
target: test
args:
# Change this if testing in another architecture
ARCH: ${ARCH:-amd64}
command:
[
'./test/lib/wait-for-it.sh',
'--supervisor',
'--',
'npm',
'run',
'test:integration',
]
depends_on:
- balena-supervisor-sut
- docker
- mock-systemd
- mdns
stop_grace_period: 3s
volumes:
- dbus:/shared/dbus
- tmp:/mnt/root/tmp/balena-supervisor/services
# Set required supervisor configuration variables here
environment:
DOCKER_HOST: tcp://docker:2375
DBUS_SYSTEM_BUS_ADDRESS: unix:path=/shared/dbus/system_bus_socket
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
ROOT_MOUNTPOINT: /mnt/root
BOOT_MOUNTPOINT: /mnt/boot
HOST_OS_VERSION_PATH: /mnt/root/etc/os-release
STATE_MOUNTPOINT: /mnt/state
DATA_MOUNTPOINT: /mnt/data
DATABASE_PATH: /data/database.sqlite
# 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
- /mnt/root
- /mnt/boot
- /mnt/state
- /mnt/data
volumes:
# Use tmpfs to avoid files remaining between runs
dbus:
driver_opts:
type: tmpfs
device: tmpfs
tmp:
driver_opts:
type: tmpfs
device: tmpfs