balena-supervisor/test/00-init.spec.ts
Miguel Casqueira cd0d53c39d Add more test coverage for compose/images
Closes: #1492
Change-type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-11-03 13:08:41 -05:00

37 lines
917 B
TypeScript

process.env.ROOT_MOUNTPOINT = './test/data';
process.env.BOOT_MOUNTPOINT = '/mnt/boot';
process.env.CONFIG_JSON_PATH = '/config.json';
process.env.DATABASE_PATH = './test/data/database.sqlite';
process.env.DATABASE_PATH_2 = './test/data/database2.sqlite';
process.env.DATABASE_PATH_3 = './test/data/database3.sqlite';
process.env.LED_FILE = './test/data/led_file';
import * as fs from 'fs';
// Make sure they are no database files left over from
// previous runs
try {
fs.unlinkSync(process.env.DATABASE_PATH);
} catch {
/* noop */
}
try {
fs.unlinkSync(process.env.DATABASE_PATH_2);
} catch {
/* noop */
}
try {
fs.unlinkSync(process.env.DATABASE_PATH_3);
} catch {
/* noop */
}
fs.writeFileSync(
'./test/data/config.json',
fs.readFileSync('./test/data/testconfig.json'),
);
import './lib/mocked-dbus';
import './lib/mocked-dockerode';
import './lib/mocked-iptables';
import './lib/mocked-event-tracker';