github.phpd.cn/hashicorp/packer@v1.3.2/builder/hcloud/builder_acc_test.go (about) 1 package hcloud 2 3 import ( 4 "os" 5 "testing" 6 7 builderT "github.com/hashicorp/packer/helper/builder/testing" 8 ) 9 10 func TestBuilderAcc_basic(t *testing.T) { 11 builderT.Test(t, builderT.TestCase{ 12 PreCheck: func() { testAccPreCheck(t) }, 13 Builder: &Builder{}, 14 Template: testBuilderAccBasic, 15 }) 16 } 17 18 func testAccPreCheck(t *testing.T) { 19 if v := os.Getenv("HCLOUD_TOKEN"); v == "" { 20 t.Fatal("HCLOUD_TOKEN must be set for acceptance tests") 21 } 22 } 23 24 const testBuilderAccBasic = ` 25 { 26 "builders": [{ 27 "type": "test", 28 "location": "nbg1", 29 "server_type": "cx11", 30 "image": "ubuntu-18.04", 31 "user_data": "", 32 "user_data_file": "" 33 }] 34 } 35 `