2015-06-10 17:02:06 -04:00
|
|
|
package digitalocean
|
|
|
|
|
|
|
|
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("DIGITALOCEAN_API_TOKEN"); v == "" {
|
|
|
|
t.Fatal("DIGITALOCEAN_API_TOKEN must be set for acceptance tests")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const testBuilderAccBasic = `
|
|
|
|
{
|
|
|
|
"builders": [{
|
2015-06-10 21:54:51 -04:00
|
|
|
"type": "test",
|
|
|
|
"region": "nyc2",
|
|
|
|
"size": "512mb",
|
2016-09-28 09:00:57 -04:00
|
|
|
"image": "ubuntu-12-04-x64",
|
|
|
|
"user_date": "",
|
|
|
|
"user_date_file": ""
|
2015-06-10 17:02:06 -04:00
|
|
|
}]
|
|
|
|
}
|
|
|
|
`
|