Skip to content

Commit 12f699a

Browse files
committed
Update ECS storage tests
1 parent 9e228d5 commit 12f699a

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

tests/ecs-service/index.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ describe('EcsService component deployment', () => {
6262
assert.strictEqual(ecsService.name, ctx.config.minEcsName, 'Service should have the correct name');
6363
assert.strictEqual(ecsService.service.launchType, 'FARGATE', 'Service should use FARGATE launch type');
6464
assert.strictEqual(ecsService.service.desiredCount, 1, 'Service should have 1 desired task');
65+
assert.strictEqual(ecsService.service.persistentStorage, undefined, 'Service should not have any storage');
6566
});
6667

6768
it('should have a running ECS service with desired count of tasks', async () => {

tests/ecs-service/infrastructure/index.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const minimalEcsService = new studion.EcsService(`${appName}-min`, {
2626
cluster,
2727
vpc: project.vpc,
2828
containers: [sampleServiceContainer],
29-
tags
29+
tags,
3030
});
3131

3232
const lbSecurityGroup = new aws.ec2.SecurityGroup(`${appName}-lb-sg`, {
@@ -145,6 +145,22 @@ const ecsServiceWithStorage = new studion.EcsService(`${appName}-storage`, {
145145
tags
146146
});
147147

148+
const ecsServiceWithEmptyVolumes = new studion.EcsService(`${appName}-empty-vol`, {
149+
cluster,
150+
vpc: project.vpc,
151+
containers: [sampleServiceContainer],
152+
volumes: [],
153+
tags
154+
});
155+
156+
const ecsServiceWithOutputEmptyVolumes = new studion.EcsService(`${appName}-empty-otp-vol`, {
157+
cluster,
158+
vpc: project.vpc,
159+
containers: [sampleServiceContainer],
160+
volumes: pulumi.output([]),
161+
tags
162+
});
163+
148164
module.exports = {
149165
project,
150166
cluster,
@@ -153,5 +169,7 @@ module.exports = {
153169
lbUrl,
154170
ecsWithDiscovery,
155171
ecsServiceWithAutoscaling,
156-
ecsServiceWithStorage
172+
ecsServiceWithStorage,
173+
ecsServiceWithEmptyVolumes,
174+
ecsServiceWithOutputEmptyVolumes
157175
};

tests/ecs-service/persistent-storage.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,16 @@ export function testEcsServiceWithStorage(ctx: EcsTestContext) {
215215
numOfAttempts: 8,
216216
});
217217
});
218+
219+
it('should create ECS service when empty volumes array argument is passed', async () => {
220+
const ecsService = ctx.outputs.ecsServiceWithEmptyVolumes.value;
221+
assert.ok(ecsService, 'ECS Service should be defined');
222+
assert.strictEqual(ecsService.service.persistentStorage, undefined, 'Service should not have any storage');
223+
});
224+
225+
it('should create ECS service when empty output volumes array argument is passed', async () => {
226+
const ecsService = ctx.outputs.ecsServiceWithOutputEmptyVolumes.value;
227+
assert.ok(ecsService, 'ECS Service should be defined');
228+
assert.strictEqual(ecsService.service.persistentStorage, undefined, 'Service should not have any storage');
229+
});
218230
}

0 commit comments

Comments
 (0)