diff --git a/test/integration/compose/application-manager.spec.ts b/test/integration/compose/application-manager.spec.ts index 745521fdbf..76eaa498ed 100644 --- a/test/integration/compose/application-manager.spec.ts +++ b/test/integration/compose/application-manager.spec.ts @@ -397,23 +397,31 @@ describe('compose/application-manager', () => { const targetApps = createApps( { services: [ - await createService({ - image: 'main-image', - appId: 1, - appUuid: 'appuuid', - commit: 'new-release', - serviceName: 'main', - composition: { - depends_on: ['dep'], + await createService( + { + image: 'main-image', + appId: 1, + appUuid: 'appuuid', + commit: 'new-release', + serviceName: 'main', + composition: { + depends_on: ['dep'], + }, }, - }), - await createService({ - image: 'dep-image', - appId: 1, - appUuid: 'appuuid', - commit: 'new-release', - serviceName: 'dep', - }), + {}, + true, + ), + await createService( + { + image: 'dep-image', + appId: 1, + appUuid: 'appuuid', + commit: 'new-release', + serviceName: 'dep', + }, + {}, + true, + ), ], networks: [DEFAULT_NETWORK], }, @@ -486,19 +494,27 @@ describe('compose/application-manager', () => { const targetApps = createApps( { services: [ - await createService({ - image: 'main-image', - serviceName: 'main', - commit: 'new-release', - composition: { - depends_on: ['dep'], + await createService( + { + image: 'main-image', + serviceName: 'main', + commit: 'new-release', + composition: { + depends_on: ['dep'], + }, }, - }), - await createService({ - image: 'dep-image', - serviceName: 'dep', - commit: 'new-release', - }), + {}, + true, + ), + await createService( + { + image: 'dep-image', + serviceName: 'dep', + commit: 'new-release', + }, + {}, + true, + ), ], networks: [DEFAULT_NETWORK], }, @@ -548,19 +564,27 @@ describe('compose/application-manager', () => { const targetApps = createApps( { services: [ - await createService({ - image: 'main-image', - serviceName: 'main', - commit: 'new-release', - composition: { - depends_on: ['dep'], + await createService( + { + image: 'main-image', + serviceName: 'main', + commit: 'new-release', + composition: { + depends_on: ['dep'], + }, }, - }), - await createService({ - image: 'dep-image', - serviceName: 'dep', - commit: 'new-release', - }), + {}, + true, + ), + await createService( + { + image: 'dep-image', + serviceName: 'dep', + commit: 'new-release', + }, + {}, + true, + ), ], networks: [DEFAULT_NETWORK], }, @@ -614,7 +638,7 @@ describe('compose/application-manager', () => { it('infers to remove spurious containers', async () => { const targetApps = createApps( { - services: [await createService({ image: 'main-image' })], + services: [await createService({ image: 'main-image' }, {}, true)], networks: [DEFAULT_NETWORK], }, true, @@ -852,6 +876,7 @@ describe('compose/application-manager', () => { { image: 'main-image' }, // Target has a matching image already { options: { imageInfo: { Id: 'sha256:bbbb' } } }, + true, ), ], networks: [DEFAULT_NETWORK], @@ -1090,20 +1115,28 @@ describe('compose/application-manager', () => { const targetApps = createApps( { services: [ - await createService({ - running: true, - image: 'main-image-1', - appId: 1, - appUuid: 'app-one', - commit: 'commit-for-app-1', - }), - await createService({ - running: true, - image: 'main-image-2', - appId: 2, - appUuid: 'app-two', - commit: 'commit-for-app-2', - }), + await createService( + { + running: true, + image: 'main-image-1', + appId: 1, + appUuid: 'app-one', + commit: 'commit-for-app-1', + }, + {}, + true, + ), + await createService( + { + running: true, + image: 'main-image-2', + appId: 2, + appUuid: 'app-two', + commit: 'commit-for-app-2', + }, + {}, + true, + ), ], networks: [ // Default networks for two apps diff --git a/test/lib/state-helper.ts b/test/lib/state-helper.ts index 69fa628879..bff77b3254 100644 --- a/test/lib/state-helper.ts +++ b/test/lib/state-helper.ts @@ -23,6 +23,7 @@ export async function createService( ...conf } = {} as Partial, { state = {} as Partial, options = {} as any } = {}, + isTarget = false, ) { const svc = await Service.fromComposeObject( { @@ -34,8 +35,12 @@ export async function createService( // are compared using _.isEqual so leaving this here to have image comparisons // match serviceId: 1, - imageId: 1, - releaseId: 1, + ...(isTarget + ? { + imageId: 1, + releaseId: 1, + } + : {}), ...conf, }, options,