pulumi/examples/examples_test.go
Luke Hoban a350b1654f
Report test run data and timing to S3 (#560)
Add the ability to upload data and timing for test runs to S3. Uploaded data is designed to be queried via a service like AWS Athena and these queries can then be imported into BI tools (Excel, QuickSight, PowerBI, etc.)

Initially hook this up to the `minimal` test as a baseline.
2017-11-14 09:33:22 -08:00

63 lines
1.5 KiB
Go

// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
package examples
import (
"os"
"path"
"testing"
"github.com/stretchr/testify/assert"
"github.com/pulumi/pulumi/pkg/resource/stack"
"github.com/pulumi/pulumi/pkg/testing/integration"
)
func TestExamples(t *testing.T) {
cwd, err := os.Getwd()
if !assert.NoError(t, err, "expected a valid working directory: %v", err) {
return
}
var minimal integration.ProgramTestOptions
minimal = integration.ProgramTestOptions{
Dir: path.Join(cwd, "minimal"),
Dependencies: []string{"pulumi"},
Config: map[string]string{
"name": "Pulumi",
},
Secrets: map[string]string{
"secret": "this is my secret message",
},
ExtraRuntimeValidation: func(t *testing.T, checkpoint stack.Checkpoint) {
// Simple runtime validation that just ensures the checkpoint was written and read.
assert.Equal(t, minimal.StackName(), checkpoint.Target)
},
ReportStats: integration.NewS3Reporter("us-west-2", "eng.pulumi.com", "testreports"),
}
examples := []integration.ProgramTestOptions{
minimal,
{
Dir: path.Join(cwd, "dynamic-provider/simple"),
Dependencies: []string{"pulumi"},
Config: map[string]string{
"simple:config:w": "1",
"simple:config:x": "1",
"simple:config:y": "1",
},
},
{
Dir: path.Join(cwd, "dynamic-provider/multiple-turns"),
Dependencies: []string{"pulumi"},
},
}
for _, ex := range examples {
example := ex
t.Run(example.Dir, func(t *testing.T) {
integration.ProgramTest(t, example)
})
}
}