Remove unnecessayr usage of APIGateway from tests.
MODIFY
aws-js-containers/index.js
aws-js-containers/index.js
+const pulumi = require("@pulumi/pulumi");
const awsx = require("@pulumi/awsx");
-let cluster = new awsx.ecs.Cluster("example", { });
+// 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: {
@@ -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 `http://${listener.endpoint.hostname}/`;

MODIFY
aws-ts-containers/index.ts
aws-ts-containers/index.ts
@@ -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 `http://${listener.endpoint.hostname}/`;

MODIFY
misc/test/examples_test.go
misc/test/examples_test.go
@@ -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!")
})
},
@@ -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!")
})
},

Remove unnecessayr usage of APIGateway from tests. (#258)