mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
b738cdb19f
This make the plan `Empty` concept more closely match the legacy diff behavior. Remove old unknown field from plan_test
66 lines
1.5 KiB
Go
66 lines
1.5 KiB
Go
package plans
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/go-test/deep"
|
|
|
|
"github.com/hashicorp/terraform/addrs"
|
|
)
|
|
|
|
func TestProviderAddrs(t *testing.T) {
|
|
|
|
plan := &Plan{
|
|
VariableValues: map[string]DynamicValue{},
|
|
Changes: &Changes{
|
|
Resources: []*ResourceInstanceChangeSrc{
|
|
{
|
|
Addr: addrs.Resource{
|
|
Mode: addrs.ManagedResourceMode,
|
|
Type: "test_thing",
|
|
Name: "woot",
|
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
|
ProviderAddr: addrs.ProviderConfig{
|
|
Type: "test",
|
|
}.Absolute(addrs.RootModuleInstance),
|
|
},
|
|
{
|
|
Addr: addrs.Resource{
|
|
Mode: addrs.ManagedResourceMode,
|
|
Type: "test_thing",
|
|
Name: "woot",
|
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
|
DeposedKey: "foodface",
|
|
ProviderAddr: addrs.ProviderConfig{
|
|
Type: "test",
|
|
}.Absolute(addrs.RootModuleInstance),
|
|
},
|
|
{
|
|
Addr: addrs.Resource{
|
|
Mode: addrs.ManagedResourceMode,
|
|
Type: "test_thing",
|
|
Name: "what",
|
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
|
ProviderAddr: addrs.ProviderConfig{
|
|
Type: "test",
|
|
}.Absolute(addrs.RootModuleInstance.Child("foo", addrs.NoKey)),
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
got := plan.ProviderAddrs()
|
|
want := []addrs.AbsProviderConfig{
|
|
addrs.ProviderConfig{
|
|
Type: "test",
|
|
}.Absolute(addrs.RootModuleInstance.Child("foo", addrs.NoKey)),
|
|
addrs.ProviderConfig{
|
|
Type: "test",
|
|
}.Absolute(addrs.RootModuleInstance),
|
|
}
|
|
|
|
for _, problem := range deep.Equal(got, want) {
|
|
t.Error(problem)
|
|
}
|
|
}
|