Skip to content

Commit

Permalink
Remove unnecessayr usage of APIGateway from tests. (pulumi#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi committed Mar 13, 2019
1 parent 705ef3e commit f93239b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
21 changes: 9 additions & 12 deletions aws-js-containers/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
const pulumi = require("@pulumi/pulumi");
const awsx = require("@pulumi/awsx");

let cluster = new awsx.ecs.Cluster("example", { });
let listener= new awsx.elasticloadbalancingv2.NetworkListener("nginx", { port: 80 });
// Create an elastic network listener to listen for requests and route them to the container.
// See https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html
// for more details.
let listener = new awsx.elasticloadbalancingv2.NetworkListener("nginx", { port: 80 });

// Define the service to run. We pass in the listener to hook up the network load balancer
// to the containers the service will launch.
let service = new awsx.ecs.FargateService("nginx", {
cluster,
desiredCount: 2,
taskDefinitionArgs: {
containers: {
Expand All @@ -16,12 +21,4 @@ let service = new awsx.ecs.FargateService("nginx", {
},
});

// expose some APIs meant for testing purposes.
let api = new awsx.apigateway.API("containers", {
routes: [{
path: "/nginx",
target: listener,
}],
});

exports.frontendURL = api.url;
exports.frontendURL = pulumi.interpolate `https://${listener.endpoint.hostname}/`;
10 changes: 1 addition & 9 deletions aws-ts-containers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,4 @@ let service = new awsx.ecs.FargateService("nginx", {
},
});

// expose some APIs meant for testing purposes.
const api = new awsx.apigateway.API("containers", {
routes: [{
path: "/nginx",
target: listener,
}],
});

export let frontendURL = api.url;
export let frontendURL = pulumi.interpolate `https://${listener.endpoint.hostname}/`;
4 changes: 2 additions & 2 deletions misc/test/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestExamples(t *testing.T) {
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
maxWait := 10 * time.Minute
endpoint := stack.Outputs["frontendURL"].(string)
assertHTTPResultWithRetry(t, endpoint+"nginx", maxWait, func(body string) bool {
assertHTTPResultWithRetry(t, endpoint, maxWait, func(body string) bool {
return assert.Contains(t, body, "Hello, Pulumi!")
})
},
Expand Down Expand Up @@ -140,7 +140,7 @@ func TestExamples(t *testing.T) {
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
maxWait := 10 * time.Minute
endpoint := stack.Outputs["frontendURL"].(string)
assertHTTPResultWithRetry(t, endpoint+"nginx", maxWait, func(body string) bool {
assertHTTPResultWithRetry(t, endpoint, maxWait, func(body string) bool {
return assert.Contains(t, body, "Hello, Pulumi!")
})
},
Expand Down

0 comments on commit f93239b

Please sign in to comment.