core: Fix TestContext2Apply_resourceDependsOnModuleStateOnly
This test was depending on InstanceInfo.HumanId, which is not something any real providers use and therefore not something our shims from new to old provider API supports. Instead, we'll give each of the instances a different id and use that to distinguish them for tracking apply order.
This commit is contained in:
parent
edc0ce6333
commit
f0b7d01072
|
@ -295,7 +295,7 @@ func TestContext2Apply_resourceDependsOnModuleStateOnly(t *testing.T) {
|
||||||
"aws_instance.a": &ResourceState{
|
"aws_instance.a": &ResourceState{
|
||||||
Type: "aws_instance",
|
Type: "aws_instance",
|
||||||
Primary: &InstanceState{
|
Primary: &InstanceState{
|
||||||
ID: "bar",
|
ID: "parent",
|
||||||
},
|
},
|
||||||
Dependencies: []string{"module.child"},
|
Dependencies: []string{"module.child"},
|
||||||
Provider: "provider.aws",
|
Provider: "provider.aws",
|
||||||
|
@ -308,7 +308,7 @@ func TestContext2Apply_resourceDependsOnModuleStateOnly(t *testing.T) {
|
||||||
"aws_instance.child": &ResourceState{
|
"aws_instance.child": &ResourceState{
|
||||||
Type: "aws_instance",
|
Type: "aws_instance",
|
||||||
Primary: &InstanceState{
|
Primary: &InstanceState{
|
||||||
ID: "bar",
|
ID: "child",
|
||||||
},
|
},
|
||||||
Provider: "provider.aws",
|
Provider: "provider.aws",
|
||||||
},
|
},
|
||||||
|
@ -326,8 +326,8 @@ func TestContext2Apply_resourceDependsOnModuleStateOnly(t *testing.T) {
|
||||||
info *InstanceInfo,
|
info *InstanceInfo,
|
||||||
is *InstanceState,
|
is *InstanceState,
|
||||||
id *InstanceDiff) (*InstanceState, error) {
|
id *InstanceDiff) (*InstanceState, error) {
|
||||||
if info.HumanId() == "aws_instance.a" {
|
|
||||||
|
|
||||||
|
if is.ID == "parent" {
|
||||||
// make the dep slower than the parent
|
// make the dep slower than the parent
|
||||||
time.Sleep(50 * time.Millisecond)
|
time.Sleep(50 * time.Millisecond)
|
||||||
|
|
||||||
|
@ -358,9 +358,7 @@ func TestContext2Apply_resourceDependsOnModuleStateOnly(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
state, diags := ctx.Apply()
|
state, diags := ctx.Apply()
|
||||||
if diags.HasErrors() {
|
assertNoErrors(t, diags)
|
||||||
t.Fatalf("diags: %s", diags.Err())
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(order, []string{"child", "parent"}) {
|
if !reflect.DeepEqual(order, []string{"child", "parent"}) {
|
||||||
t.Fatal("resources applied out of order")
|
t.Fatal("resources applied out of order")
|
||||||
|
|
Loading…
Reference in New Issue