remove implicit provier tests from config/module

No longer needed
This commit is contained in:
James Bardin 2017-11-02 15:43:45 -04:00
parent 523b121341
commit b4e9240679
6 changed files with 0 additions and 137 deletions

View File

@ -1,2 +0,0 @@
resource "bar_resource" "in_grandchild" {}

View File

@ -1,9 +0,0 @@
resource "foo_resource" "in_child" {}
provider "bar" {
value = "from child"
}
module "grandchild" {
source = "./grandchild"
}

View File

@ -1,7 +0,0 @@
provider "foo" {
value = "from root"
}
module "child" {
source = "./child"
}

View File

@ -1 +0,0 @@
resource "foo_instance" "bar" {}

View File

@ -1,7 +0,0 @@
provider "foo" {
value = "from root"
}
module "child" {
source = "./child"
}

View File

@ -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) { func TestTreeLoad_conflictingSubmoduleNames(t *testing.T) {
storage := testStorage(t, nil) storage := testStorage(t, nil)
tree := NewTree("", testConfig(t, "conficting-submodule-names")) tree := NewTree("", testConfig(t, "conficting-submodule-names"))