From b4e92406795dc9910766e9d047ccf4627d36ae02 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Thu, 2 Nov 2017 15:43:45 -0400 Subject: [PATCH] remove implicit provier tests from config/module No longer needed --- .../child/grandchild/main.tf | 2 - .../child/main.tf | 9 -- .../implicit-grandparent-providers/main.tf | 7 -- .../implicit-parent-providers/child/main.tf | 1 - .../implicit-parent-providers/main.tf | 7 -- config/module/tree_test.go | 111 ------------------ 6 files changed, 137 deletions(-) delete mode 100644 config/module/test-fixtures/implicit-grandparent-providers/child/grandchild/main.tf delete mode 100644 config/module/test-fixtures/implicit-grandparent-providers/child/main.tf delete mode 100644 config/module/test-fixtures/implicit-grandparent-providers/main.tf delete mode 100644 config/module/test-fixtures/implicit-parent-providers/child/main.tf delete mode 100644 config/module/test-fixtures/implicit-parent-providers/main.tf diff --git a/config/module/test-fixtures/implicit-grandparent-providers/child/grandchild/main.tf b/config/module/test-fixtures/implicit-grandparent-providers/child/grandchild/main.tf deleted file mode 100644 index 492e4d0e40..0000000000 --- a/config/module/test-fixtures/implicit-grandparent-providers/child/grandchild/main.tf +++ /dev/null @@ -1,2 +0,0 @@ -resource "bar_resource" "in_grandchild" {} - diff --git a/config/module/test-fixtures/implicit-grandparent-providers/child/main.tf b/config/module/test-fixtures/implicit-grandparent-providers/child/main.tf deleted file mode 100644 index 1ab8b908e3..0000000000 --- a/config/module/test-fixtures/implicit-grandparent-providers/child/main.tf +++ /dev/null @@ -1,9 +0,0 @@ -resource "foo_resource" "in_child" {} - -provider "bar" { - value = "from child" -} - -module "grandchild" { - source = "./grandchild" -} diff --git a/config/module/test-fixtures/implicit-grandparent-providers/main.tf b/config/module/test-fixtures/implicit-grandparent-providers/main.tf deleted file mode 100644 index 2c06ab5553..0000000000 --- a/config/module/test-fixtures/implicit-grandparent-providers/main.tf +++ /dev/null @@ -1,7 +0,0 @@ -provider "foo" { - value = "from root" -} - -module "child" { - source = "./child" -} diff --git a/config/module/test-fixtures/implicit-parent-providers/child/main.tf b/config/module/test-fixtures/implicit-parent-providers/child/main.tf deleted file mode 100644 index 2601241294..0000000000 --- a/config/module/test-fixtures/implicit-parent-providers/child/main.tf +++ /dev/null @@ -1 +0,0 @@ -resource "foo_instance" "bar" {} diff --git a/config/module/test-fixtures/implicit-parent-providers/main.tf b/config/module/test-fixtures/implicit-parent-providers/main.tf deleted file mode 100644 index 2c06ab5553..0000000000 --- a/config/module/test-fixtures/implicit-parent-providers/main.tf +++ /dev/null @@ -1,7 +0,0 @@ -provider "foo" { - value = "from root" -} - -module "child" { - source = "./child" -} diff --git a/config/module/tree_test.go b/config/module/tree_test.go index 2e23f1aad1..acc622c3f8 100644 --- a/config/module/tree_test.go +++ b/config/module/tree_test.go @@ -611,117 +611,6 @@ func TestTreeProviders_basic(t *testing.T) { } } -func TestTreeProviders_implicit(t *testing.T) { - storage := testStorage(t, nil) - tree := NewTree("", testConfig(t, "implicit-parent-providers")) - - storage.Mode = GetModeGet - if err := tree.Load(storage); err != nil { - t.Fatalf("err: %s", err) - } - - var child *Tree - for _, c := range tree.Children() { - if c.Name() == "child" { - child = c - } - } - - if child == nil { - t.Fatal("could not find module 'child'") - } - - // child should have inherited foo - providers := child.config.ProviderConfigsByFullName() - foo := providers["foo"] - - if foo == nil { - t.Fatal("could not find provider 'foo' in child module") - } - - if !reflect.DeepEqual([]string{RootName}, foo.Path) { - t.Fatalf(`expected foo scope of {"root"}, got %#v`, foo.Path) - } - - expected := map[string]interface{}{ - "value": "from root", - } - - if !reflect.DeepEqual(expected, foo.RawConfig.RawMap()) { - t.Fatalf(`expected "foo" config %#v, got: %#v`, expected, foo.RawConfig.RawMap()) - } -} - -func TestTreeProviders_implicitMultiLevel(t *testing.T) { - storage := testStorage(t, nil) - tree := NewTree("", testConfig(t, "implicit-grandparent-providers")) - - storage.Mode = GetModeGet - if err := tree.Load(storage); err != nil { - t.Fatalf("err: %s", err) - } - - var child, grandchild *Tree - for _, c := range tree.Children() { - if c.Name() == "child" { - child = c - } - } - - if child == nil { - t.Fatal("could not find module 'child'") - } - - for _, c := range child.Children() { - if c.Name() == "grandchild" { - grandchild = c - } - } - if grandchild == nil { - t.Fatal("could not find module 'grandchild'") - } - - // child should have inherited foo - providers := child.config.ProviderConfigsByFullName() - foo := providers["foo"] - - if foo == nil { - t.Fatal("could not find provider 'foo' in child module") - } - - if !reflect.DeepEqual([]string{RootName}, foo.Path) { - t.Fatalf(`expected foo scope of {"root"}, got %#v`, foo.Path) - } - - expected := map[string]interface{}{ - "value": "from root", - } - - if !reflect.DeepEqual(expected, foo.RawConfig.RawMap()) { - t.Fatalf(`expected "foo" config %#v, got: %#v`, expected, foo.RawConfig.RawMap()) - } - - // grandchild should have inherited bar - providers = grandchild.config.ProviderConfigsByFullName() - bar := providers["bar"] - - if bar == nil { - t.Fatal("could not find provider 'bar' in grandchild module") - } - - if !reflect.DeepEqual([]string{RootName, "child"}, bar.Path) { - t.Fatalf(`expected bar scope of {"root", "child"}, got %#v`, bar.Path) - } - - expected = map[string]interface{}{ - "value": "from child", - } - - if !reflect.DeepEqual(expected, bar.RawConfig.RawMap()) { - t.Fatalf(`expected "bar" config %#v, got: %#v`, expected, bar.RawConfig.RawMap()) - } -} - func TestTreeLoad_conflictingSubmoduleNames(t *testing.T) { storage := testStorage(t, nil) tree := NewTree("", testConfig(t, "conficting-submodule-names"))