From 36ed95c86d90704af033cd190334406739cd572f Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Thu, 20 Nov 2014 14:30:02 +0100 Subject: [PATCH] Fixing the acc tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I do wonder when these tests where last run successfully… Must be quite some time ago considering what I needed to fix in here :wink: --- .../google/resource_compute_instance_test.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/builtin/providers/google/resource_compute_instance_test.go b/builtin/providers/google/resource_compute_instance_test.go index 78c01e04e..f765a44c4 100644 --- a/builtin/providers/google/resource_compute_instance_test.go +++ b/builtin/providers/google/resource_compute_instance_test.go @@ -52,9 +52,6 @@ func TestAccComputeInstance_IP(t *testing.T) { }) } -//!NB requires that disk with name terraform-test-disk is present in gce, -//if created as dependency then it tries to remove it while it is still attached -//to instance and that fails with an error func TestAccComputeInstance_disks(t *testing.T) { var instance compute.Instance @@ -66,6 +63,8 @@ func TestAccComputeInstance_disks(t *testing.T) { resource.TestStep{ Config: testAccComputeInstance_disks, Check: resource.ComposeTestCheckFunc( + testAccCheckComputeInstanceExists( + "google_compute_instance.foobar", &instance), testAccCheckComputeInstanceDisk(&instance, "terraform-test", true, true), testAccCheckComputeInstanceDisk(&instance, "terraform-test-disk", false, false), ), @@ -287,6 +286,13 @@ resource "google_compute_instance" "foobar" { }` const testAccComputeInstance_disks = ` +resource "google_compute_disk" "foobar" { + name = "terraform-test-disk" + size = 10 + type = "pd-ssd" + zone = "us-central1-a" +} + resource "google_compute_instance" "foobar" { name = "terraform-test" machine_type = "n1-standard-1" @@ -297,9 +303,8 @@ resource "google_compute_instance" "foobar" { } disk { - disk = "terraform-test-disk" + disk = "${google_compute_disk.foobar.name}" auto_delete = false - type = "pd-ssd" } network {