From ae064207d529b8d8f81a3d121e672632ca88eb23 Mon Sep 17 00:00:00 2001 From: Tommy Ulfsparre Date: Thu, 2 Jul 2015 00:02:31 +0200 Subject: [PATCH] Add test for ephemeral block device mapping --- builder/amazon/common/block_device_test.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/builder/amazon/common/block_device_test.go b/builder/amazon/common/block_device_test.go index 063c480f1..803bfc996 100644 --- a/builder/amazon/common/block_device_test.go +++ b/builder/amazon/common/block_device_test.go @@ -17,7 +17,6 @@ func TestBlockDevice(t *testing.T) { { Config: &BlockDevice{ DeviceName: "/dev/sdb", - VirtualName: "ephemeral0", SnapshotId: "snap-1234", VolumeType: "standard", VolumeSize: 8, @@ -27,7 +26,7 @@ func TestBlockDevice(t *testing.T) { Result: &ec2.BlockDeviceMapping{ DeviceName: aws.String("/dev/sdb"), - VirtualName: aws.String("ephemeral0"), + VirtualName: aws.String(""), EBS: &ec2.EBSBlockDevice{ SnapshotID: aws.String("snap-1234"), VolumeType: aws.String("standard"), @@ -55,7 +54,6 @@ func TestBlockDevice(t *testing.T) { { Config: &BlockDevice{ DeviceName: "/dev/sdb", - VirtualName: "ephemeral0", VolumeType: "io1", VolumeSize: 8, DeleteOnTermination: true, @@ -64,7 +62,7 @@ func TestBlockDevice(t *testing.T) { Result: &ec2.BlockDeviceMapping{ DeviceName: aws.String("/dev/sdb"), - VirtualName: aws.String("ephemeral0"), + VirtualName: aws.String(""), EBS: &ec2.EBSBlockDevice{ VolumeType: aws.String("io1"), VolumeSize: aws.Long(8), @@ -73,6 +71,17 @@ func TestBlockDevice(t *testing.T) { }, }, }, + { + Config: &BlockDevice{ + DeviceName: "/dev/sdb", + VirtualName: "ephemeral0", + }, + + Result: &ec2.BlockDeviceMapping{ + DeviceName: aws.String("/dev/sdb"), + VirtualName: aws.String("ephemeral0"), + }, + }, } for _, tc := range cases {