Skip to content

Commit 11c418e

Browse files
committed
power state resource test
1 parent 074c46f commit 11c418e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
4+
package acceptance
5+
6+
import (
7+
"fmt"
8+
"testing"
9+
10+
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
11+
)
12+
13+
func TestAccHypercorePowerStateResource(t *testing.T) {
14+
resource.Test(t, resource.TestCase{
15+
PreCheck: func() { testAccPreCheck(t) },
16+
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
17+
Steps: []resource.TestStep{
18+
{
19+
Config: testAccHypercorePowerStateResourceConfig(),
20+
Check: resource.ComposeAggregateTestCheckFunc(
21+
resource.TestCheckResourceAttr("hypercore_vm_power_state.power_state_test", "state", "RUNNING"),
22+
),
23+
},
24+
},
25+
})
26+
}
27+
28+
func testAccHypercorePowerStateResourceConfig() string {
29+
return fmt.Sprintf(`
30+
data "hypercore_vm" "integrationvm" {
31+
name = %[1]q
32+
}
33+
34+
resource "hypercore_vm_power_state" "power_state_test" {
35+
vm_uuid = data.hypercore_vm.integrationvm.vms.0.uuid
36+
state = "RUNNING"
37+
}
38+
39+
`, source_vm_name)
40+
}

0 commit comments

Comments
 (0)