diff --git a/builder/amazon/ebs/builder_acc_test.go b/builder/amazon/ebs/builder_acc_test.go new file mode 100644 index 000000000..19af43512 --- /dev/null +++ b/builder/amazon/ebs/builder_acc_test.go @@ -0,0 +1,39 @@ +package ebs + +import ( + "os" + "testing" + + builderT "github.com/mitchellh/packer/helper/builder/testing" +) + +func TestBuilderAcc_basic(t *testing.T) { + builderT.Test(t, builderT.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Builder: &Builder{}, + Template: testBuilderAccBasic, + }) +} + +func testAccPreCheck(t *testing.T) { + if v := os.Getenv("AWS_ACCESS_KEY_ID"); v == "" { + t.Fatal("AWS_ACCESS_KEY_ID must be set for acceptance tests") + } + + if v := os.Getenv("AWS_SECRET_ACCESS_KEY"); v == "" { + t.Fatal("AWS_SECRET_ACCESS_KEY must be set for acceptance tests") + } +} + +const testBuilderAccBasic = ` +{ + "builders": [{ + "type": "test", + "region": "us-east-1", + "instance_type": "m3.medium", + "source_ami": "ami-76b2a71e", + "ssh_username": "ubuntu", + "ami_name": "packer-test {{timestamp}}" + }] +} +`