mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
core: Remove uses of InstanceInfo.HumanId in context apply tests
This method is now removed, because our shims to the old provider API (which used InstanceInfo) now populate only the Type attribute and so HumanId would just generate garbage results anyway.
This commit is contained in:
parent
e3dad1bcc1
commit
0039d3dbf3
@ -407,7 +407,8 @@ func TestContext2Apply_resourceDependsOnModuleDestroy(t *testing.T) {
|
||||
info *InstanceInfo,
|
||||
is *InstanceState,
|
||||
id *InstanceDiff) (*InstanceState, error) {
|
||||
if info.HumanId() == "aws_instance.a" {
|
||||
|
||||
if id.Attributes["ami"].New == "parent" {
|
||||
checked = true
|
||||
|
||||
// Sleep to allow parallel execution
|
||||
@ -469,7 +470,8 @@ func TestContext2Apply_resourceDependsOnModuleGrandchild(t *testing.T) {
|
||||
info *InstanceInfo,
|
||||
is *InstanceState,
|
||||
id *InstanceDiff) (*InstanceState, error) {
|
||||
if info.HumanId() == "module.child.module.grandchild.aws_instance.c" {
|
||||
|
||||
if id.Attributes["ami"].New == "grandchild" {
|
||||
checked = true
|
||||
|
||||
// Sleep to allow parallel execution
|
||||
@ -521,11 +523,8 @@ func TestContext2Apply_resourceDependsOnModuleInModule(t *testing.T) {
|
||||
// called a child.
|
||||
var called int32
|
||||
var checked bool
|
||||
p.ApplyFn = func(
|
||||
info *InstanceInfo,
|
||||
is *InstanceState,
|
||||
id *InstanceDiff) (*InstanceState, error) {
|
||||
if info.HumanId() == "module.child.module.grandchild.aws_instance.c" {
|
||||
p.ApplyFn = func(info *InstanceInfo, is *InstanceState, id *InstanceDiff) (*InstanceState, error) {
|
||||
if id.Attributes["ami"].New == "child" {
|
||||
checked = true
|
||||
|
||||
// Sleep to allow parallel execution
|
||||
@ -3259,7 +3258,7 @@ func TestContext2Apply_multiProviderDestroy(t *testing.T) {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
|
||||
if info.HumanId() == "aws_instance.bar" {
|
||||
if info.Type == "aws_instance" {
|
||||
checked = true
|
||||
|
||||
// Sleep to allow parallel execution
|
||||
@ -3386,7 +3385,7 @@ func TestContext2Apply_multiProviderDestroyChild(t *testing.T) {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
|
||||
if info.HumanId() == "module.child.aws_instance.bar" {
|
||||
if info.Type == "aws_instance" {
|
||||
checked = true
|
||||
|
||||
// Sleep to allow parallel execution
|
||||
@ -3859,7 +3858,7 @@ func TestContext2Apply_multiVarCountDec(t *testing.T) {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
|
||||
if info.HumanId() == "aws_instance.bar" {
|
||||
if id.Attributes["ami"].New == "special" {
|
||||
checked = true
|
||||
|
||||
// Sleep to allow parallel execution
|
||||
|
@ -1,10 +1,12 @@
|
||||
variable "num" {}
|
||||
|
||||
resource "aws_instance" "foo" {
|
||||
count = "${var.num}"
|
||||
value = "foo"
|
||||
count = "${var.num}"
|
||||
value = "foo"
|
||||
}
|
||||
|
||||
resource "aws_instance" "bar" {
|
||||
value = "${join(",", aws_instance.foo.*.id)}"
|
||||
ami = "special"
|
||||
|
||||
value = "${join(",", aws_instance.foo.*.id)}"
|
||||
}
|
||||
|
@ -1 +1,3 @@
|
||||
resource "aws_instance" "c" {}
|
||||
resource "aws_instance" "c" {
|
||||
ami = "grandchild"
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
module "child" {
|
||||
source = "./child"
|
||||
source = "./child"
|
||||
}
|
||||
|
||||
resource "aws_instance" "a" {
|
||||
depends_on = ["module.child"]
|
||||
ami = "parent"
|
||||
|
||||
depends_on = ["module.child"]
|
||||
}
|
||||
|
@ -1,2 +1,4 @@
|
||||
resource "aws_instance" "c" {}
|
||||
resource "aws_instance" "c" {
|
||||
ami = "grandchild"
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
module "grandchild" {
|
||||
source = "./child"
|
||||
source = "./child"
|
||||
}
|
||||
|
||||
resource "aws_instance" "b" {
|
||||
depends_on = ["module.grandchild"]
|
||||
ami = "child"
|
||||
depends_on = ["module.grandchild"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user