Correctly handle empty stack in tests
@@ -11,6 +11,7 @@ import (
)
func TestAboutCommands(t *testing.T) {
+ stackName := "pulumi-about"
// pulumi about
t.Run("plainAbout", func(t *testing.T) {
e := ptesting.NewEnvironment(t)
@@ -24,9 +25,11 @@ func TestAboutCommands(t *testing.T) {
e.SetBackend(e.LocalURL())
e.RunCommand("yarn", "install")
e.RunCommand("yarn", "link", "@pulumi/pulumi")
+ e.RunCommand("pulumi", "stack", "init", stackName)
+ e.RunCommand("pulumi", "up", "--non-interactive", "--yes", "--skip-preview")
_, currentStack := integration.GetStacks(e)
stdout, stderr := e.RunCommand("pulumi", "about")
- assert.Empty(t, stderr, "We shouldn't print anything to stderr")
+ assert.Empty(t, stderr, "There should be no errors")
assert.Contains(t, stdout, runtime.Version())
assert.Contains(t, stdout, runtime.Compiler)
assert.Containsf(t, stdout, "Current Stack: %s", *currentStack)
@@ -46,7 +49,7 @@ func TestAboutCommands(t *testing.T) {
e.RunCommand("yarn", "link", "@pulumi/pulumi")
_, currentStack := integration.GetStacks(e)
stdout, stderr := e.RunCommand("pulumi", "about", "--json")
- assert.Empty(t, stderr, "We shouldn't print anything to stderr")
+ assert.Contains(t, stderr, "warning")
var res interface{}
assert.Nil(t, json.Unmarshal([]byte(stdout), &res), "Should be valid json")
assert.Contains(t, stdout, runtime.Version())
