Fix bad string match that was causing TestInitProviderNotFound to fail on Macs

The tmp directory path is longer on Macs than other systems and was wrapping
across lines when printed, breaking the string match in the test.

Fix suggested by @apparentlymart is to add two spaces before the leading
'-' when printing to prevent the diagnostic renderer wrapping the line.
pull/26412/head
Owen Tuz 6 years ago
parent fc94c819e5
commit 5453147381

@ -357,7 +357,7 @@ func TestInitProviderNotFound(t *testing.T) {
t.Fatal("expected error, got success")
}
if !strings.Contains(stderr, "provider registry.terraform.io/hashicorp/nonexist was not\nfound in any of the search locations\n\n- "+pluginDir) {
if !strings.Contains(stderr, "provider registry.terraform.io/hashicorp/nonexist was not\nfound in any of the search locations\n\n - "+pluginDir) {
t.Errorf("expected error message is missing from output:\n%s", stderr)
}
})

@ -505,7 +505,7 @@ func (c *InitCommand) getProviders(config *configs.Config, state *states.State,
sources := errorTy.Sources
displaySources := make([]string, len(sources))
for i, source := range sources {
displaySources[i] = fmt.Sprintf("- %s", source)
displaySources[i] = fmt.Sprintf(" - %s", source)
}
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,

Loading…
Cancel
Save