|
| 1 | +package octopusdeploy_framework |
| 2 | + |
| 3 | +import ( |
| 4 | + "fmt" |
| 5 | + "testing" |
| 6 | + |
| 7 | + "github.com/hashicorp/terraform-plugin-testing/helper/acctest" |
| 8 | + "github.com/hashicorp/terraform-plugin-testing/helper/resource" |
| 9 | +) |
| 10 | + |
| 11 | +func TestMachinePolicyDefaults(t *testing.T) { |
| 12 | + localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha) |
| 13 | + resourceName := "octopusdeploy_machine_policy." + localName |
| 14 | + name := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha) |
| 15 | + |
| 16 | + resource.Test(t, resource.TestCase{ |
| 17 | + PreCheck: func() { TestAccPreCheck(t) }, |
| 18 | + ProtoV6ProviderFactories: ProtoV6ProviderFactories(), |
| 19 | + Steps: []resource.TestStep{ |
| 20 | + { |
| 21 | + Check: resource.ComposeTestCheckFunc( |
| 22 | + testAccCheckLifecycleExists(resourceName), |
| 23 | + resource.TestCheckResourceAttrSet(resourceName, "id"), |
| 24 | + resource.TestCheckResourceAttr(resourceName, "name", name), |
| 25 | + resource.TestCheckResourceAttrSet(resourceName, "space_id"), |
| 26 | + ), |
| 27 | + Config: testMachinePolicy(localName, name), |
| 28 | + }, |
| 29 | + }, |
| 30 | + }) |
| 31 | +} |
| 32 | + |
| 33 | +func testMachinePolicy(localName string, name string) string { |
| 34 | + return fmt.Sprintf(`resource "octopusdeploy_machine_policy" "%s" { |
| 35 | + name = "%s" |
| 36 | + }`, localName, name) |
| 37 | +} |
0 commit comments