mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
config/module: failing unit test for GH-1232
This commit is contained in:
parent
19c7f8cff4
commit
bd4aaac71a
3
config/module/test-fixtures/basic-parent/a/a.tf
Normal file
3
config/module/test-fixtures/basic-parent/a/a.tf
Normal file
@ -0,0 +1,3 @@
|
||||
module "b" {
|
||||
source = "../c"
|
||||
}
|
1
config/module/test-fixtures/basic-parent/c/c.tf
Normal file
1
config/module/test-fixtures/basic-parent/c/c.tf
Normal file
@ -0,0 +1 @@
|
||||
# Hello
|
3
config/module/test-fixtures/basic-parent/main.tf
Normal file
3
config/module/test-fixtures/basic-parent/main.tf
Normal file
@ -0,0 +1,3 @@
|
||||
module "a" {
|
||||
source = "./a"
|
||||
}
|
@ -94,6 +94,44 @@ func TestTreeLoad_duplicate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTreeLoad_parentRef(t *testing.T) {
|
||||
storage := testStorage(t)
|
||||
tree := NewTree("", testConfig(t, "basic-parent"))
|
||||
|
||||
if tree.Loaded() {
|
||||
t.Fatal("should not be loaded")
|
||||
}
|
||||
|
||||
// This should error because we haven't gotten things yet
|
||||
if err := tree.Load(storage, GetModeNone); err == nil {
|
||||
t.Fatal("should error")
|
||||
}
|
||||
|
||||
if tree.Loaded() {
|
||||
t.Fatal("should not be loaded")
|
||||
}
|
||||
|
||||
// This should get things
|
||||
if err := tree.Load(storage, GetModeGet); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
if !tree.Loaded() {
|
||||
t.Fatal("should be loaded")
|
||||
}
|
||||
|
||||
// This should no longer error
|
||||
if err := tree.Load(storage, GetModeNone); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
actual := strings.TrimSpace(tree.String())
|
||||
expected := strings.TrimSpace(treeLoadStr)
|
||||
if actual != expected {
|
||||
t.Fatalf("bad: \n\n%s", actual)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTreeLoad_subdir(t *testing.T) {
|
||||
storage := testStorage(t)
|
||||
tree := NewTree("", testConfig(t, "basic-subdir"))
|
||||
|
Loading…
Reference in New Issue
Block a user