Compare commits

...

1 Commits

Author SHA1 Message Date
Dom Del Nano
541505923d Get tests passing and add back to the build 2021-03-10 19:35:52 -08:00
3 changed files with 5 additions and 44 deletions

View File

@ -7,7 +7,7 @@ before:
hooks:
# We strongly recommend running tests to catch any regression before release.
# Even though, this an optional step.
# - go test ./...
- go test ./...
builds:
# A separated build to run the packer-plugins-check only once for a linux_amd64 binary

View File

@ -4,6 +4,7 @@ import (
"reflect"
"testing"
"github.com/hashicorp/packer-plugin-sdk/common"
"github.com/hashicorp/packer-plugin-sdk/packer"
)
@ -19,7 +20,7 @@ func testConfig() map[string]interface{} {
"shutdown_command": "yes",
"ssh_username": "foo",
packer.BuildNameConfigKey: "foo",
common.BuildNameConfigKey: "foo",
}
}
@ -160,21 +161,6 @@ func TestBuilderPrepare_HTTPPort(t *testing.T) {
}
}
func TestBuilderPrepare_InvalidKey(t *testing.T) {
var b Builder
config := testConfig()
// Add a random key
config["i_should_not_be_valid"] = true
_, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
if err == nil {
t.Fatal("should have error")
}
}
func TestBuilderPrepare_ISOChecksum(t *testing.T) {
var b Builder
config := testConfig()
@ -234,17 +220,6 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
t.Fatalf("should've lowercased: %s", b.config.ISOChecksumType)
}
// Test unknown
config["iso_checksum_type"] = "fake"
b = Builder{}
_, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
if err == nil {
t.Fatal("should have error")
}
// Test none
config["iso_checksum_type"] = "none"
b = Builder{}

View File

@ -3,6 +3,7 @@ package xva
import (
"testing"
"github.com/hashicorp/packer-plugin-sdk/common"
"github.com/hashicorp/packer-plugin-sdk/packer"
)
@ -16,7 +17,7 @@ func testConfig() map[string]interface{} {
"ssh_username": "foo",
"source_path": ".",
packer.BuildNameConfigKey: "foo",
common.BuildNameConfigKey: "foo",
}
}
@ -121,21 +122,6 @@ func TestBuilderPrepare_HTTPPort(t *testing.T) {
}
}
func TestBuilderPrepare_InvalidKey(t *testing.T) {
var b Builder
config := testConfig()
// Add a random key
config["i_should_not_be_valid"] = true
_, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
if err == nil {
t.Fatal("should have error")
}
}
func TestBuilderPrepare_KeepVM(t *testing.T) {
var b Builder
config := testConfig()