opentofu/builtin/providers/digitalocean/import_digitalocean_droplet_test.go
Paul Stack e905aa2840 provider/digitalocean: Support Import digitalocean_droplet (#7344)
```
ake testacc TEST=./builtin/providers/digitalocean
TESTARGS='-run=TestAccDigitalOceanDroplet_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/digitalocean -v -run=TestAccDigitalOceanDroplet_ -timeout 120m
=== RUN   TestAccDigitalOceanDroplet_importBasic
--- PASS: TestAccDigitalOceanDroplet_importBasic (39.42s)
=== RUN   TestAccDigitalOceanDroplet_Basic
--- PASS: TestAccDigitalOceanDroplet_Basic (38.46s)
=== RUN   TestAccDigitalOceanDroplet_Update
--- PASS: TestAccDigitalOceanDroplet_Update (244.82s)
=== RUN   TestAccDigitalOceanDroplet_UpdateUserData
--- PASS: TestAccDigitalOceanDroplet_UpdateUserData (73.05s)
=== RUN   TestAccDigitalOceanDroplet_PrivateNetworkingIpv6
--- PASS: TestAccDigitalOceanDroplet_PrivateNetworkingIpv6 (67.24s)
PASS
```
2016-06-29 20:28:47 +01:00

31 lines
763 B
Go

package digitalocean
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccDigitalOceanDroplet_importBasic(t *testing.T) {
resourceName := "digitalocean_droplet.foobar"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckDigitalOceanDropletDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCheckDigitalOceanDropletConfig_basic,
},
resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"ssh_keys", "user_data"}, //we ignore the ssh_keys and user_data as we do not set to state
},
},
})
}