From 0481a377c7a00df9fcccb4a6f11dab929866db38 Mon Sep 17 00:00:00 2001 From: Sias Mey Date: Wed, 4 Dec 2024 16:15:51 +0200 Subject: [PATCH] test: ensure planed values for groups update --- test/mocked/resources/group_test.go | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/mocked/resources/group_test.go b/test/mocked/resources/group_test.go index e8438fe..2ffc244 100644 --- a/test/mocked/resources/group_test.go +++ b/test/mocked/resources/group_test.go @@ -317,6 +317,19 @@ func Test_UpdateGroupResource_WithoutRecreate_ShouldSucceed(t *testing.T) { name = "name_2" parent_group_id = "parent_id" }`, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction( + "hpeuxi_group.my_group", + plancheck.ResourceActionUpdate, + ), + plancheck.ExpectKnownValue( + "hpeuxi_group.my_group", + tfjsonpath.New("name"), + knownvalue.StringExact("name_2"), + ), + }, + }, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("hpeuxi_group.my_group", "name", "name_2"), resource.TestCheckResourceAttr( @@ -398,6 +411,28 @@ func Test_UpdateGroupResource_WithRecreate_ShouldSucceed(t *testing.T) { name = "name" parent_group_id = "parent_id_2" }`, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction( + "hpeuxi_group.my_group", + plancheck.ResourceActionDestroyBeforeCreate, + ), + plancheck.ExpectUnknownValue( + "hpeuxi_group.my_group", + tfjsonpath.New("id"), + ), + plancheck.ExpectKnownValue( + "hpeuxi_group.my_group", + tfjsonpath.New("name"), + knownvalue.StringExact("name"), + ), + plancheck.ExpectKnownValue( + "hpeuxi_group.my_group", + tfjsonpath.New("parent_group_id"), + knownvalue.StringExact("parent_id_2"), + ), + }, + }, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("hpeuxi_group.my_group", "name", "name"), resource.TestCheckResourceAttr(