Skip to content

Commit

Permalink
update comment, tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atsushi-ishibashi committed Feb 28, 2020
1 parent 6e1d696 commit 583b8af
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect, haveResourceLike } from '@aws-cdk/assert';
import * as codepipeline from '@aws-cdk/aws-codepipeline';
import { FakeSourceAction } from '@aws-cdk/aws-codepipeline/test/fake-source-action';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as s3 from '@aws-cdk/aws-s3';
import * as cdk from '@aws-cdk/core';
import { Test } from 'nodeunit';
import * as cpactions from '../../lib';
Expand Down Expand Up @@ -86,49 +86,43 @@ export = {
'can be created by existing service'(test: Test) {
const stack = new cdk.Stack();
const service = ecs.FargateService.fromFargateServiceAttributes(stack, 'FargateService', {
serviceName: 'my-http-service',
serviceName: 'service-name',
cluster: new ecs.Cluster(stack, 'Cluster', {
clusterName: 'cluster',
clusterName: 'cluster-name',
}),
});
const artifact = new codepipeline.Artifact('Artifact');

test.doesNotThrow(() => {
const action = new cpactions.EcsDeployAction({
actionName: 'ECS',
service,
imageFile: artifact.atPath('imageFile.json'),
});
new codepipeline.Pipeline(stack, 'Pipeline', {
stages: [
{
stageName: 'Source',
actions: [new FakeSourceAction({
actionName: 'Source',
output: artifact,
})],
},
{
stageName: 'Deploy',
actions: [action],
}
],
});
const bucket = new s3.Bucket(stack, 'PipelineBucket', {
versioned: true,
removalPolicy: cdk.RemovalPolicy.DESTROY,
});
const source = new cpactions.S3SourceAction({
actionName: 'Source',
output: artifact,
bucket,
bucketKey: 'key',
});
const action = new cpactions.EcsDeployAction({
actionName: 'ECS',
service,
imageFile: artifact.atPath('imageFile.json'),
});
new codepipeline.Pipeline(stack, 'Pipeline', {
stages: [
{
stageName: 'Source',
actions: [source],
},
{
stageName: 'Deploy',
actions: [action],
}
],
});

expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', {
Stages: [
{
Actions: [
{
Name: 'Source',
ActionTypeId: {
Category: "Source",
Provider: "Fake"
},
}
]
},
{},
{
Actions: [
{
Expand All @@ -141,7 +135,7 @@ export = {
ClusterName: {
Ref: "ClusterEB0386A7",
},
ServiceName: "my-http-service",
ServiceName: "service-name",
FileName: "imageFile.json"
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ecs/lib/base/from-service-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ export interface ServiceAttributes {
/**
* The service ARN.
*
* @default - generated from serviceName
* @default - {@link serviceName}, is required
*/
readonly serviceArn?: string;

/**
* The name of the service.
*
* @default - generated from serviceArn
* @default - {@link serviceArn}, is required
*/
readonly serviceName?: string;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ export interface Ec2ServiceAttributes {
/**
* The service ARN.
*
* @default - generated from serviceName
* @default - {@link serviceName}, is required
*/
readonly serviceArn?: string;

/**
* The name of the service.
*
* @default - generated from serviceArn
* @default - {@link serviceArn}, is required
*/
readonly serviceName?: string;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ export interface FargateServiceAttributes {
/**
* The service ARN.
*
* @default - generated from serviceName
* @default - {@link serviceName}, is required
*/
readonly serviceArn?: string;

/**
* The name of the service.
*
* @default - generated from serviceArn
* @default - {@link serviceArn}, is required
*/
readonly serviceName?: string;
}
Expand Down

0 comments on commit 583b8af

Please sign in to comment.