Ensure that "pulumi about" fails correctly
@@ -12,46 +12,49 @@ import (
func TestAboutCommands(t *testing.T) {
stackName := "pulumi-about"
- // pulumi about
- t.Run("plainAbout", func(t *testing.T) {
+
+ // pulumi about --json
+
+ // Note: Order matters. We rely on there being no current stack to garentee
+ // warnings will be generated.
+ t.Run("jsonAbout", func(t *testing.T) {
e := ptesting.NewEnvironment(t)
defer func() {
if !t.Failed() {
e.DeleteEnvironment()
}
}()
-
integration.CreateBasicPulumiRepo(e)
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, "There should be no errors")
+ stdout, stderr := e.RunCommand("pulumi", "about", "--json")
+ 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())
assert.Contains(t, stdout, runtime.Compiler)
assert.Containsf(t, stdout, "Current Stack: %s", *currentStack)
})
- // pulumi about --json
- t.Run("jsonAbout", func(t *testing.T) {
+
+ // pulumi about
+ t.Run("plainAbout", func(t *testing.T) {
e := ptesting.NewEnvironment(t)
defer func() {
if !t.Failed() {
e.DeleteEnvironment()
}
}()
-
integration.CreateBasicPulumiRepo(e)
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", "--json")
- assert.Contains(t, stderr, "warning")
- var res interface{}
- assert.Nil(t, json.Unmarshal([]byte(stdout), &res), "Should be valid json")
+ stdout, stderr := e.RunCommand("pulumi", "about")
+ 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)
