Adding tests covering low latency storage

pull/13431/head
tombuildsstuff 9 years ago
parent 6d859479dd
commit 41d4bc1622

@ -118,6 +118,28 @@ func TestAccOPCStorageVolume_importImageListEntry(t *testing.T) {
})
}
func TestAccOPCStorageVolume_importLowLatency(t *testing.T) {
resourceName := "opc_compute_storage_volume.test"
rInt := acctest.RandInt()
config := testAccStorageVolumeLowLatency(rInt)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
Steps: []resource.TestStep{
{
Config: config,
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
func TestAccOPCStorageVolume_importFromSnapshot(t *testing.T) {
resourceName := "opc_compute_storage_volume.test"
rInt := acctest.RandInt()

@ -136,6 +136,27 @@ func TestAccOPCStorageVolume_ImageListEntry(t *testing.T) {
})
}
func TestAccOPCStorageVolume_LowLatency(t *testing.T) {
volumeResourceName := "opc_compute_storage_volume.test"
rInt := acctest.RandInt()
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeDestroyed),
Steps: []resource.TestStep{
{
Config: testAccStorageVolumeLowLatency(rInt),
Check: resource.ComposeTestCheckFunc(
opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeExists),
resource.TestCheckResourceAttr(volumeResourceName, "storage_type", "/oracle/public/storage/latency"),
),
},
},
})
}
func TestAccOPCStorageVolume_FromSnapshot(t *testing.T) {
volumeResourceName := "opc_compute_storage_volume.test"
rInt := acctest.RandInt()
@ -160,8 +181,6 @@ func TestAccOPCStorageVolume_FromSnapshot(t *testing.T) {
})
}
// TODO: test Premium storage
func testAccCheckStorageVolumeExists(state *OPCResourceState) error {
sv := state.Client.StorageVolumes()
volumeName := state.Attributes["name"]
@ -302,3 +321,13 @@ func testAccStorageVolumeFromSnapshot(rInt int) string {
snapshot_id = "${opc_compute_storage_volume_snapshot.foo.snapshot_id}"
}`, rInt, rInt, rInt)
}
func testAccStorageVolumeLowLatency(rInt int) string {
return fmt.Sprintf(`
resource "opc_compute_storage_volume" "test" {
name = "test-acc-stor-vol-ll-%d"
description = "Acc Test Storage Volume Low Latency"
storage_type = "/oracle/public/storage/latency"
size = 5
}`, rInt)
}

Loading…
Cancel
Save