mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-25 16:31:10 -06:00
remove outdated tests
These cases are now caught early in the configuration loading process, and do not make it to the point of graph transformation.
This commit is contained in:
parent
da252de1a0
commit
9b11ff0358
@ -1,10 +0,0 @@
|
||||
provider "aws" {
|
||||
alias = "foo"
|
||||
}
|
||||
|
||||
module "mod" {
|
||||
source = "./mod"
|
||||
providers = {
|
||||
aws = aws.foo
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
resource "aws_instance" "bar" {
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
provider "aws" {
|
||||
}
|
||||
|
||||
module "mod" {
|
||||
source = "./mod"
|
||||
|
||||
# aws.foo doesn't exist, and should report an error
|
||||
providers = {
|
||||
aws = aws.foo
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
resource "aws_resource" "foo" {
|
||||
}
|
@ -434,69 +434,6 @@ func TestProviderConfigTransformer_grandparentProviders(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// pass a specific provider into a module using it implicitly
|
||||
func TestProviderConfigTransformer_implicitModule(t *testing.T) {
|
||||
mod := testModule(t, "transform-provider-implicit-module")
|
||||
concrete := func(a *NodeAbstractProvider) dag.Vertex { return a }
|
||||
|
||||
g := Graph{Path: addrs.RootModuleInstance}
|
||||
{
|
||||
tf := &ConfigTransformer{Config: mod}
|
||||
if err := tf.Transform(&g); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
tf := &AttachResourceConfigTransformer{Config: mod}
|
||||
if err := tf.Transform(&g); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
tf := TransformProviders([]string{"aws"}, concrete, mod)
|
||||
if err := tf.Transform(&g); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
actual := strings.TrimSpace(g.String())
|
||||
expected := strings.TrimSpace(`module.mod.aws_instance.bar
|
||||
provider["registry.terraform.io/hashicorp/aws"].foo
|
||||
provider["registry.terraform.io/hashicorp/aws"].foo`)
|
||||
if actual != expected {
|
||||
t.Fatalf("wrong result\n\nexpected:\n%s\n\ngot:\n%s", expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
// error out when a non-existent provider is named in a module providers map
|
||||
func TestProviderConfigTransformer_invalidProvider(t *testing.T) {
|
||||
mod := testModule(t, "transform-provider-invalid")
|
||||
concrete := func(a *NodeAbstractProvider) dag.Vertex { return a }
|
||||
|
||||
g := Graph{Path: addrs.RootModuleInstance}
|
||||
{
|
||||
tf := &ConfigTransformer{Config: mod}
|
||||
if err := tf.Transform(&g); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
tf := &AttachResourceConfigTransformer{Config: mod}
|
||||
if err := tf.Transform(&g); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
tf := TransformProviders([]string{"aws"}, concrete, mod)
|
||||
err := tf.Transform(&g)
|
||||
if err == nil {
|
||||
t.Fatal("expected missing provider error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), `provider["registry.terraform.io/hashicorp/aws"].foo`) {
|
||||
t.Fatalf("error should reference missing provider, got: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
const testTransformProviderBasicStr = `
|
||||
aws_instance.web
|
||||
provider["registry.terraform.io/hashicorp/aws"]
|
||||
|
Loading…
Reference in New Issue
Block a user