Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stepfunctions): add service integrations #1646

Merged
merged 24 commits into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e33629a
Implement service integration for SNS & SQS
Jan 28, 2019
28d74ce
WIP
Jan 29, 2019
df9fb7b
WIP
rix0rrr Jan 29, 2019
b1dcd17
Add support for running ECS tasks in StepFunctions
rix0rrr Jan 31, 2019
a4e74e8
Make FunctionTask and ActivityTask to match new naming pattern
rix0rrr Jan 31, 2019
b501289
Merge remote-tracking branch 'origin/master' into huijbers/stepfuncti…
rix0rrr Apr 23, 2019
29c6e0c
WIP
rix0rrr Apr 23, 2019
106e04e
Merge remote-tracking branch 'origin/master' into huijbers/stepfuncti…
rix0rrr Apr 26, 2019
55a15e1
Get ECS library to build
rix0rrr Apr 27, 2019
b3cd0bc
Move metrics away
rix0rrr Apr 27, 2019
7766d0e
Adding tests
rix0rrr Apr 27, 2019
d0c5283
Don't inherit from task, do composition instead
rix0rrr May 6, 2019
8db693a
Refactor
rix0rrr May 7, 2019
3d2bf84
Get rid of 'xxx' and 'xxxPath' arguments, use Tokens to embed the dis…
rix0rrr May 7, 2019
67adba1
Merge remote-tracking branch 'origin/master' into huijbers/stepfuncti…
rix0rrr May 7, 2019
c0e5b87
Fix conflicts
rix0rrr May 7, 2019
cc98036
Get rid of duplicate definitions in vpc-ref
rix0rrr May 8, 2019
349e32d
Fix build
rix0rrr May 8, 2019
8d6df56
Mass rename "unresolved" => "isToken"
rix0rrr May 8, 2019
d220914
Rename Ecs classes
rix0rrr May 8, 2019
8d41855
Nothing is a construct and everything is bound through bind()
rix0rrr May 8, 2019
cf090d8
Placement is now configured in constructor through proper union types
rix0rrr May 8, 2019
f2a78a5
Fix casing in stepfunctions task
rix0rrr May 8, 2019
755ef40
Remove peerDependency
rix0rrr May 8, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion design/aws-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ into an `{ "Fn::Join" }` expression which includes the relevant intrinsic
functions.

If needed, you can query whether an object includes unresolved tokens by using
the `cdk.unresolved(x)` function.
the `cdk.isToken(x)` function.

Resource attributes should use a type that corresponds to the __resolved__ AWS
CloudFormation type (e.g. `string`, `string[]`).
Expand Down
55 changes: 55 additions & 0 deletions packages/@aws-cdk/assert/jest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Stack } from "@aws-cdk/cdk";
import { SynthesizedStack } from "@aws-cdk/cx-api";
import { HaveResourceAssertion, ResourcePart } from "./lib/assertions/have-resource";
import { expect as ourExpect } from './lib/expect';

declare global {
namespace jest {
interface Matchers<R> {
toHaveResource(resourceType: string,
properties?: any,
comparison?: ResourcePart): R;

toHaveResourceLike(resourceType: string,
properties?: any,
comparison?: ResourcePart): R;
}
}
}

expect.extend({
toHaveResource(
actual: SynthesizedStack | Stack,
resourceType: string,
properties?: any,
comparison?: ResourcePart) {

const assertion = new HaveResourceAssertion(resourceType, properties, comparison, false);
return assertHaveResource(assertion, actual);
},
toHaveResourceLike(
actual: SynthesizedStack | Stack,
resourceType: string,
properties?: any,
comparison?: ResourcePart) {

const assertion = new HaveResourceAssertion(resourceType, properties, comparison, true);
return assertHaveResource(assertion, actual);
}
});

function assertHaveResource(assertion: HaveResourceAssertion, actual: SynthesizedStack | Stack) {
const inspector = ourExpect(actual);
const pass = assertion.assertUsing(inspector);
if (pass) {
return {
pass,
message: () => `Not ` + assertion.generateErrorMessage(),
};
} else {
return {
pass,
message: () => assertion.generateErrorMessage(),
};
}
}
24 changes: 14 additions & 10 deletions packages/@aws-cdk/assert/lib/assertions/have-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function haveResourceLike(resourceType: string,

type PropertyPredicate = (props: any, inspection: InspectionFailure) => boolean;

class HaveResourceAssertion extends Assertion<StackInspector> {
export class HaveResourceAssertion extends Assertion<StackInspector> {
private inspected: InspectionFailure[] = [];
private readonly part: ResourcePart;
private readonly predicate: PropertyPredicate;
Expand Down Expand Up @@ -66,17 +66,21 @@ class HaveResourceAssertion extends Assertion<StackInspector> {
return false;
}

public assertOrThrow(inspector: StackInspector) {
if (!this.assertUsing(inspector)) {
const lines: string[] = [];
lines.push(`None of ${this.inspected.length} resources matches ${this.description}.`);
public generateErrorMessage() {
const lines: string[] = [];
lines.push(`None of ${this.inspected.length} resources matches ${this.description}.`);

for (const inspected of this.inspected) {
lines.push(`- ${inspected.failureReason} in:`);
lines.push(indent(4, JSON.stringify(inspected.resource, null, 2)));
}
for (const inspected of this.inspected) {
lines.push(`- ${inspected.failureReason} in:`);
lines.push(indent(4, JSON.stringify(inspected.resource, null, 2)));
}

throw new Error(lines.join('\n'));
return lines.join('\n');
}

public assertOrThrow(inspector: StackInspector) {
if (!this.assertUsing(inspector)) {
throw new Error(this.generateErrorMessage());
}
}

Expand Down
Loading