Make images module a singleton

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2020-06-09 14:43:45 +01:00
parent d3fae47c8a
commit 2b3dc2fbce
11 changed files with 648 additions and 636 deletions

View File

@ -6,7 +6,7 @@ import Knex = require('knex');
import { ServiceAction } from './device-api/common'; import { ServiceAction } from './device-api/common';
import { DeviceStatus, InstancedAppState } from './types/state'; import { DeviceStatus, InstancedAppState } from './types/state';
import ImageManager, { Image } from './compose/images'; import type { Image } from './compose/images';
import ServiceManager from './compose/service-manager'; import ServiceManager from './compose/service-manager';
import DeviceState from './device-state'; import DeviceState from './device-state';
@ -51,7 +51,6 @@ class ApplicationManager extends EventEmitter {
public services: ServiceManager; public services: ServiceManager;
public volumes: VolumeManager; public volumes: VolumeManager;
public networks: NetworkManager; public networks: NetworkManager;
public images: ImageManager;
public proxyvisor: any; public proxyvisor: any;
public timeSpentFetching: number; public timeSpentFetching: number;

View File

@ -28,7 +28,7 @@ import { TargetStateAccessor } from './device-state/target-state-cache';
import { ServiceManager } from './compose/service-manager'; import { ServiceManager } from './compose/service-manager';
import { Service } from './compose/service'; import { Service } from './compose/service';
import { Images } from './compose/images'; import * as Images from './compose/images';
import { NetworkManager } from './compose/network-manager'; import { NetworkManager } from './compose/network-manager';
import { Network } from './compose/network'; import { Network } from './compose/network';
import { VolumeManager } from './compose/volume-manager'; import { VolumeManager } from './compose/volume-manager';
@ -172,12 +172,11 @@ export class ApplicationManager extends EventEmitter {
this.reportOptionalContainers = this.reportOptionalContainers.bind(this); this.reportOptionalContainers = this.reportOptionalContainers.bind(this);
this.deviceState = deviceState; this.deviceState = deviceState;
this.apiBinder = apiBinder; this.apiBinder = apiBinder;
this.images = new Images();
this.services = new ServiceManager(); this.services = new ServiceManager();
this.networks = new NetworkManager(); this.networks = new NetworkManager();
this.volumes = new VolumeManager(); this.volumes = new VolumeManager();
this.proxyvisor = new Proxyvisor({ this.proxyvisor = new Proxyvisor({
images: this.images,
applications: this, applications: this,
}); });
this.localModeManager = new LocalModeManager(); this.localModeManager = new LocalModeManager();
@ -188,19 +187,12 @@ export class ApplicationManager extends EventEmitter {
this.targetStateWrapper = new TargetStateAccessor(this); this.targetStateWrapper = new TargetStateAccessor(this);
config.on('change', (changedConfig) => {
if (changedConfig.appUpdatePollInterval) {
this.images.appUpdatePollInterval = changedConfig.appUpdatePollInterval;
}
});
this.actionExecutors = compositionSteps.getExecutors({ this.actionExecutors = compositionSteps.getExecutors({
lockFn: this._lockingIfNecessary, lockFn: this._lockingIfNecessary,
services: this.services, services: this.services,
networks: this.networks, networks: this.networks,
volumes: this.volumes, volumes: this.volumes,
applications: this, applications: this,
images: this.images,
callbacks: { callbacks: {
containerStarted: (id) => { containerStarted: (id) => {
this._containerStarted[id] = true; this._containerStarted[id] = true;
@ -225,7 +217,7 @@ export class ApplicationManager extends EventEmitter {
this.proxyvisor.validActions, this.proxyvisor.validActions,
); );
this.router = createApplicationManagerRouter(this); this.router = createApplicationManagerRouter(this);
this.images.on('change', this.reportCurrentState); Images.on('change', this.reportCurrentState);
this.services.on('change', this.reportCurrentState); this.services.on('change', this.reportCurrentState);
} }
@ -234,12 +226,8 @@ export class ApplicationManager extends EventEmitter {
} }
init() { init() {
return config return Images.initialized
.get('appUpdatePollInterval') .then(() => Images.cleanupDatabase())
.then((interval) => {
this.images.appUpdatePollInterval = interval;
return this.images.cleanupDatabase();
})
.then(() => { .then(() => {
const cleanup = () => { const cleanup = () => {
return docker.listContainers({ all: true }).then((containers) => { return docker.listContainers({ all: true }).then((containers) => {
@ -271,7 +259,7 @@ export class ApplicationManager extends EventEmitter {
getStatus() { getStatus() {
return Promise.join( return Promise.join(
this.services.getStatus(), this.services.getStatus(),
this.images.getStatus(), Images.getStatus(),
config.get('currentCommit'), config.get('currentCommit'),
function (services, images, currentCommit) { function (services, images, currentCommit) {
const apps = {}; const apps = {};
@ -1006,7 +994,7 @@ export class ApplicationManager extends EventEmitter {
return service; return service;
}); });
return Promise.map(services, (service) => { return Promise.map(services, (service) => {
service.image = this.images.normalise(service.image); service.image = Images.normalise(service.image);
return Promise.props(service); return Promise.props(service);
}).then(function ($services) { }).then(function ($services) {
const dbApp = { const dbApp = {
@ -1026,7 +1014,7 @@ export class ApplicationManager extends EventEmitter {
createTargetService(service, opts) { createTargetService(service, opts) {
// The image class now returns a native promise, so wrap // The image class now returns a native promise, so wrap
// this in a bluebird promise until we convert this to typescript // this in a bluebird promise until we convert this to typescript
return Promise.resolve(this.images.inspectByName(service.image)) return Promise.resolve(Images.inspectByName(service.image))
.catchReturn(NotFoundError, undefined) .catchReturn(NotFoundError, undefined)
.then(function (imageInfo) { .then(function (imageInfo) {
const serviceOpts = { const serviceOpts = {
@ -1589,9 +1577,9 @@ export class ApplicationManager extends EventEmitter {
return config.get('localMode').then((localMode) => { return config.get('localMode').then((localMode) => {
return Promise.props({ return Promise.props({
cleanupNeeded: this.images.isCleanupNeeded(), cleanupNeeded: Images.isCleanupNeeded(),
availableImages: this.images.getAvailable(), availableImages: Images.getAvailable(),
downloading: this.images.getDownloadingImageIds(), downloading: Images.getDownloadingImageIds(),
supervisorNetworkReady: this.networks.supervisorNetworkReady(), supervisorNetworkReady: this.networks.supervisorNetworkReady(),
delta: config.get('delta'), delta: config.get('delta'),
containerIds: Promise.props(containerIdsByAppId), containerIds: Promise.props(containerIdsByAppId),

View File

@ -3,7 +3,8 @@ import * as _ from 'lodash';
import * as config from '../config'; import * as config from '../config';
import { ApplicationManager } from '../application-manager'; import { ApplicationManager } from '../application-manager';
import Images, { Image } from './images'; import type { Image } from './images';
import * as images from './images';
import Network from './network'; import Network from './network';
import Service from './service'; import Service from './service';
import ServiceManager from './service-manager'; import ServiceManager from './service-manager';
@ -139,7 +140,6 @@ export function getExecutors(app: {
networks: NetworkManager; networks: NetworkManager;
volumes: VolumeManager; volumes: VolumeManager;
applications: ApplicationManager; applications: ApplicationManager;
images: Images;
callbacks: CompositionCallbacks; callbacks: CompositionCallbacks;
}) { }) {
const executors: Executors<CompositionStepAction> = { const executors: Executors<CompositionStepAction> = {
@ -171,7 +171,7 @@ export function getExecutors(app: {
await app.services.kill(step.current); await app.services.kill(step.current);
app.callbacks.containerKilled(step.current.containerId); app.callbacks.containerKilled(step.current.containerId);
if (_.get(step, ['options', 'removeImage'])) { if (_.get(step, ['options', 'removeImage'])) {
await app.images.removeByDockerId(step.current.config.image); await images.removeByDockerId(step.current.config.image);
} }
}, },
); );
@ -241,7 +241,7 @@ export function getExecutors(app: {
app.callbacks.fetchStart(); app.callbacks.fetchStart();
const [fetchOpts, availableImages] = await Promise.all([ const [fetchOpts, availableImages] = await Promise.all([
config.get('fetchOptions'), config.get('fetchOptions'),
app.images.getAvailable(), images.getAvailable(),
]); ]);
const opts = { const opts = {
@ -249,7 +249,7 @@ export function getExecutors(app: {
...fetchOpts, ...fetchOpts,
}; };
await app.images.triggerFetch( await images.triggerFetch(
step.image, step.image,
opts, opts,
async (success) => { async (success) => {
@ -269,15 +269,15 @@ export function getExecutors(app: {
); );
}, },
removeImage: async (step) => { removeImage: async (step) => {
await app.images.remove(step.image); await images.remove(step.image);
}, },
saveImage: async (step) => { saveImage: async (step) => {
await app.images.save(step.image); await images.save(step.image);
}, },
cleanup: async () => { cleanup: async () => {
const localMode = await config.get('localMode'); const localMode = await config.get('localMode');
if (!localMode) { if (!localMode) {
await app.images.cleanup(); await images.cleanup();
} }
}, },
createNetwork: async (step) => { createNetwork: async (step) => {

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@ import Volume from '../compose/volume';
import * as config from '../config'; import * as config from '../config';
import * as db from '../db'; import * as db from '../db';
import * as logger from '../logger'; import * as logger from '../logger';
import * as images from '../compose/images';
import { spawnJournalctl } from '../lib/journald'; import { spawnJournalctl } from '../lib/journald';
import { import {
appNotFoundMessage, appNotFoundMessage,
@ -152,11 +153,11 @@ export function createV2Api(router: Router, applications: ApplicationManager) {
// maybe refactor this code // maybe refactor this code
Bluebird.join( Bluebird.join(
applications.services.getStatus(), applications.services.getStatus(),
applications.images.getStatus(), images.getStatus(),
db.models('app').select(['appId', 'commit', 'name']), db.models('app').select(['appId', 'commit', 'name']),
( (
services, services,
images, imgs,
apps: Array<{ appId: string; commit: string; name: string }>, apps: Array<{ appId: string; commit: string; name: string }>,
) => { ) => {
// Create an object which is keyed my application name // Create an object which is keyed my application name
@ -187,7 +188,7 @@ export function createV2Api(router: Router, applications: ApplicationManager) {
appNameById[appId] = app.name; appNameById[appId] = app.name;
}); });
images.forEach((img) => { imgs.forEach((img) => {
const appName = appNameById[img.appId]; const appName = appNameById[img.appId];
if (appName == null) { if (appName == null) {
log.warn( log.warn(
@ -406,7 +407,7 @@ export function createV2Api(router: Router, applications: ApplicationManager) {
let downloadProgressTotal = 0; let downloadProgressTotal = 0;
let downloads = 0; let downloads = 0;
const imagesStates = (await applications.images.getStatus()).map((img) => { const imagesStates = (await images.getStatus()).map((img) => {
if (img.downloadProgress != null) { if (img.downloadProgress != null) {
downloadProgressTotal += img.downloadProgress; downloadProgressTotal += img.downloadProgress;
downloads += 1; downloads += 1;

View File

@ -5,6 +5,7 @@ import { Image } from '../compose/images';
import DeviceState from '../device-state'; import DeviceState from '../device-state';
import * as config from '../config'; import * as config from '../config';
import * as eventTracker from '../event-tracker'; import * as eventTracker from '../event-tracker';
import * as images from '../compose/images';
import constants = require('../lib/constants'); import constants = require('../lib/constants');
import { AppsJsonParseError, EISDIR, ENOENT } from '../lib/errors'; import { AppsJsonParseError, EISDIR, ENOENT } from '../lib/errors';
@ -47,7 +48,7 @@ export async function loadTargetFromFile(
return; return;
} }
const images: Image[] = []; const imgs: Image[] = [];
const appIds = _.keys(preloadState.apps); const appIds = _.keys(preloadState.apps);
for (const appId of appIds) { for (const appId of appIds) {
const app = preloadState.apps[appId]; const app = preloadState.apps[appId];
@ -67,14 +68,14 @@ export async function loadTargetFromFile(
releaseId: app.releaseId, releaseId: app.releaseId,
appId, appId,
}; };
images.push(deviceState.applications.imageForService(svc)); imgs.push(deviceState.applications.imageForService(svc));
} }
} }
for (const image of images) { for (const image of imgs) {
const name = await deviceState.applications.images.normalise(image.name); const name = await images.normalise(image.name);
image.name = name; image.name = name;
await deviceState.applications.images.save(image); await images.save(image);
} }
const deviceConf = await deviceState.deviceConfig.getCurrent(); const deviceConf = await deviceState.deviceConfig.getCurrent();

View File

@ -14,6 +14,7 @@ import * as mkdirp from 'mkdirp';
import * as bodyParser from 'body-parser'; import * as bodyParser from 'body-parser';
import * as url from 'url'; import * as url from 'url';
import { normalise } from './compose/images';
import { log } from './lib/supervisor-console'; import { log } from './lib/supervisor-console';
import * as db from './db'; import * as db from './db';
import * as config from './config'; import * as config from './config';
@ -346,7 +347,7 @@ const createProxyvisorRouter = function (proxyvisor) {
}; };
export class Proxyvisor { export class Proxyvisor {
constructor({ images, applications }) { constructor({ applications }) {
this.bindToAPI = this.bindToAPI.bind(this); this.bindToAPI = this.bindToAPI.bind(this);
this.executeStepAction = this.executeStepAction.bind(this); this.executeStepAction = this.executeStepAction.bind(this);
this.getCurrentStates = this.getCurrentStates.bind(this); this.getCurrentStates = this.getCurrentStates.bind(this);
@ -362,7 +363,6 @@ export class Proxyvisor {
this.sendUpdate = this.sendUpdate.bind(this); this.sendUpdate = this.sendUpdate.bind(this);
this.sendDeleteHook = this.sendDeleteHook.bind(this); this.sendDeleteHook = this.sendDeleteHook.bind(this);
this.sendUpdates = this.sendUpdates.bind(this); this.sendUpdates = this.sendUpdates.bind(this);
this.images = images;
this.applications = applications; this.applications = applications;
this.acknowledgedState = {}; this.acknowledgedState = {};
this.lastRequestForDevice = {}; this.lastRequestForDevice = {};
@ -536,7 +536,7 @@ export class Proxyvisor {
normaliseDependentAppForDB(app) { normaliseDependentAppForDB(app) {
let image; let image;
if (app.image != null) { if (app.image != null) {
image = this.images.normalise(app.image); image = normalise(app.image);
} else { } else {
image = null; image = null;
} }

View File

@ -4,10 +4,12 @@ import * as _ from 'lodash';
import { SinonSpy, SinonStub, spy, stub } from 'sinon'; import { SinonSpy, SinonStub, spy, stub } from 'sinon';
import chai = require('./lib/chai-config'); import chai = require('./lib/chai-config');
import { StatusCodeError } from '../src/lib/errors';
import prepare = require('./lib/prepare'); import prepare = require('./lib/prepare');
import Log from '../src/lib/supervisor-console'; import Log from '../src/lib/supervisor-console';
import * as dockerUtils from '../src/lib/docker-utils'; import * as dockerUtils from '../src/lib/docker-utils';
import * as config from '../src/config'; import * as config from '../src/config';
import * as images from '../src/compose/images';
import { RPiConfigBackend } from '../src/config/backend'; import { RPiConfigBackend } from '../src/config/backend';
import DeviceState from '../src/device-state'; import DeviceState from '../src/device-state';
import { loadTargetFromFile } from '../src/device-state/preload'; import { loadTargetFromFile } from '../src/device-state/preload';
@ -209,6 +211,8 @@ const testTargetInvalid = {
describe('deviceState', () => { describe('deviceState', () => {
let deviceState: DeviceState; let deviceState: DeviceState;
const originalImagesSave = images.save;
const originalImagesInspect = images.inspectByName;
before(async () => { before(async () => {
await prepare(); await prepare();
@ -230,11 +234,15 @@ describe('deviceState', () => {
Promise.resolve('172.17.0.1'), Promise.resolve('172.17.0.1'),
); );
stub(deviceState.applications.images, 'inspectByName').callsFake(() => { // @ts-expect-error Assigning to a RO property
const err: any = new Error(); images.save = () => Promise.resolve();
// @ts-expect-error Assigning to a RO property
images.inspectByName = () => {
const err: StatusCodeError = new Error();
err.statusCode = 404; err.statusCode = 404;
return Promise.reject(err); return Promise.reject(err);
}); };
(deviceState as any).deviceConfig.configBackend = new RPiConfigBackend(); (deviceState as any).deviceConfig.configBackend = new RPiConfigBackend();
}); });
@ -242,12 +250,14 @@ describe('deviceState', () => {
after(() => { after(() => {
(Service as any).extendEnvVars.restore(); (Service as any).extendEnvVars.restore();
(dockerUtils.getNetworkGateway as sinon.SinonStub).restore(); (dockerUtils.getNetworkGateway as sinon.SinonStub).restore();
(deviceState.applications.images
.inspectByName as sinon.SinonStub).restore(); // @ts-expect-error Assigning to a RO property
images.save = originalImagesSave;
// @ts-expect-error Assigning to a RO property
images.inspectByName = originalImagesInspect;
}); });
it('loads a target state from an apps.json file and saves it as target state, then returns it', async () => { it('loads a target state from an apps.json file and saves it as target state, then returns it', async () => {
stub(deviceState.applications.images, 'save').returns(Promise.resolve());
stub(deviceState.deviceConfig, 'getCurrent').returns( stub(deviceState.deviceConfig, 'getCurrent').returns(
Promise.resolve(mockedInitialConfig), Promise.resolve(mockedInitialConfig),
); );
@ -272,13 +282,11 @@ describe('deviceState', () => {
JSON.parse(JSON.stringify(testTarget)), JSON.parse(JSON.stringify(testTarget)),
); );
} finally { } finally {
(deviceState.applications.images.save as sinon.SinonStub).restore();
(deviceState.deviceConfig.getCurrent as sinon.SinonStub).restore(); (deviceState.deviceConfig.getCurrent as sinon.SinonStub).restore();
} }
}); });
it('stores info for pinning a device after loading an apps.json with a pinDevice field', async () => { it('stores info for pinning a device after loading an apps.json with a pinDevice field', async () => {
stub(deviceState.applications.images, 'save').returns(Promise.resolve());
stub(deviceState.deviceConfig, 'getCurrent').returns( stub(deviceState.deviceConfig, 'getCurrent').returns(
Promise.resolve(mockedInitialConfig), Promise.resolve(mockedInitialConfig),
); );
@ -286,7 +294,6 @@ describe('deviceState', () => {
process.env.ROOT_MOUNTPOINT + '/apps-pin.json', process.env.ROOT_MOUNTPOINT + '/apps-pin.json',
deviceState, deviceState,
); );
(deviceState as any).applications.images.save.restore();
(deviceState as any).deviceConfig.getCurrent.restore(); (deviceState as any).deviceConfig.getCurrent.restore();
const pinned = await config.get('pinDevice'); const pinned = await config.get('pinDevice');
@ -306,8 +313,7 @@ describe('deviceState', () => {
const services: Service[] = []; const services: Service[] = [];
for (const service of testTarget.local.apps['1234'].services) { for (const service of testTarget.local.apps['1234'].services) {
const imageName = await (deviceState.applications const imageName = await images.normalise(service.image);
.images as any).normalise(service.image);
service.image = imageName; service.image = imageName;
(service as any).imageName = imageName; (service as any).imageName = imageName;
services.push( services.push(

View File

@ -8,6 +8,7 @@ import Service from '../src/compose/service';
import Volume from '../src/compose/volume'; import Volume from '../src/compose/volume';
import DeviceState from '../src/device-state'; import DeviceState from '../src/device-state';
import * as dockerUtils from '../src/lib/docker-utils'; import * as dockerUtils from '../src/lib/docker-utils';
import * as images from '../src/compose/images';
import chai = require('./lib/chai-config'); import chai = require('./lib/chai-config');
import prepare = require('./lib/prepare'); import prepare = require('./lib/prepare');
@ -123,14 +124,17 @@ const dependentDBFormat = {
}; };
describe('ApplicationManager', function () { describe('ApplicationManager', function () {
const originalInspectByName = images.inspectByName;
before(async function () { before(async function () {
await prepare(); await prepare();
this.deviceState = new DeviceState({ this.deviceState = new DeviceState({
apiBinder: null as any, apiBinder: null as any,
}); });
this.applications = this.deviceState.applications; this.applications = this.deviceState.applications;
stub(this.applications.images, 'inspectByName').callsFake((_imageName) =>
Bluebird.Promise.resolve({ // @ts-expect-error assigning to a RO property
images.inspectByName = () =>
Promise.resolve({
Config: { Config: {
Cmd: ['someCommand'], Cmd: ['someCommand'],
Entrypoint: ['theEntrypoint'], Entrypoint: ['theEntrypoint'],
@ -138,8 +142,8 @@ describe('ApplicationManager', function () {
Labels: {}, Labels: {},
Volumes: [], Volumes: [],
}, },
}), });
);
stub(dockerUtils, 'getNetworkGateway').returns( stub(dockerUtils, 'getNetworkGateway').returns(
Bluebird.Promise.resolve('172.17.0.1'), Bluebird.Promise.resolve('172.17.0.1'),
); );
@ -223,7 +227,8 @@ describe('ApplicationManager', function () {
); );
after(function () { after(function () {
this.applications.images.inspectByName.restore(); // @ts-expect-error Assigning to a RO property
images.inspectByName = originalInspectByName;
// @ts-expect-error restore on non-stubbed type // @ts-expect-error restore on non-stubbed type
dockerUtils.getNetworkGateway.restore(); dockerUtils.getNetworkGateway.restore();
// @ts-expect-error restore on non-stubbed type // @ts-expect-error restore on non-stubbed type

View File

@ -5,6 +5,7 @@ import * as supertest from 'supertest';
import APIBinder from '../src/api-binder'; import APIBinder from '../src/api-binder';
import DeviceState from '../src/device-state'; import DeviceState from '../src/device-state';
import Log from '../src/lib/supervisor-console'; import Log from '../src/lib/supervisor-console';
import * as images from '../src/compose/images';
import SupervisorAPI from '../src/supervisor-api'; import SupervisorAPI from '../src/supervisor-api';
import sampleResponses = require('./data/device-api-responses.json'); import sampleResponses = require('./data/device-api-responses.json');
import mockedAPI = require('./lib/mocked-device-api'); import mockedAPI = require('./lib/mocked-device-api');
@ -21,6 +22,7 @@ describe('SupervisorAPI', () => {
let api: SupervisorAPI; let api: SupervisorAPI;
let healthCheckStubs: SinonStub[]; let healthCheckStubs: SinonStub[];
const request = supertest(`http://127.0.0.1:${mockedOptions.listenPort}`); const request = supertest(`http://127.0.0.1:${mockedOptions.listenPort}`);
const originalGetStatus = images.getStatus;
before(async () => { before(async () => {
// Stub health checks so we can modify them whenever needed // Stub health checks so we can modify them whenever needed
@ -31,6 +33,10 @@ describe('SupervisorAPI', () => {
// The mockedAPI contains stubs that might create unexpected results // The mockedAPI contains stubs that might create unexpected results
// See the module to know what has been stubbed // See the module to know what has been stubbed
api = await mockedAPI.create(); api = await mockedAPI.create();
// @ts-expect-error assigning to a RO property
images.getStatus = () => Promise.resolve([]);
// Start test API // Start test API
return api.listen( return api.listen(
ALLOWED_INTERFACES, ALLOWED_INTERFACES,
@ -51,6 +57,9 @@ describe('SupervisorAPI', () => {
healthCheckStubs.forEach((hc) => hc.restore); healthCheckStubs.forEach((hc) => hc.restore);
// Remove any test data generated // Remove any test data generated
await mockedAPI.cleanUp(); await mockedAPI.cleanUp();
// @ts-expect-error assigning to a RO property
images.getStatus = originalGetStatus;
}); });
describe('/ping', () => { describe('/ping', () => {

View File

@ -3,7 +3,6 @@ import { fs } from 'mz';
import { stub } from 'sinon'; import { stub } from 'sinon';
import { ApplicationManager } from '../../src/application-manager'; import { ApplicationManager } from '../../src/application-manager';
import { Images } from '../../src/compose/images';
import { NetworkManager } from '../../src/compose/network-manager'; import { NetworkManager } from '../../src/compose/network-manager';
import { ServiceManager } from '../../src/compose/service-manager'; import { ServiceManager } from '../../src/compose/service-manager';
import { VolumeManager } from '../../src/compose/volume-manager'; import { VolumeManager } from '../../src/compose/volume-manager';
@ -136,7 +135,6 @@ function buildRoutes(appManager: ApplicationManager): Router {
function setupStubs() { function setupStubs() {
stub(ServiceManager.prototype, 'getStatus').resolves(STUBBED_VALUES.services); stub(ServiceManager.prototype, 'getStatus').resolves(STUBBED_VALUES.services);
stub(Images.prototype, 'getStatus').resolves(STUBBED_VALUES.images);
stub(NetworkManager.prototype, 'getAllByAppId').resolves( stub(NetworkManager.prototype, 'getAllByAppId').resolves(
STUBBED_VALUES.networks, STUBBED_VALUES.networks,
); );
@ -147,7 +145,6 @@ function setupStubs() {
function restoreStubs() { function restoreStubs() {
(ServiceManager.prototype as any).getStatus.restore(); (ServiceManager.prototype as any).getStatus.restore();
(Images.prototype as any).getStatus.restore();
(NetworkManager.prototype as any).getAllByAppId.restore(); (NetworkManager.prototype as any).getAllByAppId.restore();
(VolumeManager.prototype as any).getAllByAppId.restore(); (VolumeManager.prototype as any).getAllByAppId.restore();
} }