packer-cn/builder/hcloud/builder_acc_test.go

36 lines
629 B
Go
Raw Normal View History

2018-10-17 06:15:47 -04:00
package hcloud
import (
"os"
"testing"
2020-12-17 16:29:25 -05:00
builderT "github.com/hashicorp/packer-plugin-sdk/acctest"
2018-10-17 06:15:47 -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("HCLOUD_TOKEN"); v == "" {
t.Fatal("HCLOUD_TOKEN must be set for acceptance tests")
}
}
const testBuilderAccBasic = `
{
"builders": [{
"type": "test",
"location": "nbg1",
"server_type": "cx11",
"image": "ubuntu-18.04",
"user_data": "",
"user_data_file": ""
}]
}
`