Skip to content

Commit

Permalink
Three cloud example tests: cloud-js-containers, clouse-js-httpserver,…
Browse files Browse the repository at this point in the history
… and cloud-ts-url-shortener-cache-http. Cloud-ts-url-shortener-cache-http is currently failing on the assert for reasons I am not sure of so I am going ahead and committing and pushing up to PR to get some feedback.
  • Loading branch information
daveremy committed Oct 12, 2018
1 parent 35dee35 commit 2437f68
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions misc/test/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,53 @@ func TestExamples(t *testing.T) {
})
},
}),
base.With(integration.ProgramTestOptions{
Dir: path.Join(cwd, "..", "..", "cloud-js-containers"),
SkipBuild: true,
Config: map[string]string{
// Use us-west-2 to assure fargate is availablecd
"aws:region": "us-west-2",
"cloud-aws:useFargate": "true",
},
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
assertHTTPResult(t, stack.Outputs["hostname"], func(body string) bool {
return assert.Contains(t, body, "<p>Hello, containers!</p>")
})
},
}),
base.With(integration.ProgramTestOptions{
Dir: path.Join(cwd, "..", "..", "cloud-js-httpserver"),
SkipBuild: true,
Config: map[string]string{
"cloud:provider": "aws",
"aws:region": awsRegion,
},
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
assertHTTPResult(t, stack.Outputs["endpoint"].(string)+"/hello", func(body string) bool {
return assert.Contains(t, body, "{\"route\":\"/hello\",\"count\":1}")
})
},
}),
base.With(integration.ProgramTestOptions{
Dir: path.Join(cwd, "..", "..", "cloud-ts-url-shortener-cache-http"),
Verbose: true,
DebugLogLevel: 8,
DebugUpdates: true,
SkipBuild: true,
Config: map[string]string{
"url-shortener-cache:redisPassword": "s3cr7Password",
"cloud:provider": "aws",
// Use us-west-2 to assure fargate availability
"aws:region": "us-west-2",
"cloud-aws:useFargate": "true",
"cloud-aws:functionIncludePaths": "",
},
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
assertHTTPResult(t, stack.Outputs["endpointUrl"], func(body string) bool {
return assert.Contains(t, body, "<title>Short URL Manager</title>")
})
},
}),
// TODO: This test fails due to a bug in the Terraform Azure provider in which the
// service principal is not available when attempting to create the K8s cluster.
// See the azure-ts-aks-example readme for more detail.
Expand Down Expand Up @@ -233,6 +280,7 @@ func assertHTTPResultWithRetry(t *testing.T, output interface{}, maxWait time.Du
count, sleep := 0, 0
for true {
now := time.Now()
fmt.Println("Getting hostname: " + hostname)
resp, err = http.Get(hostname)
if err == nil {
break
Expand Down

0 comments on commit 2437f68

Please sign in to comment.