Skip to content

Commit

Permalink
Revert "Fix test - reporting compaction results requires a tmp file"
Browse files Browse the repository at this point in the history
This reverts commit f342975.
  • Loading branch information
DanHam committed May 16, 2018
1 parent 2939cd7 commit 73eb9a6
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions builder/vmware/common/step_compact_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package common

import (
"context"
"io/ioutil"
"os"
"testing"

"github.com/hashicorp/packer/helper/multistep"
Expand All @@ -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)

Expand All @@ -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")
}
}
Expand Down

0 comments on commit 73eb9a6

Please sign in to comment.