packer-cn/builder/profitbricks/builder_acc_test.go

39 lines
812 B
Go
Raw Normal View History

2016-06-28 22:35:41 -04:00
package profitbricks
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("PROFITBRICKS_USERNAME"); v == "" {
t.Fatal("PROFITBRICKS_USERNAME must be set for acceptance tests")
}
if v := os.Getenv("PROFITBRICKS_PASSWORD"); v == "" {
t.Fatal("PROFITBRICKS_PASSWORD must be set for acceptance tests")
}
}
const testBuilderAccBasic = `
{
"builders": [{
"image": "Ubuntu-16.04",
"pbpassword": "password",
"pbusername": "username",
"servername": "packer",
"type": "profitbricks"
}]
}
`