mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 21:57:54 +00:00
Refactor test suite to use tsconfig paths
This replaces all relative paths in the test suite (e.g `../src/compose/service.ts`) with the aliased path configured through tsconfig. This is a big change but it doesn't affect any functionality
This commit is contained in:
parent
71eaa3327e
commit
382cdb0cfa
@ -1,5 +1,5 @@
|
||||
import { expect } from 'chai';
|
||||
import * as constants from '~/src-lib/constants';
|
||||
import * as constants from '~/lib/constants';
|
||||
|
||||
describe('constants', function () {
|
||||
it('has the correct configJsonPathOnHost', () =>
|
||||
|
@ -2,9 +2,9 @@ import * as Bluebird from 'bluebird';
|
||||
import * as Knex from 'knex';
|
||||
|
||||
import { expect } from 'chai';
|
||||
import prepare = require('./lib/prepare');
|
||||
import * as constants from '../src/lib/constants';
|
||||
import { exists } from '../src/lib/fs-utils';
|
||||
import prepare = require('~/test-lib/prepare');
|
||||
import * as constants from '~/lib/constants';
|
||||
import { exists } from '~/lib/fs-utils';
|
||||
|
||||
async function createOldDatabase(path: string) {
|
||||
const knex = Knex({
|
||||
@ -49,16 +49,16 @@ describe('Database Migrations', () => {
|
||||
after(() => {
|
||||
// @ts-ignore
|
||||
constants.databasePath = process.env.DATABASE_PATH;
|
||||
delete require.cache[require.resolve('../src/db')];
|
||||
delete require.cache[require.resolve('~/src/db')];
|
||||
});
|
||||
|
||||
it('creates a database at the path passed on creation', async () => {
|
||||
const databasePath = process.env.DATABASE_PATH_2!;
|
||||
// @ts-ignore
|
||||
constants.databasePath = databasePath;
|
||||
delete require.cache[require.resolve('../src/db')];
|
||||
delete require.cache[require.resolve('~/src/db')];
|
||||
|
||||
const testDb = await import('../src/db');
|
||||
const testDb = await import('~/src/db');
|
||||
await testDb.initialized;
|
||||
expect(await exists(databasePath)).to.be.true;
|
||||
});
|
||||
@ -69,8 +69,8 @@ describe('Database Migrations', () => {
|
||||
const knexForDB = await createOldDatabase(databasePath);
|
||||
// @ts-ignore
|
||||
constants.databasePath = databasePath;
|
||||
delete require.cache[require.resolve('../src/db')];
|
||||
const testDb = await import('../src/db');
|
||||
delete require.cache[require.resolve('~/src/db')];
|
||||
const testDb = await import('~/src/db');
|
||||
await testDb.initialized;
|
||||
await Bluebird.all([
|
||||
expect(knexForDB.schema.hasColumn('app', 'appId')).to.eventually.be.true,
|
||||
@ -97,11 +97,11 @@ describe('Database Migrations', () => {
|
||||
});
|
||||
|
||||
describe('Database', () => {
|
||||
let db: typeof import('../src/db');
|
||||
let db: typeof import('~/src/db');
|
||||
|
||||
before(async () => {
|
||||
await prepare();
|
||||
db = await import('../src/db');
|
||||
db = await import('~/src/db');
|
||||
});
|
||||
it('initializes correctly, running the migrations', () => {
|
||||
return expect(db.initialized).to.be.fulfilled;
|
||||
|
@ -3,12 +3,12 @@ import { promises as fs } from 'fs';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import prepare = require('./lib/prepare');
|
||||
import * as conf from '../src/config';
|
||||
import prepare = require('~/test-lib/prepare');
|
||||
import * as conf from '~/src/config';
|
||||
|
||||
import constants = require('../src/lib/constants');
|
||||
import { SchemaTypeKey } from '../src/config/schema-type';
|
||||
import { fnSchema } from '../src/config/functions';
|
||||
import constants = require('~/lib/constants');
|
||||
import { SchemaTypeKey } from '~/src/config/schema-type';
|
||||
import { fnSchema } from '~/src/config/functions';
|
||||
|
||||
describe('Config', () => {
|
||||
before(async () => {
|
||||
|
@ -1,25 +1,22 @@
|
||||
import { expect } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import { StatusCodeError, UpdatesLockedError } from '../src/lib/errors';
|
||||
import * as dockerUtils from '../src/lib/docker-utils';
|
||||
import * as config from '../src/config';
|
||||
import * as imageManager from '../src/compose/images';
|
||||
import { ConfigTxt } from '../src/config/backends/config-txt';
|
||||
import * as deviceState from '../src/device-state';
|
||||
import * as deviceConfig from '../src/device-config';
|
||||
import {
|
||||
loadTargetFromFile,
|
||||
appsJsonBackup,
|
||||
} from '../src/device-state/preload';
|
||||
import Service from '../src/compose/service';
|
||||
import { intialiseContractRequirements } from '../src/lib/contracts';
|
||||
import * as updateLock from '../src/lib/update-lock';
|
||||
import * as fsUtils from '../src/lib/fs-utils';
|
||||
import { TargetState } from '../src/types';
|
||||
import { StatusCodeError, UpdatesLockedError } from '~/lib/errors';
|
||||
import * as dockerUtils from '~/lib/docker-utils';
|
||||
import * as config from '~/src/config';
|
||||
import * as imageManager from '~/src/compose/images';
|
||||
import { ConfigTxt } from '~/src/config/backends/config-txt';
|
||||
import * as deviceState from '~/src/device-state';
|
||||
import * as deviceConfig from '~/src/device-config';
|
||||
import { loadTargetFromFile, appsJsonBackup } from '~/src/device-state/preload';
|
||||
import Service from '~/src/compose/service';
|
||||
import { intialiseContractRequirements } from '~/lib/contracts';
|
||||
import * as updateLock from '~/lib/update-lock';
|
||||
import * as fsUtils from '~/lib/fs-utils';
|
||||
import { TargetState } from '~/src/types';
|
||||
|
||||
import * as dbHelper from './lib/db-helper';
|
||||
import log from '../src/lib/supervisor-console';
|
||||
import * as dbHelper from '~/test-lib/db-helper';
|
||||
import log from '~/lib/supervisor-console';
|
||||
|
||||
const mockedInitialConfig = {
|
||||
RESIN_SUPERVISOR_CONNECTIVITY_CHECK: 'true',
|
||||
|
@ -8,9 +8,9 @@ import {
|
||||
DeviceName,
|
||||
NumericIdentifier,
|
||||
TargetApps,
|
||||
} from '../src/types';
|
||||
} from '~/src/types';
|
||||
|
||||
import * as validation from '../src/lib/validation';
|
||||
import * as validation from '~/lib/validation';
|
||||
|
||||
describe('validation', () => {
|
||||
describe('checkBooleanish', () => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { promises as fs } from 'fs';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import blink = require('../src/lib/blink');
|
||||
import constants = require('../src/lib/constants');
|
||||
import blink = require('~/lib/blink');
|
||||
import constants = require('~/lib/constants');
|
||||
|
||||
describe('blink', () => {
|
||||
it('is a blink function', () => expect(blink).to.be.a('function'));
|
||||
|
@ -2,16 +2,16 @@ import { SinonStub, stub, spy, SinonSpy } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
import * as mixpanel from 'mixpanel';
|
||||
|
||||
import log from '../src/lib/supervisor-console';
|
||||
import supervisorVersion = require('../src/lib/supervisor-version');
|
||||
import * as config from '../src/config';
|
||||
import log from '~/lib/supervisor-console';
|
||||
import supervisorVersion = require('~/lib/supervisor-version');
|
||||
import * as config from '~/src/config';
|
||||
|
||||
describe('EventTracker', () => {
|
||||
let logEventStub: SinonStub;
|
||||
before(() => {
|
||||
logEventStub = stub(log, 'event');
|
||||
|
||||
delete require.cache[require.resolve('../src/event-tracker')];
|
||||
delete require.cache[require.resolve('~/src/event-tracker')];
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -24,7 +24,7 @@ describe('EventTracker', () => {
|
||||
|
||||
describe('Unmanaged', () => {
|
||||
let configStub: SinonStub;
|
||||
let eventTracker: typeof import('../src/event-tracker');
|
||||
let eventTracker: typeof import('~/src/event-tracker');
|
||||
|
||||
before(async () => {
|
||||
configStub = stub(config, 'getMany').returns(
|
||||
@ -36,13 +36,13 @@ describe('EventTracker', () => {
|
||||
}) as any,
|
||||
);
|
||||
|
||||
eventTracker = await import('../src/event-tracker');
|
||||
eventTracker = await import('~/src/event-tracker');
|
||||
});
|
||||
|
||||
after(() => {
|
||||
configStub.restore();
|
||||
|
||||
delete require.cache[require.resolve('../src/event-tracker')];
|
||||
delete require.cache[require.resolve('~/src/event-tracker')];
|
||||
});
|
||||
|
||||
it('initializes in unmanaged mode', () => {
|
||||
@ -62,7 +62,7 @@ describe('EventTracker', () => {
|
||||
});
|
||||
|
||||
describe('Init', () => {
|
||||
let eventTracker: typeof import('../src/event-tracker');
|
||||
let eventTracker: typeof import('~/src/event-tracker');
|
||||
let configStub: SinonStub;
|
||||
let mixpanelSpy: SinonSpy;
|
||||
|
||||
@ -78,14 +78,14 @@ describe('EventTracker', () => {
|
||||
|
||||
mixpanelSpy = spy(mixpanel, 'init');
|
||||
|
||||
eventTracker = await import('../src/event-tracker');
|
||||
eventTracker = await import('~/src/event-tracker');
|
||||
});
|
||||
|
||||
after(() => {
|
||||
configStub.restore();
|
||||
mixpanelSpy.restore();
|
||||
|
||||
delete require.cache[require.resolve('../src/event-tracker')];
|
||||
delete require.cache[require.resolve('~/src/event-tracker')];
|
||||
});
|
||||
|
||||
it('initializes a mixpanel client when not in unmanaged mode', () => {
|
||||
@ -100,7 +100,7 @@ describe('EventTracker', () => {
|
||||
});
|
||||
|
||||
describe('Managed', () => {
|
||||
let eventTracker: typeof import('../src/event-tracker');
|
||||
let eventTracker: typeof import('~/src/event-tracker');
|
||||
let configStub: SinonStub;
|
||||
let mixpanelStub: SinonStub;
|
||||
|
||||
@ -119,7 +119,7 @@ describe('EventTracker', () => {
|
||||
track: stub(),
|
||||
} as any);
|
||||
|
||||
eventTracker = await import('../src/event-tracker');
|
||||
eventTracker = await import('~/src/event-tracker');
|
||||
await eventTracker.initialized;
|
||||
});
|
||||
|
||||
@ -127,7 +127,7 @@ describe('EventTracker', () => {
|
||||
configStub.restore();
|
||||
mixpanelStub.restore();
|
||||
|
||||
delete require.cache[require.resolve('../src/event-tracker')];
|
||||
delete require.cache[require.resolve('~/src/event-tracker')];
|
||||
});
|
||||
|
||||
it('calls the mixpanel client track function with the event, properties and uuid as distinct_id', async () => {
|
||||
@ -189,21 +189,21 @@ describe('EventTracker', () => {
|
||||
});
|
||||
|
||||
describe('Rate limiting', () => {
|
||||
let eventTracker: typeof import('../src/event-tracker');
|
||||
let eventTracker: typeof import('~/src/event-tracker');
|
||||
let mixpanelStub: SinonStub;
|
||||
|
||||
before(async () => {
|
||||
mixpanelStub = stub(mixpanel, 'init').returns({
|
||||
track: stub(),
|
||||
} as any);
|
||||
eventTracker = await import('../src/event-tracker');
|
||||
eventTracker = await import('~/src/event-tracker');
|
||||
await eventTracker.initialized;
|
||||
});
|
||||
|
||||
after(() => {
|
||||
mixpanelStub.restore();
|
||||
|
||||
delete require.cache[require.resolve('../src/event-tracker')];
|
||||
delete require.cache[require.resolve('~/src/event-tracker')];
|
||||
});
|
||||
|
||||
it('should rate limit events of the same type', async () => {
|
||||
|
@ -3,8 +3,8 @@ import * as os from 'os';
|
||||
import { stub, spy } from 'sinon';
|
||||
|
||||
import { expect } from 'chai';
|
||||
import Log from '../src/lib/supervisor-console';
|
||||
import * as network from '../src/network';
|
||||
import Log from '~/lib/supervisor-console';
|
||||
import * as network from '~/src/network';
|
||||
|
||||
describe('network', () => {
|
||||
describe('getIPAddresses', () => {
|
||||
|
@ -4,22 +4,22 @@ import { Server } from 'net';
|
||||
import { SinonSpy, SinonStub, spy, stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import prepare = require('./lib/prepare');
|
||||
import * as config from '../src/config';
|
||||
import * as deviceState from '../src/device-state';
|
||||
import Log from '../src/lib/supervisor-console';
|
||||
import balenaAPI = require('./lib/mocked-balena-api');
|
||||
import { schema } from '../src/config/schema';
|
||||
import ConfigJsonConfigBackend from '../src/config/configJson';
|
||||
import * as TargetState from '../src/device-state/target-state';
|
||||
import * as ApiHelper from '../src/lib/api-helper';
|
||||
import supervisorVersion = require('../src/lib/supervisor-version');
|
||||
import * as eventTracker from '../src/event-tracker';
|
||||
import prepare = require('~/test-lib/prepare');
|
||||
import * as config from '~/src/config';
|
||||
import * as deviceState from '~/src/device-state';
|
||||
import Log from '~/lib/supervisor-console';
|
||||
import balenaAPI = require('~/test-lib/mocked-balena-api');
|
||||
import { schema } from '~/src/config/schema';
|
||||
import ConfigJsonConfigBackend from '~/src/config/configJson';
|
||||
import * as TargetState from '~/src/device-state/target-state';
|
||||
import * as ApiHelper from '~/lib/api-helper';
|
||||
import supervisorVersion = require('~/lib/supervisor-version');
|
||||
import * as eventTracker from '~/src/event-tracker';
|
||||
|
||||
import { TypedError } from 'typed-error';
|
||||
import { DeviceNotFoundError } from '../src/lib/errors';
|
||||
import { DeviceNotFoundError } from '~/lib/errors';
|
||||
|
||||
let ApiBinder: typeof import('../src/api-binder');
|
||||
let ApiBinder: typeof import('~/src/api-binder');
|
||||
|
||||
class ExpectedError extends TypedError {}
|
||||
|
||||
@ -40,7 +40,7 @@ const initModels = async (obj: Dictionary<any>, filename: string) => {
|
||||
},
|
||||
} as any;
|
||||
|
||||
ApiBinder = await import('../src/api-binder');
|
||||
ApiBinder = await import('~/src/api-binder');
|
||||
await ApiBinder.initialized;
|
||||
obj.apiBinder = ApiBinder;
|
||||
|
||||
@ -61,7 +61,7 @@ describe('ApiBinder', () => {
|
||||
let server: Server;
|
||||
|
||||
before(async () => {
|
||||
delete require.cache[require.resolve('../src/api-binder')];
|
||||
delete require.cache[require.resolve('~/src/api-binder')];
|
||||
|
||||
spy(balenaAPI.balenaBackend!, 'registerHandler');
|
||||
server = balenaAPI.listen(3000);
|
||||
@ -405,7 +405,7 @@ describe('ApiBinder', () => {
|
||||
});
|
||||
|
||||
it('fails when stateReportHealthy is false', async () => {
|
||||
const currentState = await import('../src/api-binder/report');
|
||||
const currentState = await import('~/src/api-binder/report');
|
||||
|
||||
configStub.resolves({
|
||||
unmanaged: false,
|
||||
|
@ -5,11 +5,11 @@ import * as Promise from 'bluebird';
|
||||
import { expect } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import { ContainerLogs } from '../src/logging/container';
|
||||
import * as config from '../src/config';
|
||||
import { ContainerLogs } from '~/src/logging/container';
|
||||
import * as config from '~/src/config';
|
||||
|
||||
describe('Logger', function () {
|
||||
let logger: typeof import('../src/logger');
|
||||
let logger: typeof import('~/src/logger');
|
||||
let configStub: sinon.SinonStub;
|
||||
|
||||
beforeEach(async function () {
|
||||
@ -36,8 +36,8 @@ describe('Logger', function () {
|
||||
}),
|
||||
);
|
||||
// delete the require cache for the logger module so we can force a refresh
|
||||
delete require.cache[require.resolve('../src/logger')];
|
||||
logger = await import('../src/logger');
|
||||
delete require.cache[require.resolve('~/src/logger')];
|
||||
logger = await import('~/src/logger');
|
||||
await logger.initialized;
|
||||
});
|
||||
|
||||
@ -47,7 +47,7 @@ describe('Logger', function () {
|
||||
});
|
||||
|
||||
after(function () {
|
||||
delete require.cache[require.resolve('../src/logger')];
|
||||
delete require.cache[require.resolve('~/src/logger')];
|
||||
});
|
||||
|
||||
it('waits the grace period before sending any logs', function () {
|
||||
|
@ -4,19 +4,19 @@ import * as path from 'path';
|
||||
import { SinonStub, stub, spy, SinonSpy, restore } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as deviceConfig from '../src/device-config';
|
||||
import * as fsUtils from '../src/lib/fs-utils';
|
||||
import * as logger from '../src/logger';
|
||||
import { Extlinux } from '../src/config/backends/extlinux';
|
||||
import { ConfigTxt } from '../src/config/backends/config-txt';
|
||||
import { Odmdata } from '../src/config/backends/odmdata';
|
||||
import { ConfigFs } from '../src/config/backends/config-fs';
|
||||
import { SplashImage } from '../src/config/backends/splash-image';
|
||||
import * as constants from '../src/lib/constants';
|
||||
import log from '../src/lib/supervisor-console';
|
||||
import { fnSchema } from '../src/config/functions';
|
||||
import * as deviceConfig from '~/src/device-config';
|
||||
import * as fsUtils from '~/lib/fs-utils';
|
||||
import * as logger from '~/src/logger';
|
||||
import { Extlinux } from '~/src/config/backends/extlinux';
|
||||
import { ConfigTxt } from '~/src/config/backends/config-txt';
|
||||
import { Odmdata } from '~/src/config/backends/odmdata';
|
||||
import { ConfigFs } from '~/src/config/backends/config-fs';
|
||||
import { SplashImage } from '~/src/config/backends/splash-image';
|
||||
import * as constants from '~/lib/constants';
|
||||
import log from '~/lib/supervisor-console';
|
||||
import { fnSchema } from '~/src/config/functions';
|
||||
|
||||
import prepare = require('./lib/prepare');
|
||||
import prepare = require('~/test-lib/prepare');
|
||||
import mock = require('mock-fs');
|
||||
|
||||
const extlinuxBackend = new Extlinux();
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { expect } from 'chai';
|
||||
import * as conversion from '../src/lib/conversions';
|
||||
import * as conversion from '~/lib/conversions';
|
||||
|
||||
describe('conversions', function () {
|
||||
describe('envArrayToObject', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { PortMap, PortRange } from '../src/compose/ports';
|
||||
import { PortMap, PortRange } from '~/src/compose/ports';
|
||||
import { expect } from 'chai';
|
||||
|
||||
// Force cast `PortMap` as a public version so we can test it
|
||||
@ -298,8 +298,8 @@ describe('Ports', function () {
|
||||
|
||||
describe('Running container comparison', () =>
|
||||
it('should not consider order when comparing current and target state', function () {
|
||||
const portBindings = require('./data/ports/not-ascending/port-bindings.json');
|
||||
const compose = require('./data/ports/not-ascending/compose.json');
|
||||
const portBindings = require('~/test-data/ports/not-ascending/port-bindings.json');
|
||||
const compose = require('~/test-data/ports/not-ascending/compose.json');
|
||||
const portMapsCurrent = PortMap.fromDockerOpts(portBindings);
|
||||
const portMapsTarget = PortMap.fromComposePorts(compose.ports);
|
||||
|
||||
|
@ -2,14 +2,14 @@ import { stub } from 'sinon';
|
||||
import * as _ from 'lodash';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as config from '../src/config';
|
||||
import * as configUtils from '../src/config/utils';
|
||||
import { ExtraUEnv } from '../src/config/backends/extra-uEnv';
|
||||
import { Extlinux } from '../src/config/backends/extlinux';
|
||||
import { ConfigTxt } from '../src/config/backends/config-txt';
|
||||
import { ConfigFs } from '../src/config/backends/config-fs';
|
||||
import { SplashImage } from '../src/config/backends/splash-image';
|
||||
import { ConfigBackend } from '../src/config/backends/backend';
|
||||
import * as config from '~/src/config';
|
||||
import * as configUtils from '~/src/config/utils';
|
||||
import { ExtraUEnv } from '~/src/config/backends/extra-uEnv';
|
||||
import { Extlinux } from '~/src/config/backends/extlinux';
|
||||
import { ConfigTxt } from '~/src/config/backends/config-txt';
|
||||
import { ConfigFs } from '~/src/config/backends/config-fs';
|
||||
import { SplashImage } from '~/src/config/backends/splash-image';
|
||||
import { ConfigBackend } from '~/src/config/backends/backend';
|
||||
|
||||
describe('Config Utilities', () => {
|
||||
it('gets list of supported backends', async () => {
|
||||
|
@ -2,12 +2,12 @@ import { SinonStub, stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import * as apiBinder from '../src/api-binder';
|
||||
import * as applicationManager from '../src/compose/application-manager';
|
||||
import * as deviceState from '../src/device-state';
|
||||
import * as constants from '../src/lib/constants';
|
||||
import { docker } from '../src/lib/docker-utils';
|
||||
import { Supervisor } from '../src/supervisor';
|
||||
import * as apiBinder from '~/src/api-binder';
|
||||
import * as applicationManager from '~/src/compose/application-manager';
|
||||
import * as deviceState from '~/src/device-state';
|
||||
import * as constants from '~/src/lib/constants';
|
||||
import { docker } from '~/lib/docker-utils';
|
||||
import { Supervisor } from '~/src/supervisor';
|
||||
|
||||
describe('Startup', () => {
|
||||
let startStub: SinonStub;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { expect } from 'chai';
|
||||
import * as ComposeUtils from '../src/compose/utils';
|
||||
import * as ComposeUtils from '~/src/compose/utils';
|
||||
|
||||
describe('Composition utilities', () =>
|
||||
it('Should correctly camel case the configuration', function () {
|
||||
|
@ -2,14 +2,14 @@ import { expect } from 'chai';
|
||||
import { spy } from 'sinon';
|
||||
import * as supertest from 'supertest';
|
||||
|
||||
import mockedAPI = require('./lib/mocked-device-api');
|
||||
import * as apiBinder from '../src/api-binder';
|
||||
import * as deviceState from '../src/device-state';
|
||||
import Log from '../src/lib/supervisor-console';
|
||||
import SupervisorAPI from '../src/supervisor-api';
|
||||
import * as apiKeys from '../src/lib/api-keys';
|
||||
import * as db from '../src/db';
|
||||
import { cloudApiKey } from '../src/lib/api-keys';
|
||||
import mockedAPI = require('~/test-lib/mocked-device-api');
|
||||
import * as apiBinder from '~/src/api-binder';
|
||||
import * as deviceState from '~/src/device-state';
|
||||
import Log from '~/lib/supervisor-console';
|
||||
import SupervisorAPI from '~/src/supervisor-api';
|
||||
import * as apiKeys from '~/lib/api-keys';
|
||||
import * as db from '~/src/db';
|
||||
import { cloudApiKey } from '~/lib/api-keys';
|
||||
|
||||
const mockedOptions = {
|
||||
listenPort: 54321,
|
||||
|
@ -2,13 +2,13 @@ import { expect } from 'chai';
|
||||
import * as Docker from 'dockerode';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import * as db from '../src/db';
|
||||
import { docker } from '../src/lib/docker-utils';
|
||||
import * as db from '~/src/db';
|
||||
import { docker } from '~/lib/docker-utils';
|
||||
import LocalModeManager, {
|
||||
EngineSnapshot,
|
||||
EngineSnapshotRecord,
|
||||
} from '../src/local-mode';
|
||||
import ShortStackError from './lib/errors';
|
||||
} from '~/src/local-mode';
|
||||
import ShortStackError from '~/test-lib/errors';
|
||||
|
||||
describe('LocalModeManager', () => {
|
||||
let localMode: LocalModeManager;
|
||||
|
@ -2,15 +2,15 @@ import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import * as semver from 'semver';
|
||||
|
||||
import * as constants from '../src/lib/constants';
|
||||
import * as constants from '~/lib/constants';
|
||||
import {
|
||||
containerContractsFulfilled,
|
||||
intialiseContractRequirements,
|
||||
validateContract,
|
||||
} from '../src/lib/contracts';
|
||||
import * as osRelease from '../src/lib/os-release';
|
||||
import supervisorVersion = require('../src/lib/supervisor-version');
|
||||
import * as fsUtils from '../src/lib/fs-utils';
|
||||
} from '~/lib/contracts';
|
||||
import * as osRelease from '~/lib/os-release';
|
||||
import supervisorVersion = require('~/lib/supervisor-version');
|
||||
import * as fsUtils from '~/lib/fs-utils';
|
||||
|
||||
describe('Container contracts', () => {
|
||||
before(() => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { expect } from 'chai';
|
||||
import { stub } from 'sinon';
|
||||
|
||||
import * as dockerUtils from '../src/lib/docker-utils';
|
||||
import * as dockerUtils from '~/lib/docker-utils';
|
||||
|
||||
describe('Deltas', () => {
|
||||
it('should correctly detect a V2 delta', async () => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import constants = require('../src/lib/constants');
|
||||
import { spawnJournalctl } from '../src/lib/journald';
|
||||
import constants = require('~/lib/constants');
|
||||
import { spawnJournalctl } from '~/lib/journald';
|
||||
|
||||
describe('journald', () => {
|
||||
let spawn: SinonStub;
|
||||
|
@ -3,8 +3,8 @@ import { stripIndent } from 'common-tags';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as fsUtils from '../src/lib/fs-utils';
|
||||
import { Extlinux } from '../src/config/backends/extlinux';
|
||||
import * as fsUtils from '~/lib/fs-utils';
|
||||
import { Extlinux } from '~/src/config/backends/extlinux';
|
||||
|
||||
describe('Extlinux Configuration', () => {
|
||||
const backend = new Extlinux();
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { expect } from 'chai';
|
||||
import { isRight } from 'fp-ts/lib/Either';
|
||||
import * as sinon from 'sinon';
|
||||
import App from '../src/compose/app';
|
||||
import Network from '../src/compose/network';
|
||||
import * as config from '../src/config';
|
||||
import * as dbFormat from '../src/device-state/db-format';
|
||||
import log from '../src/lib/supervisor-console';
|
||||
import { TargetApps } from '../src/types/state';
|
||||
import * as dbHelper from './lib/db-helper';
|
||||
import App from '~/src/compose/app';
|
||||
import Network from '~/src/compose/network';
|
||||
import * as config from '~/src/config';
|
||||
import * as dbFormat from '~/src/device-state/db-format';
|
||||
import log from '~/lib/supervisor-console';
|
||||
import { TargetApps } from '~/src/types/state';
|
||||
import * as dbHelper from '~/test-lib/db-helper';
|
||||
|
||||
function getDefaultNetwork(appId: number) {
|
||||
return {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { expect } from 'chai';
|
||||
import { AppendDirective } from '../src/config/backends/extlinux-file';
|
||||
import { AppendDirective } from '~/src/config/backends/extlinux-file';
|
||||
|
||||
describe('APPEND directive', () => {
|
||||
const supportedConfigValues = ['isolcpus'];
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { expect } from 'chai';
|
||||
import { FDTDirective } from '../src/config/backends/extlinux-file';
|
||||
import { FDTDirective } from '~/src/config/backends/extlinux-file';
|
||||
|
||||
describe('FDT directive', () => {
|
||||
const directive = new FDTDirective();
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { expect } from 'chai';
|
||||
import { testWithData } from './lib/mocked-dockerode';
|
||||
import { testWithData } from '~/test-lib/mocked-dockerode';
|
||||
|
||||
import * as dockerUtils from '../src/lib/docker-utils';
|
||||
import * as dockerUtils from '~/lib/docker-utils';
|
||||
|
||||
describe('Docker Utils', () => {
|
||||
describe('Supervisor Address', () => {
|
||||
|
@ -3,9 +3,9 @@ import { stripIndent } from 'common-tags';
|
||||
import { SinonStub, spy, stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as fsUtils from '../src/lib/fs-utils';
|
||||
import Log from '../src/lib/supervisor-console';
|
||||
import { ExtraUEnv } from '../src/config/backends/extra-uEnv';
|
||||
import * as fsUtils from '~/lib/fs-utils';
|
||||
import Log from '~/lib/supervisor-console';
|
||||
import { ExtraUEnv } from '~/src/config/backends/extra-uEnv';
|
||||
|
||||
describe('extra_uEnv Configuration', () => {
|
||||
const backend = new ExtraUEnv();
|
||||
|
@ -2,18 +2,18 @@ import _ = require('lodash');
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as Docker from 'dockerode';
|
||||
import { docker } from '../src/lib/docker-utils';
|
||||
import { docker } from '~/lib/docker-utils';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import * as config from '../src/config';
|
||||
import * as firewall from '../src/lib/firewall';
|
||||
import * as logger from '../src/logger';
|
||||
import * as iptablesMock from './lib/mocked-iptables';
|
||||
import * as targetStateCache from '../src/device-state/target-state-cache';
|
||||
import * as config from '~/src/config';
|
||||
import * as firewall from '~/lib/firewall';
|
||||
import * as logger from '~/src/logger';
|
||||
import * as iptablesMock from '~/test-lib/mocked-iptables';
|
||||
import * as targetStateCache from '~/src/device-state/target-state-cache';
|
||||
|
||||
import constants = require('../src/lib/constants');
|
||||
import { RuleAction, Rule } from '../src/lib/iptables';
|
||||
import { log } from '../src/lib/supervisor-console';
|
||||
import constants = require('~/lib/constants');
|
||||
import { RuleAction, Rule } from '~/lib/iptables';
|
||||
import { log } from '~/lib/supervisor-console';
|
||||
|
||||
describe('Host Firewall', function () {
|
||||
const dockerStubs: Dictionary<sinon.SinonStub> = {};
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as osRelease from '../src/lib/os-release';
|
||||
import * as osRelease from '~/lib/os-release';
|
||||
|
||||
const OS_RELEASE_PATH = 'test/data/etc/os-release-tx2';
|
||||
|
||||
|
@ -3,8 +3,8 @@ import { promises as fs } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import Log from '../src/lib/supervisor-console';
|
||||
import { Odmdata } from '../src/config/backends/odmdata';
|
||||
import Log from '~/lib/supervisor-console';
|
||||
import { Odmdata } from '~/src/config/backends/odmdata';
|
||||
|
||||
describe('ODMDATA Configuration', () => {
|
||||
const backend = new Odmdata();
|
||||
@ -12,7 +12,7 @@ describe('ODMDATA Configuration', () => {
|
||||
let logErrorStub: SinonStub;
|
||||
// @ts-ignore accessing private vluae
|
||||
const previousConfigPath = Odmdata.bootConfigPath;
|
||||
const testConfigPath = resolve(__dirname, 'data/boot0.img');
|
||||
const testConfigPath = resolve(process.cwd(), 'test/data/boot0.img');
|
||||
|
||||
before(() => {
|
||||
// @ts-ignore setting value of private variable
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as commitStore from '../src/compose/commit';
|
||||
import * as db from '../src/db';
|
||||
import * as commitStore from '~/src/compose/commit';
|
||||
import * as db from '~/src/db';
|
||||
|
||||
describe('compose/commit', () => {
|
||||
before(async () => await db.initialized);
|
||||
|
@ -4,14 +4,14 @@ import * as _ from 'lodash';
|
||||
import rewire = require('rewire');
|
||||
import { expect } from 'chai';
|
||||
|
||||
import { sleep } from './lib/helpers';
|
||||
import * as TargetState from '../src/device-state/target-state';
|
||||
import Log from '../src/lib/supervisor-console';
|
||||
import * as request from '../src/lib/request';
|
||||
import * as deviceConfig from '../src/device-config';
|
||||
import { UpdatesLockedError } from '../src/lib/errors';
|
||||
import { sleep } from '~/test-lib/helpers';
|
||||
import * as TargetState from '~/src/device-state/target-state';
|
||||
import Log from '~/lib/supervisor-console';
|
||||
import * as request from '~/lib/request';
|
||||
import * as deviceConfig from '~/src/device-config';
|
||||
import { UpdatesLockedError } from '~/lib/errors';
|
||||
|
||||
const deviceState = rewire('../src/device-state');
|
||||
const deviceState = rewire('~/src/device-state');
|
||||
|
||||
const stateEndpointBody = {
|
||||
local: {
|
||||
|
@ -13,29 +13,29 @@ import * as supertest from 'supertest';
|
||||
import * as path from 'path';
|
||||
import { promises as fs } from 'fs';
|
||||
|
||||
import { exists, unlinkAll } from '../src/lib/fs-utils';
|
||||
import * as appMock from './lib/application-state-mock';
|
||||
import * as mockedDockerode from './lib/mocked-dockerode';
|
||||
import mockedAPI = require('./lib/mocked-device-api');
|
||||
import sampleResponses = require('./data/device-api-responses.json');
|
||||
import * as config from '../src/config';
|
||||
import * as logger from '../src/logger';
|
||||
import SupervisorAPI from '../src/supervisor-api';
|
||||
import * as apiBinder from '../src/api-binder';
|
||||
import * as deviceState from '../src/device-state';
|
||||
import * as apiKeys from '../src/lib/api-keys';
|
||||
import * as dbus from '../src/lib/dbus';
|
||||
import * as updateLock from '../src/lib/update-lock';
|
||||
import * as TargetState from '../src/device-state/target-state';
|
||||
import * as targetStateCache from '../src/device-state/target-state-cache';
|
||||
import blink = require('../src/lib/blink');
|
||||
import constants = require('../src/lib/constants');
|
||||
import * as deviceAPI from '../src/device-api/common';
|
||||
import { UpdatesLockedError } from '../src/lib/errors';
|
||||
import { SchemaTypeKey } from '../src/config/schema-type';
|
||||
import log from '../src/lib/supervisor-console';
|
||||
import * as applicationManager from '../src/compose/application-manager';
|
||||
import App from '../src/compose/app';
|
||||
import { exists, unlinkAll } from '~/lib/fs-utils';
|
||||
import * as appMock from '~/test-lib/application-state-mock';
|
||||
import * as mockedDockerode from '~/test-lib/mocked-dockerode';
|
||||
import mockedAPI = require('~/test-lib/mocked-device-api');
|
||||
import sampleResponses = require('~/test-data/device-api-responses.json');
|
||||
import * as config from '~/src/config';
|
||||
import * as logger from '~/src/logger';
|
||||
import SupervisorAPI from '~/src/supervisor-api';
|
||||
import * as apiBinder from '~/src/api-binder';
|
||||
import * as deviceState from '~/src/device-state';
|
||||
import * as apiKeys from '~/lib/api-keys';
|
||||
import * as dbus from '~/lib/dbus';
|
||||
import * as updateLock from '~/lib/update-lock';
|
||||
import * as TargetState from '~/src/device-state/target-state';
|
||||
import * as targetStateCache from '~/src/device-state/target-state-cache';
|
||||
import blink = require('~/lib/blink');
|
||||
import constants = require('~/lib/constants');
|
||||
import * as deviceAPI from '~/src/device-api/common';
|
||||
import { UpdatesLockedError } from '~/lib/errors';
|
||||
import { SchemaTypeKey } from '~/src/config/schema-type';
|
||||
import log from '~/lib/supervisor-console';
|
||||
import * as applicationManager from '~/src/compose/application-manager';
|
||||
import App from '~/src/compose/app';
|
||||
|
||||
describe('SupervisorAPI [V1 Endpoints]', () => {
|
||||
let api: SupervisorAPI;
|
||||
|
@ -3,22 +3,22 @@ import { stub, SinonStub, spy, SinonSpy } from 'sinon';
|
||||
import * as supertest from 'supertest';
|
||||
import * as Bluebird from 'bluebird';
|
||||
|
||||
import sampleResponses = require('./data/device-api-responses.json');
|
||||
import mockedAPI = require('./lib/mocked-device-api');
|
||||
import * as apiBinder from '../src/api-binder';
|
||||
import * as deviceState from '../src/device-state';
|
||||
import SupervisorAPI from '../src/supervisor-api';
|
||||
import * as serviceManager from '../src/compose/service-manager';
|
||||
import * as images from '../src/compose/images';
|
||||
import * as apiKeys from '../src/lib/api-keys';
|
||||
import * as config from '../src/config';
|
||||
import * as updateLock from '../src/lib/update-lock';
|
||||
import * as targetStateCache from '../src/device-state/target-state-cache';
|
||||
import * as mockedDockerode from './lib/mocked-dockerode';
|
||||
import * as applicationManager from '../src/compose/application-manager';
|
||||
import * as logger from '../src/logger';
|
||||
import sampleResponses = require('~/test-data/device-api-responses.json');
|
||||
import mockedAPI = require('~/test-lib/mocked-device-api');
|
||||
import * as apiBinder from '~/src/api-binder';
|
||||
import * as deviceState from '~/src/device-state';
|
||||
import SupervisorAPI from '~/src/supervisor-api';
|
||||
import * as serviceManager from '~/src/compose/service-manager';
|
||||
import * as images from '~/src/compose/images';
|
||||
import * as apiKeys from '~/lib/api-keys';
|
||||
import * as config from '~/src/config';
|
||||
import * as updateLock from '~/lib/update-lock';
|
||||
import * as targetStateCache from '~/src/device-state/target-state-cache';
|
||||
import * as mockedDockerode from '~/test-lib/mocked-dockerode';
|
||||
import * as applicationManager from '~/src/compose/application-manager';
|
||||
import * as logger from '~/src/logger';
|
||||
|
||||
import { UpdatesLockedError } from '../src/lib/errors';
|
||||
import { UpdatesLockedError } from '~/lib/errors';
|
||||
|
||||
describe('SupervisorAPI [V2 Endpoints]', () => {
|
||||
let serviceManagerMock: SinonStub;
|
||||
|
@ -2,9 +2,9 @@ import { promises as fs } from 'fs';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
|
||||
import { expect } from 'chai';
|
||||
import * as fsUtils from '../src/lib/fs-utils';
|
||||
import { SplashImage } from '../src/config/backends/splash-image';
|
||||
import log from '../src/lib/supervisor-console';
|
||||
import * as fsUtils from '~/lib/fs-utils';
|
||||
import { SplashImage } from '~/src/config/backends/splash-image';
|
||||
import log from '~/lib/supervisor-console';
|
||||
|
||||
describe('Splash image configuration', () => {
|
||||
const backend = new SplashImage();
|
||||
|
@ -57,6 +57,6 @@ fs.writeFileSync(
|
||||
fs.readFileSync('./test/data/testconfig.json'),
|
||||
);
|
||||
|
||||
import '../lib/mocked-dbus';
|
||||
import '../lib/mocked-dockerode';
|
||||
import '../lib/mocked-iptables';
|
||||
import '~/test-lib/mocked-dbus';
|
||||
import '~/test-lib/mocked-dockerode';
|
||||
import '~/test-lib/mocked-iptables';
|
||||
|
@ -1,11 +1,11 @@
|
||||
import * as networkManager from '../../src/compose/network-manager';
|
||||
import * as volumeManager from '../../src/compose/volume-manager';
|
||||
import * as serviceManager from '../../src/compose/service-manager';
|
||||
import * as imageManager from '../../src/compose/images';
|
||||
import * as networkManager from '~/src/compose/network-manager';
|
||||
import * as volumeManager from '~/src/compose/volume-manager';
|
||||
import * as serviceManager from '~/src/compose/service-manager';
|
||||
import * as imageManager from '~/src/compose/images';
|
||||
|
||||
import Service from '../../src/compose/service';
|
||||
import Network from '../../src/compose/network';
|
||||
import Volume from '../../src/compose/volume';
|
||||
import Service from '~/src/compose/service';
|
||||
import Network from '~/src/compose/network';
|
||||
import Volume from '~/src/compose/volume';
|
||||
|
||||
const originalVolGetAll = volumeManager.getAll;
|
||||
const originalSvcGetAll = serviceManager.getAll;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as constants from '../../src/lib/constants';
|
||||
import * as db from '../../src/db';
|
||||
import * as constants from '~/lib/constants';
|
||||
import * as db from '~/src/db';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
// Creates a test database and returns a query builder
|
||||
@ -13,7 +13,7 @@ export async function createDB() {
|
||||
constants.databasePath = process.env.DATABASE_PATH;
|
||||
|
||||
// Cleanup the module cache in order to have it reloaded in the local context
|
||||
delete require.cache[require.resolve('../../src/db')];
|
||||
delete require.cache[require.resolve('~/src/db')];
|
||||
|
||||
// Initialize the database module
|
||||
await db.initialized;
|
||||
@ -76,7 +76,7 @@ export async function createDB() {
|
||||
|
||||
// Cleanup the module cache in order to have it reloaded
|
||||
// correctly next time it's used
|
||||
delete require.cache[require.resolve('../../src/db')];
|
||||
delete require.cache[require.resolve('~/src/db')];
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ import * as _ from 'lodash';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { QueryBuilder } from 'knex';
|
||||
|
||||
import * as db from '../../src/db';
|
||||
import { Image } from '../../src/compose/images';
|
||||
import * as db from '~/src/db';
|
||||
import { Image } from '~/src/compose/images';
|
||||
|
||||
let modelStub: SinonStub | null = null;
|
||||
// MOCKED MODELS
|
||||
|
@ -2,21 +2,21 @@ import * as _ from 'lodash';
|
||||
import { Router } from 'express';
|
||||
import rewire = require('rewire');
|
||||
|
||||
import { unlinkAll } from '../../src/lib/fs-utils';
|
||||
import * as applicationManager from '../../src/compose/application-manager';
|
||||
import * as serviceManager from '../../src/compose/service-manager';
|
||||
import * as volumeManager from '../../src/compose/volume-manager';
|
||||
import * as commitStore from '../../src/compose/commit';
|
||||
import * as config from '../../src/config';
|
||||
import * as db from '../../src/db';
|
||||
import { createV1Api } from '../../src/device-api/v1';
|
||||
import { createV2Api } from '../../src/device-api/v2';
|
||||
import * as deviceState from '../../src/device-state';
|
||||
import SupervisorAPI from '../../src/supervisor-api';
|
||||
import { Service } from '../../src/compose/service';
|
||||
import { Image } from '../../src/compose/images';
|
||||
import { unlinkAll } from '~/lib/fs-utils';
|
||||
import * as applicationManager from '~/src/compose/application-manager';
|
||||
import * as serviceManager from '~/src/compose/service-manager';
|
||||
import * as volumeManager from '~/src/compose/volume-manager';
|
||||
import * as commitStore from '~/src/compose/commit';
|
||||
import * as config from '~/src/config';
|
||||
import * as db from '~/src/db';
|
||||
import { createV1Api } from '~/src/device-api/v1';
|
||||
import { createV2Api } from '~/src/device-api/v2';
|
||||
import * as deviceState from '~/src/device-state';
|
||||
import SupervisorAPI from '~/src/supervisor-api';
|
||||
import { Service } from '~/src/compose/service';
|
||||
import { Image } from '~/src/compose/images';
|
||||
|
||||
const apiBinder = rewire('../../src/api-binder');
|
||||
const apiBinder = rewire('~/src/api-binder');
|
||||
|
||||
const DB_PATH = './test/data/supervisor-api.sqlite';
|
||||
|
||||
|
@ -3,8 +3,8 @@ import { expect } from 'chai';
|
||||
import { stub } from 'sinon';
|
||||
import * as childProcess from 'child_process';
|
||||
|
||||
import * as firewall from '../../src/lib/firewall';
|
||||
import * as iptables from '../../src/lib/iptables';
|
||||
import * as firewall from '~/lib/firewall';
|
||||
import * as iptables from '~/lib/iptables';
|
||||
import { EventEmitter } from 'events';
|
||||
import { Writable } from 'stream';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as fs from 'fs';
|
||||
import * as db from '../../src/db';
|
||||
import * as config from '../../src/config';
|
||||
import * as db from '~/src/db';
|
||||
import * as config from '~/src/config';
|
||||
|
||||
export = async function () {
|
||||
await db.initialized;
|
||||
|
@ -1,16 +1,16 @@
|
||||
import { expect } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import App from '../../../src/compose/app';
|
||||
import App from '~/src/compose/app';
|
||||
import {
|
||||
CompositionStep,
|
||||
CompositionStepAction,
|
||||
} from '../../../src/compose/composition-steps';
|
||||
import { Image } from '../../../src/compose/images';
|
||||
import Network from '../../../src/compose/network';
|
||||
import Service from '../../../src/compose/service';
|
||||
import { ServiceComposeConfig } from '../../../src/compose/types/service';
|
||||
import Volume from '../../../src/compose/volume';
|
||||
import log from '../../../src/lib/supervisor-console';
|
||||
} from '~/src/compose/composition-steps';
|
||||
import { Image } from '~/src/compose/images';
|
||||
import Network from '~/src/compose/network';
|
||||
import Service from '~/src/compose/service';
|
||||
import { ServiceComposeConfig } from '~/src/compose/types/service';
|
||||
import Volume from '~/src/compose/volume';
|
||||
import log from '~/lib/supervisor-console';
|
||||
|
||||
const defaultContext = {
|
||||
localMode: false,
|
||||
|
@ -1,20 +1,20 @@
|
||||
import { expect } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import { stub } from 'sinon';
|
||||
import App from '../../../src/compose/app';
|
||||
import * as applicationManager from '../../../src/compose/application-manager';
|
||||
import * as imageManager from '../../../src/compose/images';
|
||||
import * as serviceManager from '../../../src/compose/service-manager';
|
||||
import { Image } from '../../../src/compose/images';
|
||||
import Network from '../../../src/compose/network';
|
||||
import * as networkManager from '../../../src/compose/network-manager';
|
||||
import Service from '../../../src/compose/service';
|
||||
import { ServiceComposeConfig } from '../../../src/compose/types/service';
|
||||
import Volume from '../../../src/compose/volume';
|
||||
import log from '../../../src/lib/supervisor-console';
|
||||
import { InstancedAppState } from '../../../src/types/state';
|
||||
import App from '~/src/compose/app';
|
||||
import * as applicationManager from '~/src/compose/application-manager';
|
||||
import * as imageManager from '~/src/compose/images';
|
||||
import * as serviceManager from '~/src/compose/service-manager';
|
||||
import { Image } from '~/src/compose/images';
|
||||
import Network from '~/src/compose/network';
|
||||
import * as networkManager from '~/src/compose/network-manager';
|
||||
import Service from '~/src/compose/service';
|
||||
import { ServiceComposeConfig } from '~/src/compose/types/service';
|
||||
import Volume from '~/src/compose/volume';
|
||||
import log from '~/lib/supervisor-console';
|
||||
import { InstancedAppState } from '~/src/types/state';
|
||||
|
||||
import * as dbHelper from '../../lib/db-helper';
|
||||
import * as dbHelper from '~/test-lib/db-helper';
|
||||
|
||||
const DEFAULT_NETWORK = Network.fromComposeObject('default', 1, 'appuuid', {});
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as imageManager from '../../../src/compose/images';
|
||||
import * as dbHelper from '../../lib/db-helper';
|
||||
import { createImage, withMockerode } from '../../lib/mockerode';
|
||||
import * as imageManager from '~/src/compose/images';
|
||||
import * as dbHelper from '~/test-lib/db-helper';
|
||||
import { createImage, withMockerode } from '~/test-lib/mockerode';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import log from '../../../src/lib/supervisor-console';
|
||||
import log from '~/lib/supervisor-console';
|
||||
|
||||
// TODO: this code is duplicated in multiple tests
|
||||
// create a test module with all helper functions like this
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { expect } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import { Network } from '../../../src/compose/network';
|
||||
import { Network } from '~/src/compose/network';
|
||||
import { NetworkInspectInfo } from 'dockerode';
|
||||
import { createNetwork, withMockerode } from '../../lib/mockerode';
|
||||
import { createNetwork, withMockerode } from '~/test-lib/mockerode';
|
||||
|
||||
import { log } from '../../../src/lib/supervisor-console';
|
||||
import { log } from '~/lib/supervisor-console';
|
||||
|
||||
describe('compose/network', () => {
|
||||
describe('creating a network from a compose object', () => {
|
||||
|
@ -2,31 +2,31 @@ import * as _ from 'lodash';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { createContainer } from '../../lib/mockerode';
|
||||
import { createContainer } from '~/test-lib/mockerode';
|
||||
|
||||
import Service from '../../../src/compose/service';
|
||||
import Volume from '../../../src/compose/volume';
|
||||
import * as ServiceT from '../../../src/compose/types/service';
|
||||
import * as constants from '../../../src/lib/constants';
|
||||
import * as apiKeys from '../../../src/lib/api-keys';
|
||||
import Service from '~/src/compose/service';
|
||||
import Volume from '~/src/compose/volume';
|
||||
import * as ServiceT from '~/src/compose/types/service';
|
||||
import * as constants from '~/lib/constants';
|
||||
import * as apiKeys from '~/lib/api-keys';
|
||||
|
||||
import log from '../../../src/lib/supervisor-console';
|
||||
import log from '~/lib/supervisor-console';
|
||||
|
||||
const configs = {
|
||||
simple: {
|
||||
compose: require('../../data/docker-states/simple/compose.json'),
|
||||
imageInfo: require('../../data/docker-states/simple/imageInfo.json'),
|
||||
inspect: require('../../data/docker-states/simple/inspect.json'),
|
||||
compose: require('~/test-data/docker-states/simple/compose.json'),
|
||||
imageInfo: require('~/test-data/docker-states/simple/imageInfo.json'),
|
||||
inspect: require('~/test-data/docker-states/simple/inspect.json'),
|
||||
},
|
||||
entrypoint: {
|
||||
compose: require('../../data/docker-states/entrypoint/compose.json'),
|
||||
imageInfo: require('../../data/docker-states/entrypoint/imageInfo.json'),
|
||||
inspect: require('../../data/docker-states/entrypoint/inspect.json'),
|
||||
compose: require('~/test-data/docker-states/entrypoint/compose.json'),
|
||||
imageInfo: require('~/test-data/docker-states/entrypoint/imageInfo.json'),
|
||||
inspect: require('~/test-data/docker-states/entrypoint/inspect.json'),
|
||||
},
|
||||
networkModeService: {
|
||||
compose: require('../../data/docker-states/network-mode-service/compose.json'),
|
||||
imageInfo: require('../../data/docker-states/network-mode-service/imageInfo.json'),
|
||||
inspect: require('../../data/docker-states/network-mode-service/inspect.json'),
|
||||
compose: require('~/test-data/docker-states/network-mode-service/compose.json'),
|
||||
imageInfo: require('~/test-data/docker-states/network-mode-service/imageInfo.json'),
|
||||
inspect: require('~/test-data/docker-states/network-mode-service/inspect.json'),
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -5,10 +5,10 @@ import {
|
||||
createVolume,
|
||||
createContainer,
|
||||
withMockerode,
|
||||
} from '../../lib/mockerode';
|
||||
import * as volumeManager from '../../../src/compose/volume-manager';
|
||||
import log from '../../../src/lib/supervisor-console';
|
||||
import Volume from '../../../src/compose/volume';
|
||||
} from '~/test-lib/mockerode';
|
||||
import * as volumeManager from '~/src/compose/volume-manager';
|
||||
import log from '~/lib/supervisor-console';
|
||||
import Volume from '~/src/compose/volume';
|
||||
|
||||
describe('compose/volume-manager', () => {
|
||||
describe('Retrieving volumes from the engine', () => {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import Volume from '../../../src/compose/volume';
|
||||
import * as logTypes from '../../../src/lib/log-types';
|
||||
import * as logger from '../../../src/logger';
|
||||
import Volume from '~/src/compose/volume';
|
||||
import * as logTypes from '~/lib/log-types';
|
||||
import * as logger from '~/src/logger';
|
||||
|
||||
import { createVolume, withMockerode } from '../../lib/mockerode';
|
||||
import { createVolume, withMockerode } from '~/test-lib/mockerode';
|
||||
|
||||
describe('compose/volume', () => {
|
||||
describe('creating a volume from a compose object', () => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { assert, expect } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import { StatusError } from '../../../src/lib/errors';
|
||||
import { withBackoff, OnFailureInfo } from '../../../src/lib/backoff';
|
||||
import { StatusError } from '~/lib/errors';
|
||||
import { withBackoff, OnFailureInfo } from '~/lib/backoff';
|
||||
|
||||
const DEFAULT_OPTIONS = {
|
||||
maxRetries: 5,
|
||||
|
@ -4,8 +4,8 @@ import { promises as fs } from 'fs';
|
||||
import { spy, SinonSpy } from 'sinon';
|
||||
import mock = require('mock-fs');
|
||||
|
||||
import * as fsUtils from '../../../src/lib/fs-utils';
|
||||
import { rootMountPoint } from '../../../src/lib/constants';
|
||||
import * as fsUtils from '~/lib/fs-utils';
|
||||
import { rootMountPoint } from '~/lib/constants';
|
||||
|
||||
describe('lib/fs-utils', () => {
|
||||
const testFileName1 = 'file.1';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { expect } from 'chai';
|
||||
import { equals, diff, prune, shallowDiff } from '../../../src/lib/json';
|
||||
import { equals, diff, prune, shallowDiff } from '~/lib/json';
|
||||
|
||||
describe('JSON utils', () => {
|
||||
describe('equals', () => {
|
||||
|
@ -3,10 +3,10 @@ import { isRight } from 'fp-ts/lib/Either';
|
||||
import * as sinon from 'sinon';
|
||||
import * as nock from 'nock';
|
||||
|
||||
import { TargetState } from '../../../src/types';
|
||||
import * as config from '../../../src/config';
|
||||
import * as legacy from '../../../src/lib/legacy';
|
||||
import log from '../../../src/lib/supervisor-console';
|
||||
import { TargetState } from '~/src/types';
|
||||
import * as config from '~/src/config';
|
||||
import * as legacy from '~/lib/legacy';
|
||||
import log from '~/lib/supervisor-console';
|
||||
|
||||
describe('lib/legacy', () => {
|
||||
before(async () => {
|
||||
|
@ -4,9 +4,9 @@ import { stub, SinonStub } from 'sinon';
|
||||
import { promises as fs } from 'fs';
|
||||
import mock = require('mock-fs');
|
||||
|
||||
import * as lockfile from '../../../src/lib/lockfile';
|
||||
import * as fsUtils from '../../../src/lib/fs-utils';
|
||||
import { BASE_LOCK_DIR, LOCKFILE_UID } from '../../../src/lib/update-lock';
|
||||
import * as lockfile from '~/lib/lockfile';
|
||||
import * as fsUtils from '~/lib/fs-utils';
|
||||
import { BASE_LOCK_DIR, LOCKFILE_UID } from '~/lib/update-lock';
|
||||
|
||||
describe('lib/lockfile', () => {
|
||||
const lockPath = `${BASE_LOCK_DIR}/1234567/one/updates.lock`;
|
||||
|
@ -3,8 +3,8 @@ import { SinonStub, stub } from 'sinon';
|
||||
import { promises as fs } from 'fs';
|
||||
import * as systeminformation from 'systeminformation';
|
||||
|
||||
import * as fsUtils from '../../../src/lib/fs-utils';
|
||||
import * as sysInfo from '../../../src/lib/system-info';
|
||||
import * as fsUtils from '~/lib/fs-utils';
|
||||
import * as sysInfo from '~/lib/system-info';
|
||||
|
||||
describe('System information', () => {
|
||||
before(() => {
|
||||
|
@ -4,12 +4,12 @@ import * as path from 'path';
|
||||
import { promises as fs } from 'fs';
|
||||
import mockFs = require('mock-fs');
|
||||
|
||||
import * as updateLock from '../../../src/lib/update-lock';
|
||||
import * as constants from '../../../src/lib/constants';
|
||||
import { UpdatesLockedError } from '../../../src/lib/errors';
|
||||
import * as config from '../../../src/config';
|
||||
import * as lockfile from '../../../src/lib/lockfile';
|
||||
import * as fsUtils from '../../../src/lib/fs-utils';
|
||||
import * as updateLock from '~/lib/update-lock';
|
||||
import * as constants from '~/lib/constants';
|
||||
import { UpdatesLockedError } from '~/lib/errors';
|
||||
import * as config from '~/src/config';
|
||||
import * as lockfile from '~/lib/lockfile';
|
||||
import * as fsUtils from '~/lib/fs-utils';
|
||||
|
||||
describe('lib/update-lock', () => {
|
||||
const appId = 1234567;
|
||||
|
Loading…
Reference in New Issue
Block a user