fix show-json test to expect error from nested mod
One of the show json command tests expected no error when presented with an invalid configuration in a nested module. Modify the test created in PR #21569 so that it can still verify there is no panic, but now expect an error from init.
This commit is contained in:
parent
8111050c66
commit
e4640a43d7
|
@ -5,6 +5,7 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
@ -153,6 +154,8 @@ func TestShow_json_output(t *testing.T) {
|
|||
defer os.RemoveAll(td)
|
||||
defer testChdir(t, td)()
|
||||
|
||||
expectError := strings.Contains(entry.Name(), "error")
|
||||
|
||||
p := showFixtureProvider()
|
||||
ui := new(cli.MockUi)
|
||||
m := Meta{
|
||||
|
@ -171,6 +174,10 @@ func TestShow_json_output(t *testing.T) {
|
|||
},
|
||||
}
|
||||
if code := ic.Run([]string{}); code != 0 {
|
||||
if expectError {
|
||||
// this should error, but not panic.
|
||||
return
|
||||
}
|
||||
t.Fatalf("init failed\n%s", ui.ErrorWriter)
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
module "my_module" {
|
||||
source = "./modules"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
module "more" {
|
||||
source = "./more-modules"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
variable "misspelled" {
|
||||
default = "ehllo"
|
||||
descriptoni = "I am a misspelled attribute"
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
variable "misspelled" {
|
||||
default = "ehllo"
|
||||
descriptoni = "I am a misspelled attribute"
|
||||
variable "ok" {
|
||||
default = "something"
|
||||
description = "description"
|
||||
}
|
||||
|
|
|
@ -12,7 +12,15 @@
|
|||
"module": {
|
||||
"module_calls": {
|
||||
"more": {
|
||||
"module": {}
|
||||
"module": {
|
||||
"variables": {
|
||||
"ok": {
|
||||
"default": "something",
|
||||
"description": "description"
|
||||
}
|
||||
}
|
||||
},
|
||||
"source": "./more-modules"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue