github.phpd.cn/hashicorp/packer@v1.3.2/builder/oneandone/builder_acc_test.go (about)

     1  package oneandone
     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("ONEANDONE_TOKEN"); v == "" {
    20  		t.Fatal("ONEANDONE_TOKEN must be set for acceptance tests")
    21  	}
    22  }
    23  
    24  const testBuilderAccBasic = `
    25  {
    26        "builders": [{
    27  	      "type": "oneandone",
    28  	      "disk_size": "50",
    29  	      "snapshot_name": "test5",
    30  	      "image" : "ubuntu1604-64min"
    31      }]
    32  }
    33  `