From 73eb9a629ebbc5352e4e99ec063e6a461358feb9 Mon Sep 17 00:00:00 2001 From: DanHam Date: Wed, 16 May 2018 13:10:33 +0100 Subject: [PATCH] Revert "Fix test - reporting compaction results requires a tmp file" This reverts commit f342975ff31e5a59b4534b3fb216250365468b1f. --- .../vmware/common/step_compact_disk_test.go | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/builder/vmware/common/step_compact_disk_test.go b/builder/vmware/common/step_compact_disk_test.go index a07755229..df0fc5fca 100644 --- a/builder/vmware/common/step_compact_disk_test.go +++ b/builder/vmware/common/step_compact_disk_test.go @@ -2,8 +2,6 @@ package common import ( "context" - "io/ioutil" - "os" "testing" "github.com/hashicorp/packer/helper/multistep" @@ -17,25 +15,8 @@ func TestStepCompactDisk(t *testing.T) { state := testState(t) step := new(StepCompactDisk) - // Create a fake vmdk file for disk file size operations - diskFile, err := ioutil.TempFile("", "disk.vmdk") - if err != nil { - t.Fatalf("Error creating fake vmdk file: %s", err) - } - - diskFullPath := diskFile.Name() - defer os.Remove(diskFullPath) - - content := []byte("I am the fake vmdk's contents") - if _, err := diskFile.Write(content); err != nil { - t.Fatalf("Error writing to fake vmdk file: %s", err) - } - if err := diskFile.Close(); err != nil { - t.Fatalf("Error closing fake vmdk file: %s", err) - } - - // Set up required state - state.Put("disk_full_paths", []string{diskFullPath}) + diskFullPaths := []string{"foo"} + state.Put("disk_full_paths", diskFullPaths) driver := state.Get("driver").(*DriverMock) @@ -51,7 +32,7 @@ func TestStepCompactDisk(t *testing.T) { if !driver.CompactDiskCalled { t.Fatal("should've called") } - if driver.CompactDiskPath != diskFullPath { + if driver.CompactDiskPath != "foo" { t.Fatal("should call with right path") } }