From b2d3594d2718c860cef2ec007377bdfb8c65a457 Mon Sep 17 00:00:00 2001 From: "renzheng.wang" Date: Sun, 27 Aug 2023 15:22:00 +0800 Subject: [PATCH] fix code smell in TestAccUCloudInstanceState --- ucloud/resource_ucloud_instance_state_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ucloud/resource_ucloud_instance_state_test.go b/ucloud/resource_ucloud_instance_state_test.go index 161c85b7..1d161c15 100644 --- a/ucloud/resource_ucloud_instance_state_test.go +++ b/ucloud/resource_ucloud_instance_state_test.go @@ -9,13 +9,13 @@ import ( ) func TestAccUCloudInstanceState(t *testing.T) { - + instanceStateResource := "ucloud_instance_state.foo" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "ucloud_instance_state.foo", + IDRefreshName: instanceStateResource, Providers: testAccProviders, CheckDestroy: testAccCheckInstanceStateDestroy, @@ -25,7 +25,7 @@ func TestAccUCloudInstanceState(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("ucloud_instance.foo", "name", "tf-acc-instance-config-basic"), - resource.TestCheckResourceAttr("ucloud_instance_state.foo", "state", "Stopped"), + resource.TestCheckResourceAttr(instanceStateResource, "state", "Stopped"), ), }, { @@ -33,7 +33,7 @@ func TestAccUCloudInstanceState(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("ucloud_instance.foo", "name", "tf-acc-instance-config-basic"), - resource.TestCheckResourceAttr("ucloud_instance_state.foo", "state", "Running"), + resource.TestCheckResourceAttr(instanceStateResource, "state", "Running"), ), }, },