2019-02-11 17:43:16 -05:00
|
|
|
/*
|
|
|
|
Deregister the test image with
|
|
|
|
aws oapi deregister-image --image-id $(aws oapi describe-images --output text --filters "Name=name,Values=packer-test-packer-test-dereg" --query 'Images[*].{ID:ImageId}')
|
|
|
|
*/
|
|
|
|
package bsu
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/tls"
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hashicorp/packer/builder/osc/common"
|
|
|
|
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
|
|
|
"github.com/outscale/osc-go/oapi"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBuilderAcc_basic(t *testing.T) {
|
|
|
|
builderT.Test(t, builderT.TestCase{
|
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
Builder: &Builder{},
|
|
|
|
Template: testBuilderAccBasic,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func testAccPreCheck(t *testing.T) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func testOAPIConn() (*oapi.Client, error) {
|
|
|
|
access := &common.AccessConfig{RawRegion: "us-east-1"}
|
|
|
|
clientConfig, err := access.Config()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
skipClient := &http.Client{
|
|
|
|
Transport: &http.Transport{
|
|
|
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return oapi.NewClient(clientConfig, skipClient), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
const testBuilderAccBasic = `
|
|
|
|
{
|
|
|
|
"builders": [{
|
|
|
|
"type": "test",
|
|
|
|
"region": "eu-west-2",
|
2019-03-05 14:31:28 -05:00
|
|
|
"vm_type": "t2.micro",
|
2019-02-13 12:32:48 -05:00
|
|
|
"source_omi": "ami-46260446",
|
2019-03-05 14:31:28 -05:00
|
|
|
"ssh_username": "outscale",
|
2019-02-11 17:43:16 -05:00
|
|
|
"omi_name": "packer-test {{timestamp}}"
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
`
|