2016-06-28 22:35:41 -04:00
|
|
|
package profitbricks
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
2021-04-07 05:33:22 -04:00
|
|
|
builderT "github.com/hashicorp/packer/acctest"
|
2016-06-28 22:35:41 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
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",
|
2016-09-28 18:04:14 -04:00
|
|
|
"password": "password",
|
|
|
|
"username": "username",
|
|
|
|
"snapshot_name": "packer",
|
2016-06-28 22:35:41 -04:00
|
|
|
"type": "profitbricks"
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
`
|