opentofu/builtin/providers/digitalocean/import_digitalocean_floating_ip_test.go
Paul Stack 70578d4e99 provider/digitalocean: Support Import digitalocean_floating_ip (#7343)
```
make testacc TEST=./builtin/providers/digitalocean
TESTARGS='-run=TestAccDigitalOceanFloatingIP_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/digitalocean -v -run=TestAccDigitalOceanFloatingIP_ -timeout 120m
=== RUN   TestAccDigitalOceanFloatingIP_importBasicRegion
--- PASS: TestAccDigitalOceanFloatingIP_importBasicRegion (3.76s)
=== RUN   TestAccDigitalOceanFloatingIP_importBasicDroplet
--- PASS: TestAccDigitalOceanFloatingIP_importBasicDroplet (72.41s)
=== RUN   TestAccDigitalOceanFloatingIP_Region
--- PASS: TestAccDigitalOceanFloatingIP_Region (3.46s)
=== RUN   TestAccDigitalOceanFloatingIP_Droplet
--- PASS: TestAccDigitalOceanFloatingIP_Droplet (74.49s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/digitalocean
154.128s
```
2016-06-29 16:30:11 +01:00

50 lines
1.2 KiB
Go

package digitalocean
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccDigitalOceanFloatingIP_importBasicRegion(t *testing.T) {
resourceName := "digitalocean_floating_ip.foobar"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckDigitalOceanFloatingIPDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCheckDigitalOceanFloatingIPConfig_region,
},
resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
func TestAccDigitalOceanFloatingIP_importBasicDroplet(t *testing.T) {
resourceName := "digitalocean_floating_ip.foobar"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckDigitalOceanFloatingIPDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCheckDigitalOceanFloatingIPConfig_droplet,
},
resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}