11package tests
22
33import (
4+ "os"
5+
46 "github.com/pulumi/providertest/pulumitest"
57
68 "path/filepath"
@@ -10,21 +12,23 @@ import (
1012 "github.com/pulumi/pulumi/sdk/v3/go/auto/optpreview"
1113)
1214
13- func runCycle (t * testing.T , basePath string , folder string ) * pulumitest.PulumiTest {
14- p := pulumitest .NewPulumiTest (t , filepath .Join (basePath , "01-iam" ), opttest .StackName ("prod" ), opttest .SkipInstall ())
15- p .UpdateSource (t , filepath .Join (basePath , folder ))
15+ func runCycle (t * testing.T , basePath string , folder string , additionalConfig map [string ]string ) * pulumitest.PulumiTest {
16+ os .MkdirAll ("/tmp/.pulumi" , os .FileMode (0777 ))
17+ os .Setenv ("PULUMI_BACKEND_URL" , "file:///tmp/.pulumi" )
18+ p := pulumitest .NewPulumiTest (t , filepath .Join (basePath , folder ), opttest .StackName ("prod" ), opttest .SkipInstall (), opttest .UseAmbientBackend ())
1619 CopyFile (filepath .Join (p .WorkingDir (), "Pulumi.README.yaml" ), filepath .Join (p .WorkingDir (), "Pulumi.prod.yaml" ))
17- p .SetConfig (t , "aws:region" , "us-east-1" )
20+ p .SetConfig (t , "aws:region" , "us-west-2" )
21+ if additionalConfig != nil {
22+ for key , value := range additionalConfig {
23+ p .SetConfig (t , key , value )
24+ }
25+ }
1826 p .Install (t )
1927 p .Up (t )
2028 p .Preview (t , optpreview .ExpectNoChanges ())
2129 return p
2230}
2331func TestAwsEksTsExamples (t * testing.T ) {
24- // "01-iam"
25- // "02-networking",
26- // "05-eks-cluster",
27- // "10-cluster-svcs",
2832 // "15-state-policies-mgmt",
2933 // "20-database",
3034 // "25-insights",
@@ -35,15 +39,14 @@ func TestAwsEksTsExamples(t *testing.T) {
3539 t .Run ("TestAwsEksTs" , func (t * testing.T ) {
3640 checkAwsEnvVars (t )
3741 basePath := "../eks-hosted"
38- iam := runCycle (t , basePath , "01-iam" )
39- networking := runCycle (t , basePath , "02-networking" )
40- // p01 := pulumitest.NewPulumiTest(t, filepath.Join(basePath, "01-iam"), opttest.StackName("prod"), opttest.SkipInstall())
41- // CopyFile(filepath.Join(p01.WorkingDir(), "Pulumi.README.yaml"), filepath.Join(p01.WorkingDir(), "Pulumi.prod.yaml"))
42- // p01.SetConfig(t, "aws:region", "us-east-1")
43- // p01.Install(t)
44- // p01.Up(t)
45- // p01.Preview(t, optpreview.ExpectNoChanges())
46- defer networking .Destroy (t )
42+ var emptyConfig map [string ]string
43+ iam := runCycle (t , basePath , "01-iam" , emptyConfig )
4744 defer iam .Destroy (t )
45+ networking := runCycle (t , basePath , "02-networking" , emptyConfig )
46+ defer networking .Destroy (t )
47+ eksCluster := runCycle (t , basePath , "05-eks-cluster" , emptyConfig )
48+ defer eksCluster .Destroy (t )
49+ clusterSvcs := runCycle (t , basePath , "10-cluster-svcs" , emptyConfig )
50+ defer clusterSvcs .Destroy (t )
4851 })
4952}
0 commit comments