core: Fix TestRefreshGraphBuilder_configOrphans
We now include explicit separate nodes in the graph for deposed instances, whereas before we just dealt with them inside the main nodes.
This commit is contained in:
parent
3b2834b8fc
commit
eddc29d6e4
|
@ -42,7 +42,7 @@ func TestRefreshGraphBuilder_configOrphans(t *testing.T) {
|
|||
},
|
||||
"data.test_object.foo.0": &ResourceState{
|
||||
Type: "test_object",
|
||||
Deposed: []*InstanceState{
|
||||
Deposed: []*InstanceState{ // NOTE: Real-world data resources don't get deposed
|
||||
&InstanceState{
|
||||
ID: "foo",
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ func TestRefreshGraphBuilder_configOrphans(t *testing.T) {
|
|||
},
|
||||
"data.test_object.foo.1": &ResourceState{
|
||||
Type: "test_object",
|
||||
Deposed: []*InstanceState{
|
||||
Deposed: []*InstanceState{ // NOTE: Real-world data resources don't get deposed
|
||||
&InstanceState{
|
||||
ID: "bar",
|
||||
},
|
||||
|
@ -58,7 +58,7 @@ func TestRefreshGraphBuilder_configOrphans(t *testing.T) {
|
|||
},
|
||||
"data.test_object.foo.2": &ResourceState{
|
||||
Type: "test_object",
|
||||
Deposed: []*InstanceState{
|
||||
Deposed: []*InstanceState{ // NOTE: Real-world data resources don't get deposed
|
||||
&InstanceState{
|
||||
ID: "baz",
|
||||
},
|
||||
|
@ -84,18 +84,36 @@ func TestRefreshGraphBuilder_configOrphans(t *testing.T) {
|
|||
expected := strings.TrimSpace(`
|
||||
data.test_object.foo[0] - *terraform.NodeRefreshableManagedResourceInstance
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
data.test_object.foo[0] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
data.test_object.foo[1] - *terraform.NodeRefreshableManagedResourceInstance
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
data.test_object.foo[1] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
data.test_object.foo[2] - *terraform.NodeRefreshableManagedResourceInstance
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
data.test_object.foo[2] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
provider.test (close) - *terraform.graphNodeCloseProvider
|
||||
data.test_object.foo[0] - *terraform.NodeRefreshableManagedResourceInstance
|
||||
data.test_object.foo[0] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
data.test_object.foo[1] - *terraform.NodeRefreshableManagedResourceInstance
|
||||
data.test_object.foo[1] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
data.test_object.foo[2] - *terraform.NodeRefreshableManagedResourceInstance
|
||||
data.test_object.foo[2] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
test_object.foo - *terraform.NodeRefreshableManagedResource
|
||||
test_object.foo[0] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
test_object.foo[1] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
test_object.foo[2] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
test_object.foo - *terraform.NodeRefreshableManagedResource
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
test_object.foo[0] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
test_object.foo[1] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
test_object.foo[2] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
|
||||
provider.test - *terraform.NodeApplyableProvider
|
||||
`)
|
||||
if expected != actual {
|
||||
t.Fatalf("wrong result\n\ngot:\n%s\n\nwant:\n%s", actual, expected)
|
||||
|
|
|
@ -43,7 +43,7 @@ var (
|
|||
)
|
||||
|
||||
func (n *NodePlanDeposedResourceInstanceObject) Name() string {
|
||||
return fmt.Sprintf("%s (deposed %s)", n.Addr.String(), n.DeposedKey)
|
||||
return fmt.Sprintf("%s (deposed %s)", n.ResourceInstanceAddr().String(), n.DeposedKey)
|
||||
}
|
||||
|
||||
func (n *NodePlanDeposedResourceInstanceObject) DeposedInstanceObjectKey() states.DeposedKey {
|
||||
|
|
Loading…
Reference in New Issue