Skip to content

Commit 09bfb69

Browse files
Add tests for examples (#254)
1 parent 98abe30 commit 09bfb69

File tree

7 files changed

+202
-123
lines changed

7 files changed

+202
-123
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ensure:
88
only_build:
99

1010
only_test:
11-
go test ./misc/test/... --timeout 1h -v -count=1 -short
11+
go test ./misc/test/... --timeout 2h -v -count=1 -short -parallel 8
1212

1313
# The travis_* targets are entrypoints for CI.
1414
.PHONY: travis_cron travis_push travis_pull_request travis_api

aws-js-webserver-component/webserver.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22

33
const aws = require("@pulumi/aws");
44

5-
let ami = "ami-7172b611" // AMI for Amazon Linux in us-west-2 (Oregon)
5+
// let ami = "ami-7172b611" // AMI for Amazon Linux in us-west-2 (Oregon)
6+
let ami = "ami-c55673a0" // AMI for us-east-2 (Ohio)
67
// let ami = "ami-6869aa05" // AMI for us-east-1 (Virginia)
78
// let ami = "ami-31490d51" // AMI for us-west-1 (California)
89
// let ami = "ami-f9dd458a" // AMI for eu-west-1 (Ireland)
910
// let ami = "ami-ea26ce85" // AMI for eu-central-1 (Frankfurt)
1011

1112
// create a new security group for port 80
12-
let group = new aws.ec2.SecurityGroup("web-secgrp", {
13+
let group = new aws.ec2.SecurityGroup("web-secgrp", {
1314
description: "Enable HTTP access",
1415
ingress: [
1516
{ protocol: "tcp", fromPort: 80, toPort: 80, cidrBlocks: ["0.0.0.0/0"] },
1617
],
1718
});
1819

1920
// (optional) create a simple web server using the startup script for the instance
20-
let userData =
21+
let userData =
2122
`#!/bin/bash
2223
echo "Hello, World!" > index.html
2324
nohup python -m SimpleHTTPServer 80 &`;

aws-js-webserver/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@ const aws = require("@pulumi/aws");
44

55
let size = "t2.micro"; // t2.micro is available in the AWS free tier
66

7-
let ami = "ami-7172b611" // AMI for Amazon Linux in us-west-2 (Oregon)
7+
// let ami = "ami-7172b611" // AMI for Amazon Linux in us-west-2 (Oregon)
8+
let ami = "ami-c55673a0" // AMI for us-east-2 (Ohio)
89
// let ami = "ami-6869aa05" // AMI for us-east-1 (Virginia)
910
// let ami = "ami-31490d51" // AMI for us-west-1 (California)
1011
// let ami = "ami-f9dd458a" // AMI for eu-west-1 (Ireland)
1112
// let ami = "ami-ea26ce85" // AMI for eu-central-1 (Frankfurt)
1213

1314
// create a new security group for port 80
14-
let group = new aws.ec2.SecurityGroup("web-secgrp", {
15+
let group = new aws.ec2.SecurityGroup("web-secgrp", {
1516
ingress: [
1617
{ protocol: "tcp", fromPort: 22, toPort: 22, cidrBlocks: ["0.0.0.0/0"] },
1718
{ protocol: "tcp", fromPort: 80, toPort: 80, cidrBlocks: ["0.0.0.0/0"] },
1819
],
1920
});
2021

2122
// (optional) create a simple web server using the startup script for the instance
22-
let userData =
23+
let userData =
2324
`#!/bin/bash
2425
echo "Hello, World!" > index.html
2526
nohup python -m SimpleHTTPServer 80 &`;

aws-ts-airflow/Pulumi.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ template:
66
aws:region:
77
description: The AWS region to deploy into
88
default: us-east-1
9-
cloud-aws:ecsAutoCluster:
10-
description: Automatically provision ECS Cluster?
11-
default: true
129
airflow:dbPassword:
1310
description: The desired RDS password
1411
secret: true

aws-ts-airflow/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ let vpc = awsx.ec2.Vpc.getDefault();
1010
// Create a basic cluster and autoscaling group
1111
let cluster = new awsx.ecs.Cluster("airflow", { vpc });
1212
let autoScalingGroup = cluster.createAutoScalingGroup("airflow", {
13+
subnetIds: vpc.publicSubnetIds,
1314
templateParameters: {
1415
minSize: 20,
1516
},
@@ -45,7 +46,7 @@ let cacheSubnets = new aws.elasticache.SubnetGroup("cachesubnets", {
4546
});
4647

4748
let cacheCluster = new aws.elasticache.Cluster("cachecluster", {
48-
clusterId: "cache-" + pulumi.getStack(),
49+
clusterId: `cache-${pulumi.getStack()}`.substr(0, 20),
4950
engine: "redis",
5051

5152
nodeType: "cache.t2.micro",

aws-ts-resources/index.ts

+50-50
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import * as pulumi from "@pulumi/pulumi";
22
import * as aws from "@pulumi/aws";
33

44
// Athena
5-
const databaseBucket = new aws.s3.Bucket("mydatabasebucket");
6-
const database = new aws.athena.Database("mydatabase", {
7-
name: "mydatabase",
8-
bucket: databaseBucket.bucket
9-
});
5+
// const databaseBucket = new aws.s3.Bucket("mydatabasebucket");
6+
// const database = new aws.athena.Database("mydatabase", {
7+
// name: "mydatabase",
8+
// bucket: databaseBucket.bucket
9+
// });
1010

11-
const namedQuery = new aws.athena.NamedQuery("mynamedquery", {
12-
database: database.id,
13-
query: pulumi.interpolate `SELECT * FROM ${database.id} limit 10;`,
14-
});
11+
// const namedQuery = new aws.athena.NamedQuery("mynamedquery", {
12+
// database: database.id,
13+
// query: pulumi.interpolate `SELECT * FROM ${database.id} limit 10;`,
14+
// });
1515

1616
// CloudWatch
1717
const dashboard = new aws.cloudwatch.Dashboard("mydashboard", {
@@ -235,54 +235,54 @@ const user = new aws.iam.User("myuser");
235235

236236
const group = new aws.iam.Group("mygroup");
237237

238-
const policyAttachment = new aws.iam.PolicyAttachment("mypolicyattachment", {
239-
users: [user],
240-
groups: [group],
241-
roles: [role],
242-
policyArn: policy.arn
243-
});
238+
// const policyAttachment = new aws.iam.PolicyAttachment("mypolicyattachment", {
239+
// users: [user],
240+
// groups: [group],
241+
// roles: [role],
242+
// policyArn: policy.arn
243+
// });
244244

245245
// Kinesis
246246
const stream = new aws.kinesis.Stream("mystream", {
247247
shardCount: 1
248248
});
249249

250250
// S3
251-
const bucket = new aws.s3.Bucket("my-bucket");
252-
253-
const bucketMetric = new aws.s3.BucketMetric("my-bucket-metric", {
254-
bucket: bucket.bucket
255-
});
256-
257-
const bucketNotification = new aws.s3.BucketNotification("my-bucket-notification", {
258-
bucket: bucket.bucket
259-
});
260-
261-
const bucketObject = new aws.s3.BucketObject("my-bucket-object", {
262-
bucket: bucket.bucket,
263-
content: "hello world"
264-
});
265-
266-
const bucketPolicy = new aws.s3.BucketPolicy("my-bucket-policy", {
267-
bucket: bucket.bucket,
268-
policy: bucket.bucket.apply(publicReadPolicyForBucket)
269-
})
270-
271-
function publicReadPolicyForBucket(bucketName: string) {
272-
return JSON.stringify({
273-
Version: "2012-10-17",
274-
Statement: [{
275-
Effect: "Allow",
276-
Principal: "*",
277-
Action: [
278-
"s3:GetObject"
279-
],
280-
Resource: [
281-
`arn:aws:s3:::${bucketName}/*` // policy refers to bucket name explicitly
282-
]
283-
}]
284-
});
285-
}
251+
// const bucket = new aws.s3.Bucket("my-bucket");
252+
253+
// const bucketMetric = new aws.s3.BucketMetric("my-bucket-metric", {
254+
// bucket: bucket.bucket
255+
// });
256+
257+
// const bucketNotification = new aws.s3.BucketNotification("my-bucket-notification", {
258+
// bucket: bucket.bucket
259+
// });
260+
261+
// const bucketObject = new aws.s3.BucketObject("my-bucket-object", {
262+
// bucket: bucket.bucket,
263+
// content: "hello world"
264+
// });
265+
266+
// const bucketPolicy = new aws.s3.BucketPolicy("my-bucket-policy", {
267+
// bucket: bucket.bucket,
268+
// policy: bucket.bucket.apply(publicReadPolicyForBucket)
269+
// })
270+
271+
// function publicReadPolicyForBucket(bucketName: string) {
272+
// return JSON.stringify({
273+
// Version: "2012-10-17",
274+
// Statement: [{
275+
// Effect: "Allow",
276+
// Principal: "*",
277+
// Action: [
278+
// "s3:GetObject"
279+
// ],
280+
// Resource: [
281+
// `arn:aws:s3:::${bucketName}/*` // policy refers to bucket name explicitly
282+
// ]
283+
// }]
284+
// });
285+
// }
286286

287287
// SQS
288288
const queue = new aws.sqs.Queue("myqueue");

0 commit comments

Comments
 (0)