@@ -4,7 +4,7 @@ import * as pulumi from "@pulumi/pulumi";
4
4
import "mocha" ;
5
5
6
6
pulumi . runtime . setMocks ( {
7
- newResource : function ( args : pulumi . runtime . MockResourceArgs ) : { id : string , state : any } {
7
+ newResource : function ( args : pulumi . runtime . MockResourceArgs ) : { id : string , state : any ; } {
8
8
switch ( args . type ) {
9
9
case "aws:ec2/securityGroup:SecurityGroup" :
10
10
return {
@@ -39,7 +39,7 @@ pulumi.runtime.setMocks({
39
39
} ;
40
40
}
41
41
} ,
42
- call : function ( args : pulumi . runtime . MockCallArgs ) {
42
+ call : function ( args : pulumi . runtime . MockCallArgs ) {
43
43
switch ( args . token ) {
44
44
case "aws:ec2/getAmi:getAmi" :
45
45
return {
@@ -52,17 +52,17 @@ pulumi.runtime.setMocks({
52
52
} ,
53
53
} ) ;
54
54
55
- describe ( "Infrastructure" , function ( ) {
56
- let infra : typeof import ( "./index" ) ;
55
+ describe ( "Infrastructure" , function ( ) {
56
+ let infra : typeof import ( "./index.ts " ) ;
57
57
58
- before ( async function ( ) {
58
+ before ( async function ( ) {
59
59
// It's important to import the program _after_ the mocks are defined.
60
- infra = await import ( "./index" ) ;
60
+ infra = await import ( "./index.ts " ) ;
61
61
} ) ;
62
62
63
- describe ( "#server" , function ( ) {
63
+ describe ( "#server" , function ( ) {
64
64
// check 1: Instances have a Name tag.
65
- it ( "must have a name tag" , function ( done ) {
65
+ it ( "must have a name tag" , function ( done ) {
66
66
pulumi . all ( [ infra . server . urn , infra . server . tags ] ) . apply ( ( [ urn , tags ] ) => {
67
67
if ( ! tags || ! tags [ "Name" ] ) {
68
68
done ( new Error ( `Missing a name tag on server ${ urn } ` ) ) ;
@@ -73,7 +73,7 @@ describe("Infrastructure", function() {
73
73
} ) ;
74
74
75
75
// check 2: Instances must not use an inline userData script.
76
- it ( "must not use userData (use an AMI instead)" , function ( done ) {
76
+ it ( "must not use userData (use an AMI instead)" , function ( done ) {
77
77
pulumi . all ( [ infra . server . urn , infra . server . userData ] ) . apply ( ( [ urn , userData ] ) => {
78
78
if ( userData ) {
79
79
done ( new Error ( `Illegal use of userData on server ${ urn } ` ) ) ;
@@ -84,13 +84,13 @@ describe("Infrastructure", function() {
84
84
} ) ;
85
85
} ) ;
86
86
87
- describe ( "#group" , function ( ) {
87
+ describe ( "#group" , function ( ) {
88
88
// check 3: Instances must not have SSH open to the Internet.
89
- it ( "must not open port 22 (SSH) to the Internet" , function ( done ) {
90
- pulumi . all ( [ infra . group . urn , infra . group . ingress ] ) . apply ( ( [ urn , ingress ] ) => {
89
+ it ( "must not open port 22 (SSH) to the Internet" , function ( done ) {
90
+ pulumi . all ( [ infra . group . urn , infra . group . ingress ] ) . apply ( ( [ urn , ingress ] ) => {
91
91
if ( ingress . find ( rule =>
92
92
rule . fromPort === 22 && ( rule . cidrBlocks || [ ] ) . find ( block => block === "0.0.0.0/0" ) ) ) {
93
- done ( new Error ( `Illegal SSH port 22 open to the Internet (CIDR 0.0.0.0/0) on group ${ urn } ` ) ) ;
93
+ done ( new Error ( `Illegal SSH port 22 open to the Internet (CIDR 0.0.0.0/0) on group ${ urn } ` ) ) ;
94
94
} else {
95
95
done ( ) ;
96
96
}
0 commit comments