From 3fabd7ee0df1c0ba555f0110de7943f71253f4d1 Mon Sep 17 00:00:00 2001 From: 1riatsila1 Date: Wed, 6 Nov 2024 09:25:49 +0400 Subject: [PATCH] add test for moving group by removing parent_group_id --- test/live/resources/group_test.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/live/resources/group_test.go b/test/live/resources/group_test.go index 50484b7b..91ceb4f9 100644 --- a/test/live/resources/group_test.go +++ b/test/live/resources/group_test.go @@ -148,6 +148,35 @@ func TestGroupResource(t *testing.T) { ), ), }, + // Update non root node group back to the root node by removing parent_group_id + { + Config: provider.ProviderConfig + ` + resource "uxi_group" "parent" { + name = "tf_provider_acceptance_test_parent_name_updated" + } + + resource "uxi_group" "child" { + name = "tf_provider_acceptance_test_child" + parent_group_id = uxi_group.parent.id + } + + # move grandchild from parent to root + resource "uxi_group" "grandchild" { + name = "tf_provider_acceptance_test_grandchild_moved_to_root" + }`, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "uxi_group.grandchild", + "name", + "tf_provider_acceptance_test_grandchild_moved_to_root", + ), + resource.TestCheckResourceAttr( + "uxi_group.grandchild", + "parent_group_id", + rootGroup.Id, + ), + ), + }, // Deletes happen automatically }, })