Skip to content

Commit

Permalink
valid scratch disk test case added (#3979)
Browse files Browse the repository at this point in the history
* valid scratch disk test case added

* PR comments implemented

* test name modified
  • Loading branch information
venkykuberan authored Sep 23, 2020
1 parent 7ac40f7 commit beb0c39
Showing 1 changed file with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,26 @@ func TestAccComputeInstanceTemplate_invalidDiskType(t *testing.T) {
})
}

func TestAccComputeInstanceTemplate_withScratchDisk(t *testing.T) {
t.Parallel()

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccComputeInstanceTemplate_withScratchDisk(randString(t, 10)),
},
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"name_prefix"},
},
},
})
}

func TestAccComputeInstanceTemplate_imageResourceTest(t *testing.T) {
// Multiple fine-grained resources
skipIfVcr(t)
Expand Down Expand Up @@ -1575,6 +1595,35 @@ resource "google_compute_instance_template" "foobar" {
`, suffix, suffix)
}

func testAccComputeInstanceTemplate_withScratchDisk(suffix string) string {
return fmt.Sprintf(`
data "google_compute_image" "my_image" {
family = "centos-7"
project = "gce-uefi-images"
}
resource "google_compute_instance_template" "foobar" {
name = "instancet-test-%s"
machine_type = "n1-standard-1"
can_ip_forward = false
disk {
source_image = data.google_compute_image.my_image.name
auto_delete = true
boot = true
}
disk {
auto_delete = true
disk_size_gb = 375
type = "SCRATCH"
disk_type = "local-ssd"
}
network_interface {
network = "default"
}
}
`, suffix)
}


func testAccComputeInstanceTemplate_regionDisks(suffix string) string {
return fmt.Sprintf(`
data "google_compute_image" "my_image" {
Expand Down

0 comments on commit beb0c39

Please sign in to comment.