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

     1  package opc
     2  
     3  import (
     4  	"testing"
     5  
     6  	"fmt"
     7  	"github.com/hashicorp/terraform/helper/acctest"
     8  	"github.com/hashicorp/terraform/helper/resource"
     9  )
    10  
    11  func TestAccOPCStorageVolume_importBasic(t *testing.T) {
    12  	resourceName := "opc_compute_storage_volume.test"
    13  	rInt := acctest.RandInt()
    14  	config := fmt.Sprintf(testAccStorageVolumeBasic, rInt)
    15  
    16  	resource.Test(t, resource.TestCase{
    17  		PreCheck:     func() { testAccPreCheck(t) },
    18  		Providers:    testAccProviders,
    19  		CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
    20  		Steps: []resource.TestStep{
    21  			{
    22  				Config: config,
    23  			},
    24  			{
    25  				ResourceName:      resourceName,
    26  				ImportState:       true,
    27  				ImportStateVerify: true,
    28  			},
    29  		},
    30  	})
    31  }
    32  
    33  func TestAccOPCStorageVolume_importComplete(t *testing.T) {
    34  	resourceName := "opc_compute_storage_volume.test"
    35  	rInt := acctest.RandInt()
    36  	config := fmt.Sprintf(testAccStorageVolumeComplete, rInt)
    37  
    38  	resource.Test(t, resource.TestCase{
    39  		PreCheck:     func() { testAccPreCheck(t) },
    40  		Providers:    testAccProviders,
    41  		CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
    42  		Steps: []resource.TestStep{
    43  			{
    44  				Config: config,
    45  			},
    46  			{
    47  				ResourceName:      resourceName,
    48  				ImportState:       true,
    49  				ImportStateVerify: true,
    50  			},
    51  		},
    52  	})
    53  }
    54  
    55  func TestAccOPCStorageVolume_importMaxSize(t *testing.T) {
    56  	resourceName := "opc_compute_storage_volume.test"
    57  	rInt := acctest.RandInt()
    58  	config := fmt.Sprintf(testAccStorageVolumeBasicMaxSize, rInt)
    59  
    60  	resource.Test(t, resource.TestCase{
    61  		PreCheck:     func() { testAccPreCheck(t) },
    62  		Providers:    testAccProviders,
    63  		CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
    64  		Steps: []resource.TestStep{
    65  			{
    66  				Config: config,
    67  			},
    68  			{
    69  				ResourceName:      resourceName,
    70  				ImportState:       true,
    71  				ImportStateVerify: true,
    72  			},
    73  		},
    74  	})
    75  }
    76  
    77  func TestAccOPCStorageVolume_importBootable(t *testing.T) {
    78  	resourceName := "opc_compute_storage_volume.test"
    79  	rInt := acctest.RandInt()
    80  	config := fmt.Sprintf(testAccStorageVolumeBootable, rInt, rInt)
    81  
    82  	resource.Test(t, resource.TestCase{
    83  		PreCheck:     func() { testAccPreCheck(t) },
    84  		Providers:    testAccProviders,
    85  		CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
    86  		Steps: []resource.TestStep{
    87  			{
    88  				Config: config,
    89  			},
    90  			{
    91  				ResourceName:      resourceName,
    92  				ImportState:       true,
    93  				ImportStateVerify: true,
    94  			},
    95  		},
    96  	})
    97  }
    98  
    99  func TestAccOPCStorageVolume_importImageListEntry(t *testing.T) {
   100  	resourceName := "opc_compute_storage_volume.test"
   101  	rInt := acctest.RandInt()
   102  	config := fmt.Sprintf(testAccStorageVolumeImageListEntry, rInt, rInt)
   103  
   104  	resource.Test(t, resource.TestCase{
   105  		PreCheck:     func() { testAccPreCheck(t) },
   106  		Providers:    testAccProviders,
   107  		CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
   108  		Steps: []resource.TestStep{
   109  			{
   110  				Config: config,
   111  			},
   112  			{
   113  				ResourceName:      resourceName,
   114  				ImportState:       true,
   115  				ImportStateVerify: true,
   116  			},
   117  		},
   118  	})
   119  }
   120  
   121  func TestAccOPCStorageVolume_importLowLatency(t *testing.T) {
   122  	resourceName := "opc_compute_storage_volume.test"
   123  	rInt := acctest.RandInt()
   124  	config := testAccStorageVolumeLowLatency(rInt)
   125  
   126  	resource.Test(t, resource.TestCase{
   127  		PreCheck:     func() { testAccPreCheck(t) },
   128  		Providers:    testAccProviders,
   129  		CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
   130  		Steps: []resource.TestStep{
   131  			{
   132  				Config: config,
   133  			},
   134  			{
   135  				ResourceName:      resourceName,
   136  				ImportState:       true,
   137  				ImportStateVerify: true,
   138  			},
   139  		},
   140  	})
   141  }
   142  
   143  func TestAccOPCStorageVolume_importFromSnapshot(t *testing.T) {
   144  	resourceName := "opc_compute_storage_volume.test"
   145  	rInt := acctest.RandInt()
   146  	config := testAccStorageVolumeFromSnapshot(rInt)
   147  
   148  	resource.Test(t, resource.TestCase{
   149  		PreCheck:     func() { testAccPreCheck(t) },
   150  		Providers:    testAccProviders,
   151  		CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
   152  		Steps: []resource.TestStep{
   153  			{
   154  				Config: config,
   155  			},
   156  			{
   157  				ResourceName:      resourceName,
   158  				ImportState:       true,
   159  				ImportStateVerify: true,
   160  			},
   161  		},
   162  	})
   163  }