github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/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  			resource.TestStep{
    22  				Config: fmt.Sprintf(testAccCheckDigitalOceanVolumeConfig_basic, volumeName),
    23  			},
    24  
    25  			resource.TestStep{
    26  				ResourceName:      resourceName,
    27  				ImportState:       true,
    28  				ImportStateVerify: true,
    29  			},
    30  		},
    31  	})
    32  }