Jon Perritt | 5a0ddd8 | 2015-02-09 17:07:21 -0700 | [diff] [blame] | 1 | // +build acceptance |
| 2 | |
| 3 | package v1 |
| 4 | |
| 5 | import ( |
| 6 | "fmt" |
| 7 | "os" |
| 8 | "testing" |
| 9 | |
| 10 | "github.com/rackspace/gophercloud" |
| 11 | "github.com/rackspace/gophercloud/rackspace" |
| 12 | th "github.com/rackspace/gophercloud/testhelper" |
| 13 | ) |
| 14 | |
| 15 | var template = fmt.Sprintf(` |
| 16 | { |
| 17 | "heat_template_version": "2013-05-23", |
| 18 | "description": "Simple template to test heat commands", |
| 19 | "parameters": {}, |
| 20 | "resources": { |
| 21 | "hello_world": { |
| 22 | "type":"OS::Nova::Server", |
| 23 | "properties": { |
| 24 | "flavor": "%s", |
| 25 | "image": "%s", |
| 26 | "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | `, os.Getenv("RS_FLAVOR_ID"), os.Getenv("RS_IMAGE_ID")) |
| 32 | |
| 33 | func newClient(t *testing.T) *gophercloud.ServiceClient { |
| 34 | ao, err := rackspace.AuthOptionsFromEnv() |
| 35 | th.AssertNoErr(t, err) |
| 36 | |
| 37 | client, err := rackspace.AuthenticatedClient(ao) |
| 38 | th.AssertNoErr(t, err) |
| 39 | |
| 40 | c, err := rackspace.NewOrchestrationV1(client, gophercloud.EndpointOpts{ |
| 41 | Region: os.Getenv("RS_REGION_NAME"), |
| 42 | }) |
| 43 | th.AssertNoErr(t, err) |
| 44 | return c |
| 45 | } |