-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple-private-vpc_test.go
More file actions
38 lines (33 loc) · 1 KB
/
Copy pathsimple-private-vpc_test.go
File metadata and controls
38 lines (33 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"testing"
"github.com/aws/aws-cdk-go/awscdk/v2"
"github.com/aws/aws-cdk-go/awscdk/v2/assertions"
"github.com/aws/jsii-runtime-go"
)
func TestSimplePrivateVpcStack(t *testing.T) {
// GIVEN
app := awscdk.NewApp(nil)
// WHEN
stack := NewSimpleIsolatedVpcStack(app, "MyStack", nil)
// THEN
template := assertions.Template_FromStack(stack, &assertions.TemplateParsingOptions{})
// - has the expected vpc
template.HasResourceProperties(jsii.String("AWS::EC2::VPC"), map[string]interface{}{
"Tags": assertions.Match_ArrayWith(&[]interface{}{
assertions.Match_ObjectLike(&map[string]interface{}{
"Key": "Name",
"Value": "SimplePrivateVPC",
}),
}),
})
// - has only private subnets with egress
template.AllResourcesProperties(jsii.String("AWS::EC2::Subnet"), map[string]interface{}{
"Tags": assertions.Match_ArrayWith(&[]interface{}{
assertions.Match_ObjectLike(&map[string]interface{}{
"Key": "aws-cdk:subnet-type",
"Value": "Private",
}),
}),
})
}