warnings are now on stderr
This commit is contained in:
parent
c2af5333e8
commit
ef4fee5acb
|
@ -250,19 +250,11 @@ func TestInitProviders_pluginCache(t *testing.T) {
|
||||||
// convert the slashes if building for windows.
|
// convert the slashes if building for windows.
|
||||||
p := filepath.FromSlash("./cache")
|
p := filepath.FromSlash("./cache")
|
||||||
cmd.Env = append(cmd.Env, "TF_PLUGIN_CACHE_DIR="+p)
|
cmd.Env = append(cmd.Env, "TF_PLUGIN_CACHE_DIR="+p)
|
||||||
cmd.Stdin = nil
|
|
||||||
cmd.Stderr = &bytes.Buffer{}
|
|
||||||
|
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %s", err)
|
t.Errorf("unexpected error: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
stderr := cmd.Stderr.(*bytes.Buffer).String()
|
|
||||||
if stderr != "" {
|
|
||||||
t.Errorf("unexpected stderr output:\n%s\n", stderr)
|
|
||||||
}
|
|
||||||
|
|
||||||
path := filepath.FromSlash(fmt.Sprintf(".terraform/providers/registry.terraform.io/hashicorp/template/2.1.0/%s_%s/terraform-provider-template_v2.1.0_x4", runtime.GOOS, runtime.GOARCH))
|
path := filepath.FromSlash(fmt.Sprintf(".terraform/providers/registry.terraform.io/hashicorp/template/2.1.0/%s_%s/terraform-provider-template_v2.1.0_x4", runtime.GOOS, runtime.GOARCH))
|
||||||
content, err := tf.ReadFile(path)
|
content, err := tf.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -375,13 +367,13 @@ func TestInitProviderWarnings(t *testing.T) {
|
||||||
tf := e2e.NewBinary(terraformBin, fixturePath)
|
tf := e2e.NewBinary(terraformBin, fixturePath)
|
||||||
defer tf.Close()
|
defer tf.Close()
|
||||||
|
|
||||||
stdout, _, err := tf.Run("init")
|
_, stderr, err := tf.Run("init")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("expected error, got success")
|
t.Fatal("expected error, got success")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.Contains(stdout, "This provider is archived and no longer needed. The terraform_remote_state\ndata source is built into the latest Terraform release.") {
|
if !strings.Contains(stderr, "This provider is archived and no longer needed. The terraform_remote_state\ndata source is built into the latest Terraform release.") {
|
||||||
t.Errorf("expected warning message is missing from output:\n%s", stdout)
|
t.Errorf("expected warning message is missing from output:\n%s", stderr)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ func TestProviderDevOverrides(t *testing.T) {
|
||||||
if got, want := stdout, `The configuration is valid, but`; !strings.Contains(got, want) {
|
if got, want := stdout, `The configuration is valid, but`; !strings.Contains(got, want) {
|
||||||
t.Errorf("stdout doesn't include the success message\nwant: %s\n%s", want, got)
|
t.Errorf("stdout doesn't include the success message\nwant: %s\n%s", want, got)
|
||||||
}
|
}
|
||||||
if got, want := stdout, `Provider development overrides are in effect`; !strings.Contains(got, want) {
|
if got, want := stderr, `Provider development overrides are in effect`; !strings.Contains(got, want) {
|
||||||
t.Errorf("stdout doesn't include the warning about development overrides\nwant: %s\n%s", want, got)
|
t.Errorf("stdout doesn't include the warning about development overrides\nwant: %s\n%s", want, got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue