add additional warning that providers won't be downloaded

pull/37893/head^2
Daniel Schmidt 4 months ago
parent 1b662d78e5
commit 053738fbf0

@ -86,13 +86,17 @@ func TestProviderDevOverrides(t *testing.T) {
t.Errorf("stdout doesn't include the warning about development overrides\nwant: %s\n%s", want, got)
}
stdout, stderr, err = tf.Run("init")
stdout, _, _ = tf.Run("init")
if err != nil {
t.Fatalf("unexpected error: %e", err)
}
if got, want := stdout, `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)
}
if got, want := stdout, "These providers are not installed as part of init since they"; !strings.Contains(got, want) {
t.Errorf("stdout doesn't include init specific warning about consequences of overrides \nwant: %s\n%s", want, got)
}
}
func TestProviderDevOverridesWithProviderToDownload(t *testing.T) {
@ -139,7 +143,7 @@ func TestProviderDevOverridesWithProviderToDownload(t *testing.T) {
tf.AddEnv("TF_CLI_CONFIG_FILE=dev.tfrc")
stdout, stderr, err := tf.Run("providers")
stdout, stderr, _ := tf.Run("providers")
if err != nil {
t.Fatalf("unexpected error: %s\n%s", err, stderr)
}
@ -147,13 +151,16 @@ func TestProviderDevOverridesWithProviderToDownload(t *testing.T) {
t.Errorf("configuration should depend on %s, but doesn't\n%s", want, got)
}
stdout, stderr, err = tf.Run("init")
stdout, _, err = tf.Run("init")
if err != nil {
t.Fatalf("unexpected error: %e", err)
}
if got, want := stdout, `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)
}
if got, want := stdout, "These providers are not installed as part of init since they were"; !strings.Contains(got, want) {
t.Errorf("stdout doesn't include init specific warning about consequences of overrides \nwant: %s\n got: %s", want, got)
}
// Check if the null provider has been installed
const providerVersion = "3.1.0" // must match the version in the fixture config

@ -177,6 +177,7 @@ func (m *Meta) providerDevOverrideInitWarnings() tfdiags.Diagnostics {
for addr, path := range m.ProviderDevOverrides {
detailMsg.WriteString(fmt.Sprintf(" - %s in %s\n", addr.ForDisplay(), path))
}
detailMsg.WriteString("\nThese providers are not installed as part of init since they were overwritten. If this is unintentional please re-run without the development overrides set.")
return tfdiags.Diagnostics{
tfdiags.Sourceless(
tfdiags.Warning,

Loading…
Cancel
Save