github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/digitalocean/import_digitalocean_volume_test.go (about)

     1  package digitalocean
     2  
     3  import (
     4  	"testing"
     5  
     6  	"fmt"
     7  
     8  	"github.com/hashicorp/terraform/helper/acctest"
     9  	"github.com/hashicorp/terraform/helper/resource"
    10  )
    11  
    12  func TestAccDigitalOceanVolume_importBasic(t *testing.T) {
    13  	resourceName := "digitalocean_volume.foobar"
    14  	volumeName := fmt.Sprintf("volume-%s", acctest.RandString(10))
    15  
    16  	resource.Test(t, resource.TestCase{
    17  		PreCheck:     func() { testAccPreCheck(t) },
    18  		Providers:    testAccProviders,
    19  		CheckDestroy: testAccCheckDigitalOceanVolumeDestroy,
    20  		Steps: []resource.TestStep{
    21  			{
    22  				Config: fmt.Sprintf(testAccCheckDigitalOceanVolumeConfig_basic, volumeName),
    23  			},
    24  
    25  			{
    26  				ResourceName:      resourceName,
    27  				ImportState:       true,
    28  				ImportStateVerify: true,
    29  			},
    30  		},
    31  	})
    32  }