Skip to content

Commit

Permalink
Remove release and image id from test services
Browse files Browse the repository at this point in the history
  • Loading branch information
pipex committed Jun 19, 2023
1 parent 2c2c08d commit a915937
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 57 deletions.
143 changes: 88 additions & 55 deletions test/integration/compose/application-manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
},
Expand Down Expand Up @@ -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],
},
Expand Down Expand Up @@ -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],
},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions test/lib/state-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export async function createService(
...conf
} = {} as Partial<ServiceComposeConfig>,
{ state = {} as Partial<Service>, options = {} as any } = {},
isTarget = false,
) {
const svc = await Service.fromComposeObject(
{
Expand All @@ -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,
Expand Down

0 comments on commit a915937

Please sign in to comment.