pulumi/sdk/go/x/auto/up_test.go

49 lines
1.2 KiB
Go
Raw Normal View History

2020-07-07 23:25:11 +02:00
package auto
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
)
func TestUpBasic(t *testing.T) {
2020-07-07 23:25:11 +02:00
p := Project{
Name: "testproj",
SourcePath: filepath.Join(".", "test", "testproj"),
}
s := &Stack{
Name: "int_test",
Project: p,
Overrides: &StackOverrides{
Config: map[string]string{"bar": "abc"},
Secrets: map[string]string{"buzz": "secret"},
},
}
res, err := s.Up()
if err != nil {
t.Errorf("up failed, err: %v", err)
t.FailNow()
}
assert.Equal(t, 2, len(res.Outputs), "expected two plain outputs")
assert.Equal(t, 1, len(res.SecretOutputs), "expected one secret output")
assert.Equal(t, "foo", res.Outputs["exp_static"])
assert.Equal(t, "abc", res.Outputs["exp_cfg"])
assert.Equal(t, "secret", res.SecretOutputs["exp_secret"])
assert.Equal(t, "update", res.Summary.Kind)
assert.Equal(t, "succeeded", res.Summary.Result)
2020-07-16 17:47:04 +02:00
dRes, err := s.Destroy()
if err != nil {
t.Errorf("destroy failed, err: %v", err)
t.FailNow()
}
assert.Equal(t, "destroy", dRes.Summary.Kind)
assert.Equal(t, "succeeded", dRes.Summary.Result)
2020-07-17 03:50:34 +02:00
err = s.Remove()
assert.Nil(t, err, "failed to remove stack. Resources have leaked.")
2020-07-07 23:25:11 +02:00
}