40 lines
810 B
Go
40 lines
810 B
Go
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}}"
|
|
}]
|
|
}
|
|
`
|