Skip to content

Commit f93239b

Browse files
Remove unnecessayr usage of APIGateway from tests. (pulumi#258)
1 parent 705ef3e commit f93239b

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

aws-js-containers/index.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
const pulumi = require("@pulumi/pulumi");
12
const awsx = require("@pulumi/awsx");
23

3-
let cluster = new awsx.ecs.Cluster("example", { });
4-
let listener= new awsx.elasticloadbalancingv2.NetworkListener("nginx", { port: 80 });
4+
// Create an elastic network listener to listen for requests and route them to the container.
5+
// See https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html
6+
// for more details.
7+
let listener = new awsx.elasticloadbalancingv2.NetworkListener("nginx", { port: 80 });
8+
9+
// Define the service to run. We pass in the listener to hook up the network load balancer
10+
// to the containers the service will launch.
511
let service = new awsx.ecs.FargateService("nginx", {
6-
cluster,
712
desiredCount: 2,
813
taskDefinitionArgs: {
914
containers: {
@@ -16,12 +21,4 @@ let service = new awsx.ecs.FargateService("nginx", {
1621
},
1722
});
1823

19-
// expose some APIs meant for testing purposes.
20-
let api = new awsx.apigateway.API("containers", {
21-
routes: [{
22-
path: "/nginx",
23-
target: listener,
24-
}],
25-
});
26-
27-
exports.frontendURL = api.url;
24+
exports.frontendURL = pulumi.interpolate `http://${listener.endpoint.hostname}/`;

aws-ts-containers/index.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,4 @@ let service = new awsx.ecs.FargateService("nginx", {
2121
},
2222
});
2323

24-
// expose some APIs meant for testing purposes.
25-
const api = new awsx.apigateway.API("containers", {
26-
routes: [{
27-
path: "/nginx",
28-
target: listener,
29-
}],
30-
});
31-
32-
export let frontendURL = api.url;
24+
export let frontendURL = pulumi.interpolate `http://${listener.endpoint.hostname}/`;

misc/test/examples_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestExamples(t *testing.T) {
5353
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
5454
maxWait := 10 * time.Minute
5555
endpoint := stack.Outputs["frontendURL"].(string)
56-
assertHTTPResultWithRetry(t, endpoint+"nginx", maxWait, func(body string) bool {
56+
assertHTTPResultWithRetry(t, endpoint, maxWait, func(body string) bool {
5757
return assert.Contains(t, body, "Hello, Pulumi!")
5858
})
5959
},
@@ -140,7 +140,7 @@ func TestExamples(t *testing.T) {
140140
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
141141
maxWait := 10 * time.Minute
142142
endpoint := stack.Outputs["frontendURL"].(string)
143-
assertHTTPResultWithRetry(t, endpoint+"nginx", maxWait, func(body string) bool {
143+
assertHTTPResultWithRetry(t, endpoint, maxWait, func(body string) bool {
144144
return assert.Contains(t, body, "Hello, Pulumi!")
145145
})
146146
},

0 commit comments

Comments
 (0)