Skip to content

Commit 7c1795e

Browse files
authored
chore: migrate kaizen3031593's modules to assertions (#18205)
- [x] elasticsearch - [x] lambda-layer-node-proxy-agent - [x] ecr-assets - [x] opensearchservice - [x] chatbot - [x] lambda-layer-kubectl - [x] appmesh - [x] lambda - [x] lambda-destinations ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent c0f62a5 commit 7c1795e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+618
-870
lines changed

packages/@aws-cdk/aws-appmesh/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
},
8585
"license": "Apache-2.0",
8686
"devDependencies": {
87-
"@aws-cdk/assert-internal": "0.0.0",
87+
"@aws-cdk/assertions": "0.0.0",
8888
"@aws-cdk/cdk-build-tools": "0.0.0",
8989
"@aws-cdk/cdk-integ-tools": "0.0.0",
9090
"@aws-cdk/cfn2ts": "0.0.0",

packages/@aws-cdk/aws-appmesh/test/gateway-route.test.ts

+26-59
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import '@aws-cdk/assert-internal/jest';
2-
import { ABSENT } from '@aws-cdk/assert-internal';
1+
import { Match, Template } from '@aws-cdk/assertions';
32
import * as cdk from '@aws-cdk/core';
43
import * as appmesh from '../lib';
54

@@ -50,9 +49,9 @@ describe('gateway route', () => {
5049
});
5150

5251
// THEN
53-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
52+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
5453
GatewayRouteName: 'gateway-http-route',
55-
MeshOwner: ABSENT,
54+
MeshOwner: Match.absent(),
5655
Spec: {
5756
HttpRoute: {
5857
Action: {
@@ -70,7 +69,7 @@ describe('gateway route', () => {
7069
},
7170
},
7271
});
73-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
72+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
7473
GatewayRouteName: 'gateway-http2-route',
7574
Spec: {
7675
Http2Route: {
@@ -89,7 +88,7 @@ describe('gateway route', () => {
8988
},
9089
},
9190
});
92-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
91+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
9392
GatewayRouteName: 'gateway-grpc-route',
9493
Spec: {
9594
GrpcRoute: {
@@ -163,11 +162,9 @@ describe('gateway route', () => {
163162
});
164163

165164
// THEN
166-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
165+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
167166
MeshOwner: meshEnv.account,
168167
});
169-
170-
171168
});
172169
});
173170

@@ -214,7 +211,7 @@ describe('gateway route', () => {
214211
});
215212

216213
// THEN
217-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
214+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
218215
GatewayRouteName: 'gateway-http-route',
219216
Spec: {
220217
HttpRoute: {
@@ -229,7 +226,7 @@ describe('gateway route', () => {
229226
},
230227
});
231228

232-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
229+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
233230
GatewayRouteName: 'gateway-grpc-route',
234231
Spec: {
235232
GrpcRoute: {
@@ -243,8 +240,6 @@ describe('gateway route', () => {
243240
},
244241
},
245242
});
246-
247-
248243
});
249244
});
250245

@@ -279,10 +274,8 @@ describe('gateway route', () => {
279274
}),
280275
gatewayRouteName: 'gateway-http2-route',
281276
});
282-
283-
284277
// THEN
285-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
278+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
286279
GatewayRouteName: 'gateway-http2-route',
287280
Spec: {
288281
Http2Route: {
@@ -296,8 +289,6 @@ describe('gateway route', () => {
296289
},
297290
},
298291
});
299-
300-
301292
});
302293
});
303294

@@ -355,7 +346,7 @@ describe('gateway route', () => {
355346
});
356347

357348
// THEN
358-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
349+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
359350
GatewayRouteName: 'gateway-http-route',
360351
Spec: {
361352
HttpRoute: {
@@ -370,7 +361,7 @@ describe('gateway route', () => {
370361
},
371362
});
372363

373-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
364+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
374365
GatewayRouteName: 'gateway-http2-route',
375366
Spec: {
376367
Http2Route: {
@@ -385,18 +376,16 @@ describe('gateway route', () => {
385376
},
386377
});
387378

388-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
379+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
389380
GatewayRouteName: 'gateway-http2-route-1',
390381
Spec: {
391382
Http2Route: {
392383
Action: {
393-
Rewrite: ABSENT,
384+
Rewrite: Match.absent(),
394385
},
395386
},
396387
},
397388
});
398-
399-
400389
});
401390

402391
test("should throw an error if the prefix match does not start and end with '/'", () => {
@@ -429,8 +418,6 @@ describe('gateway route', () => {
429418
gatewayRouteName: 'gateway-http-route',
430419
});
431420
}).toThrow(/Prefix path for the match must start with \'\/\', got: test\//);
432-
433-
434421
expect(() => {
435422
virtualGateway.addGatewayRoute('gateway-http2-route', {
436423
routeSpec: appmesh.GatewayRouteSpec.http2({
@@ -442,8 +429,6 @@ describe('gateway route', () => {
442429
gatewayRouteName: 'gateway-http2-route',
443430
});
444431
}).toThrow(/When prefix path for the rewrite is specified, prefix path for the match must end with \'\/\', got: \/test/);
445-
446-
447432
});
448433

449434
test("should throw an error if the custom prefix does not start and end with '/'", () => {
@@ -488,8 +473,6 @@ describe('gateway route', () => {
488473
gatewayRouteName: 'gateway-http2-route',
489474
});
490475
}).toThrow(/Prefix path for the rewrite must start and end with \'\/\', got: \/rewrittenUri/);
491-
492-
493476
});
494477
});
495478

@@ -535,7 +518,7 @@ describe('gateway route', () => {
535518
});
536519

537520
// THEN
538-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
521+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
539522
GatewayRouteName: 'gateway-http-route',
540523
Spec: {
541524
HttpRoute: {
@@ -545,13 +528,13 @@ describe('gateway route', () => {
545528
},
546529
},
547530
Action: {
548-
Rewrite: ABSENT,
531+
Rewrite: Match.absent(),
549532
},
550533
},
551534
},
552535
});
553536

554-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
537+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
555538
GatewayRouteName: 'gateway-grpc-route',
556539
Spec: {
557540
GrpcRoute: {
@@ -563,8 +546,6 @@ describe('gateway route', () => {
563546
},
564547
},
565548
});
566-
567-
568549
});
569550
});
570551

@@ -610,7 +591,7 @@ describe('gateway route', () => {
610591
});
611592

612593
// THEN
613-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
594+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
614595
GatewayRouteName: 'gateway-grpc-route',
615596
Spec: {
616597
GrpcRoute: {
@@ -681,8 +662,6 @@ describe('gateway route', () => {
681662
},
682663
},
683664
});
684-
685-
686665
});
687666

688667
test('should throw an error if the array length is invalid', () => {
@@ -742,8 +721,6 @@ describe('gateway route', () => {
742721
gatewayRouteName: 'gateway-grpc-route',
743722
});
744723
}).toThrow(/Number of metadata provided for matching must be between 1 and 10/);
745-
746-
747724
});
748725
});
749726

@@ -790,7 +767,7 @@ describe('gateway route', () => {
790767
});
791768

792769
// THEN
793-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
770+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
794771
GatewayRouteName: 'gateway-http-route',
795772
Spec: {
796773
HttpRoute: {
@@ -861,8 +838,6 @@ describe('gateway route', () => {
861838
},
862839
},
863840
});
864-
865-
866841
});
867842
});
868843

@@ -898,7 +873,7 @@ describe('gateway route', () => {
898873
});
899874

900875
// THEN
901-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
876+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
902877
GatewayRouteName: 'gateway-http-route',
903878
Spec: {
904879
HttpRoute: {
@@ -908,8 +883,6 @@ describe('gateway route', () => {
908883
},
909884
},
910885
});
911-
912-
913886
});
914887
});
915888

@@ -956,7 +929,7 @@ describe('gateway route', () => {
956929
});
957930

958931
// THEN
959-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
932+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
960933
GatewayRouteName: 'gateway-http-route',
961934
Spec: {
962935
HttpRoute: {
@@ -966,13 +939,13 @@ describe('gateway route', () => {
966939
},
967940
},
968941
Action: {
969-
Rewrite: ABSENT,
942+
Rewrite: Match.absent(),
970943
},
971944
},
972945
},
973946
});
974947

975-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
948+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
976949
GatewayRouteName: 'gateway-http2-route',
977950
Spec: {
978951
Http2Route: {
@@ -984,8 +957,6 @@ describe('gateway route', () => {
984957
},
985958
},
986959
});
987-
988-
989960
});
990961

991962
test('should throw an error if empty string is passed', () => {
@@ -1019,8 +990,6 @@ describe('gateway route', () => {
1019990
gatewayRouteName: 'gateway-http-route',
1020991
});
1021992
}).toThrow(/Exact Path for the rewrite cannot be empty. Unlike startsWith\(\) method, no automatic rewrite on whole path match/);
1022-
1023-
1024993
});
1025994
});
1026995

@@ -1058,7 +1027,7 @@ describe('gateway route', () => {
10581027
});
10591028

10601029
// THEN
1061-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
1030+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
10621031
GatewayRouteName: 'gateway-http-route',
10631032
Spec: {
10641033
HttpRoute: {
@@ -1075,8 +1044,6 @@ describe('gateway route', () => {
10751044
},
10761045
},
10771046
});
1078-
1079-
10801047
});
10811048
});
10821049
});
@@ -1112,7 +1079,7 @@ describe('gateway route', () => {
11121079
});
11131080

11141081
// THEN
1115-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
1082+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
11161083
GatewayRouteName: 'gateway-http-route',
11171084
Spec: {
11181085
HttpRoute: {
@@ -1157,7 +1124,7 @@ describe('gateway route', () => {
11571124
});
11581125

11591126
// THEN
1160-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
1127+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
11611128
Spec: {
11621129
Priority: 100,
11631130
},
@@ -1197,7 +1164,7 @@ describe('gateway route', () => {
11971164
});
11981165

11991166
// THEN
1200-
expect(stack).toHaveResourceLike('AWS::AppMesh::GatewayRoute', {
1167+
Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', {
12011168
Spec: {
12021169
Priority: 500,
12031170
},

packages/@aws-cdk/aws-appmesh/test/health-check.test.ts

-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as cdk from '@aws-cdk/core';
2-
32
import * as appmesh from '../lib';
43

54
let idCounter = 0;
@@ -29,8 +28,6 @@ describe('health check', () => {
2928
expect(() => toThrow(max)).not.toThrow();
3029
expect(() => toThrow(min - 1)).toThrow(/interval must be between 5 seconds and 300 seconds/);
3130
expect(() => toThrow(max + 1)).toThrow(/interval must be between 5 seconds and 300 seconds/);
32-
33-
3431
});
3532
test('timeout', () => {
3633
// GIVEN
@@ -48,8 +45,6 @@ describe('health check', () => {
4845
expect(() => toThrow(max)).not.toThrow();
4946
expect(() => toThrow(min - 1)).toThrow(/timeout must be between 2 seconds and 60 seconds/);
5047
expect(() => toThrow(max + 1)).toThrow(/timeout must be between 2 seconds and 60 seconds/);
51-
52-
5348
});
5449
test('healthyThreshold', () => {
5550
// GIVEN
@@ -67,8 +62,6 @@ describe('health check', () => {
6762
expect(() => toThrow(max)).not.toThrow();
6863
expect(() => toThrow(min - 1)).toThrow(/healthyThreshold must be between 2 and 10/);
6964
expect(() => toThrow(max + 1)).toThrow(/healthyThreshold must be between 2 and 10/);
70-
71-
7265
});
7366
test('unhealthyThreshold', () => {
7467
// GIVEN
@@ -86,7 +79,5 @@ describe('health check', () => {
8679
expect(() => toThrow(max)).not.toThrow();
8780
expect(() => toThrow(min - 1)).toThrow(/unhealthyThreshold must be between 2 and 10/);
8881
expect(() => toThrow(max + 1)).toThrow(/unhealthyThreshold must be between 2 and 10/);
89-
90-
9182
});
9283
});

0 commit comments

Comments
 (0)