builder/amazon,builder/openstack: remove more cgl libs

This commit is contained in:
Mitchell Hashimoto 2013-10-16 16:29:53 -10:00
parent 8c9d24541b
commit 24ad445e2b
3 changed files with 22 additions and 27 deletions

View File

@ -1,21 +1,15 @@
package common package common
import ( import (
"cgl.tideland.biz/asserts"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"testing" "testing"
) )
func TestArtifact_Impl(t *testing.T) { func TestArtifact_Impl(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true) var _ packer.Artifact = new(Artifact)
var actual packer.Artifact
assert.Implementor(&Artifact{}, &actual, "should be an Artifact")
} }
func TestArtifactId(t *testing.T) { func TestArtifactId(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
expected := `east:foo,west:bar` expected := `east:foo,west:bar`
amis := make(map[string]string) amis := make(map[string]string)
@ -27,12 +21,12 @@ func TestArtifactId(t *testing.T) {
} }
result := a.Id() result := a.Id()
assert.Equal(result, expected, "should match output") if result != expected {
t.Fatalf("bad: %s", result)
}
} }
func TestArtifactString(t *testing.T) { func TestArtifactString(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
expected := `AMIs were created: expected := `AMIs were created:
east: foo east: foo
@ -44,5 +38,7 @@ west: bar`
a := &Artifact{Amis: amis} a := &Artifact{Amis: amis}
result := a.String() result := a.String()
assert.Equal(result, expected, "should match output") if result != expected {
t.Fatalf("bad: %s", result)
}
} }

View File

@ -1,14 +1,12 @@
package common package common
import ( import (
"cgl.tideland.biz/asserts"
"github.com/mitchellh/goamz/ec2" "github.com/mitchellh/goamz/ec2"
"reflect"
"testing" "testing"
) )
func TestBlockDevice(t *testing.T) { func TestBlockDevice(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
ec2Mapping := []ec2.BlockDeviceMapping{ ec2Mapping := []ec2.BlockDeviceMapping{
ec2.BlockDeviceMapping{ ec2.BlockDeviceMapping{
DeviceName: "/dev/sdb", DeviceName: "/dev/sdb",
@ -36,6 +34,11 @@ func TestBlockDevice(t *testing.T) {
LaunchMappings: []BlockDevice{blockDevice}, LaunchMappings: []BlockDevice{blockDevice},
} }
assert.Equal(ec2Mapping, blockDevices.BuildAMIDevices(), "should match output") if !reflect.DeepEqual(ec2Mapping, blockDevices.BuildAMIDevices()) {
assert.Equal(ec2Mapping, blockDevices.BuildLaunchDevices(), "should match output") t.Fatalf("bad: %#v", ec2Mapping)
}
if !reflect.DeepEqual(ec2Mapping, blockDevices.BuildLaunchDevices()) {
t.Fatalf("bad: %#v", ec2Mapping)
}
} }

View File

@ -1,21 +1,15 @@
package openstack package openstack
import ( import (
"cgl.tideland.biz/asserts"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"testing" "testing"
) )
func TestArtifact_Impl(t *testing.T) { func TestArtifact_Impl(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true) var _ packer.Artifact = new(Artifact)
var actual packer.Artifact
assert.Implementor(&Artifact{}, &actual, "should be an Artifact")
} }
func TestArtifactId(t *testing.T) { func TestArtifactId(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
expected := `b8cdf55b-c916-40bd-b190-389ec144c4ed` expected := `b8cdf55b-c916-40bd-b190-389ec144c4ed`
a := &Artifact{ a := &Artifact{
@ -23,17 +17,19 @@ func TestArtifactId(t *testing.T) {
} }
result := a.Id() result := a.Id()
assert.Equal(result, expected, "should match output") if result != expected {
t.Fatalf("bad: %s", result)
}
} }
func TestArtifactString(t *testing.T) { func TestArtifactString(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true)
expected := "An image was created: b8cdf55b-c916-40bd-b190-389ec144c4ed" expected := "An image was created: b8cdf55b-c916-40bd-b190-389ec144c4ed"
a := &Artifact{ a := &Artifact{
ImageId: "b8cdf55b-c916-40bd-b190-389ec144c4ed", ImageId: "b8cdf55b-c916-40bd-b190-389ec144c4ed",
} }
result := a.String() result := a.String()
assert.Equal(result, expected, "should match output") if result != expected {
t.Fatalf("bad: %s", result)
}
} }