Add failing test replicating #4013
This commit is contained in:
parent
5ec446718a
commit
890e214c00
|
@ -8,6 +8,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"bytes"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
@ -413,6 +414,34 @@ func TestRefresh_varFileDefault(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRefresh_varsUnset(t *testing.T) {
|
||||||
|
// Disable test mode so input would be asked
|
||||||
|
test = false
|
||||||
|
defer func() { test = true }()
|
||||||
|
|
||||||
|
defaultInputReader = bytes.NewBufferString("bar\n")
|
||||||
|
|
||||||
|
state := testState()
|
||||||
|
statePath := testStateFile(t, state)
|
||||||
|
|
||||||
|
p := testProvider()
|
||||||
|
ui := new(cli.MockUi)
|
||||||
|
c := &RefreshCommand{
|
||||||
|
Meta: Meta{
|
||||||
|
ContextOpts: testCtxConfig(p),
|
||||||
|
Ui: ui,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
args := []string{
|
||||||
|
"-state", statePath,
|
||||||
|
testFixturePath("refresh-unset-var"),
|
||||||
|
}
|
||||||
|
if code := c.Run(args); code != 0 {
|
||||||
|
t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRefresh_backup(t *testing.T) {
|
func TestRefresh_backup(t *testing.T) {
|
||||||
state := testState()
|
state := testState()
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
variable "should_ask" {}
|
||||||
|
|
||||||
|
provider "test" {}
|
||||||
|
|
||||||
|
resource "test_instance" "foo" {
|
||||||
|
ami = "${var.should_ask}"
|
||||||
|
}
|
Loading…
Reference in New Issue