mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 06:07:57 +00:00
28c5a44e71
Controlled by BALENA_HOST_FIREWALL_MODE, the firewall can either be 'on' or 'off'. - In the 'off' state, all traffic is allowed. - In the 'on' state, only traffic for the core services provided by Balena is allowed. Change-type: patch Signed-off-by: Rich Bayliss <rich@balena.io>
62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
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 './lib/mocked-iptables';
|
|
|
|
import * as dbus from 'dbus';
|
|
import { DBusError, DBusInterface } from 'dbus';
|
|
import { stub } from 'sinon';
|
|
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'),
|
|
);
|
|
|
|
stub(dbus, 'getBus').returns({
|
|
getInterface: (
|
|
_serviceName: string,
|
|
_objectPath: string,
|
|
_interfaceName: string,
|
|
interfaceCb: (err: null | DBusError, iface: DBusInterface) => void,
|
|
) => {
|
|
interfaceCb(null, {
|
|
Get: (
|
|
_unitName: string,
|
|
_property: string,
|
|
getCb: (err: null | Error, value: unknown) => void,
|
|
) => {
|
|
getCb(null, 'this is the value');
|
|
},
|
|
GetUnit: (
|
|
_unitName: string,
|
|
getUnitCb: (err: null | Error, unitPath: string) => void,
|
|
) => {
|
|
getUnitCb(null, 'this is the unit path');
|
|
},
|
|
} as any);
|
|
},
|
|
} as any);
|