initwd: Fix registry acceptance tests for upstream registry changes
We have some tests in this package that install real modules from the real registry at registry.terraform.io. Those tests were written at an earlier time when the registry's behavior was to return the URL of a .tar.gz archive generated automatically by GitHub, which included an extra level of subdirectory that would then be reflected in the paths to the local copies of these modules. GitHub started rate limiting those tar archives in a way that Terraform's module installer couldn't authenticate to, and so the registry switched to returning direct git repository URLs instead, which don't have that extra subdirectory and so the local paths on disk now end up being a little different, because the actual module directories are at a different subdirectory of the package.
This commit is contained in:
parent
17b766c3ea
commit
7b2a0284e0
|
@ -1,7 +1,6 @@
|
|||
package initwd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -65,17 +64,28 @@ func TestDirFromModule_registry(t *testing.T) {
|
|||
Name: "Install",
|
||||
ModuleAddr: "root",
|
||||
Version: v,
|
||||
LocalPath: filepath.Join(dir, fmt.Sprintf(".terraform/modules/root/terraform-aws-module-installer-acctest-%s", v)),
|
||||
// NOTE: This local path and the other paths derived from it below
|
||||
// can vary depending on how the registry is implemented. At the
|
||||
// time of writing this test, registry.terraform.io returns
|
||||
// git repository source addresses and so this path refers to the
|
||||
// root of the git clone, but historically the registry referred
|
||||
// to GitHub-provided tar archives which meant that there was an
|
||||
// extra level of subdirectory here for the typical directory
|
||||
// nesting in tar archives, which would've been reflected as
|
||||
// an extra segment on this path. If this test fails due to an
|
||||
// additional path segment in future, then a change to the upstream
|
||||
// registry might be the root cause.
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/root"),
|
||||
},
|
||||
{
|
||||
Name: "Install",
|
||||
ModuleAddr: "root.child_a",
|
||||
LocalPath: filepath.Join(dir, fmt.Sprintf(".terraform/modules/root/terraform-aws-module-installer-acctest-%s/modules/child_a", v)),
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/root/modules/child_a"),
|
||||
},
|
||||
{
|
||||
Name: "Install",
|
||||
ModuleAddr: "root.child_a.child_b",
|
||||
LocalPath: filepath.Join(dir, fmt.Sprintf(".terraform/modules/root/terraform-aws-module-installer-acctest-%s/modules/child_b", v)),
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/root/modules/child_b"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -331,7 +331,18 @@ func TestLoaderInstallModules_registry(t *testing.T) {
|
|||
Name: "Install",
|
||||
ModuleAddr: "acctest_child_a",
|
||||
Version: v,
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_child_a/terraform-aws-module-installer-acctest-0.0.1/modules/child_a"),
|
||||
// NOTE: This local path and the other paths derived from it below
|
||||
// can vary depending on how the registry is implemented. At the
|
||||
// time of writing this test, registry.terraform.io returns
|
||||
// git repository source addresses and so this path refers to the
|
||||
// root of the git clone, but historically the registry referred
|
||||
// to GitHub-provided tar archives which meant that there was an
|
||||
// extra level of subdirectory here for the typical directory
|
||||
// nesting in tar archives, which would've been reflected as
|
||||
// an extra segment on this path. If this test fails due to an
|
||||
// additional path segment in future, then a change to the upstream
|
||||
// registry might be the root cause.
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_child_a/modules/child_a"),
|
||||
},
|
||||
|
||||
// acctest_child_a.child_b
|
||||
|
@ -339,7 +350,7 @@ func TestLoaderInstallModules_registry(t *testing.T) {
|
|||
{
|
||||
Name: "Install",
|
||||
ModuleAddr: "acctest_child_a.child_b",
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_child_a/terraform-aws-module-installer-acctest-0.0.1/modules/child_b"),
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_child_a/modules/child_b"),
|
||||
},
|
||||
|
||||
// acctest_child_b accesses //modules/child_b directly
|
||||
|
@ -353,7 +364,7 @@ func TestLoaderInstallModules_registry(t *testing.T) {
|
|||
Name: "Install",
|
||||
ModuleAddr: "acctest_child_b",
|
||||
Version: v,
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_child_b/terraform-aws-module-installer-acctest-0.0.1/modules/child_b"),
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_child_b/modules/child_b"),
|
||||
},
|
||||
|
||||
// acctest_root
|
||||
|
@ -367,7 +378,7 @@ func TestLoaderInstallModules_registry(t *testing.T) {
|
|||
Name: "Install",
|
||||
ModuleAddr: "acctest_root",
|
||||
Version: v,
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_root/terraform-aws-module-installer-acctest-0.0.1"),
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_root"),
|
||||
},
|
||||
|
||||
// acctest_root.child_a
|
||||
|
@ -375,7 +386,7 @@ func TestLoaderInstallModules_registry(t *testing.T) {
|
|||
{
|
||||
Name: "Install",
|
||||
ModuleAddr: "acctest_root.child_a",
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_root/terraform-aws-module-installer-acctest-0.0.1/modules/child_a"),
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_root/modules/child_a"),
|
||||
},
|
||||
|
||||
// acctest_root.child_a.child_b
|
||||
|
@ -383,7 +394,7 @@ func TestLoaderInstallModules_registry(t *testing.T) {
|
|||
{
|
||||
Name: "Install",
|
||||
ModuleAddr: "acctest_root.child_a.child_b",
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_root/terraform-aws-module-installer-acctest-0.0.1/modules/child_b"),
|
||||
LocalPath: filepath.Join(dir, ".terraform/modules/acctest_root/modules/child_b"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue