Jon Perritt | 35e27e4 | 2014-12-05 11:10:46 -0700 | [diff] [blame] | 1 | // +build acceptance |
| 2 | |
| 3 | package v1 |
| 4 | |
| 5 | import ( |
Jon Perritt | f7d3d14 | 2015-02-09 18:44:26 -0700 | [diff] [blame] | 6 | "fmt" |
Jon Perritt | 35e27e4 | 2014-12-05 11:10:46 -0700 | [diff] [blame] | 7 | "os" |
| 8 | "testing" |
| 9 | |
| 10 | "github.com/rackspace/gophercloud" |
| 11 | "github.com/rackspace/gophercloud/openstack" |
| 12 | th "github.com/rackspace/gophercloud/testhelper" |
| 13 | ) |
| 14 | |
Jon Perritt | f7d3d14 | 2015-02-09 18:44:26 -0700 | [diff] [blame] | 15 | var template = fmt.Sprintf(` |
Jon Perritt | c8cc45e | 2014-12-22 22:19:03 -0700 | [diff] [blame] | 16 | { |
Jon Perritt | f7d3d14 | 2015-02-09 18:44:26 -0700 | [diff] [blame] | 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 | } |
Jon Perritt | c8cc45e | 2014-12-22 22:19:03 -0700 | [diff] [blame] | 28 | } |
Jon Perritt | f7d3d14 | 2015-02-09 18:44:26 -0700 | [diff] [blame] | 29 | } |
| 30 | }`, os.Getenv("OS_FLAVOR_ID"), os.Getenv("OS_IMAGE_ID")) |
Jon Perritt | c8cc45e | 2014-12-22 22:19:03 -0700 | [diff] [blame] | 31 | |
Jon Perritt | 35e27e4 | 2014-12-05 11:10:46 -0700 | [diff] [blame] | 32 | func newClient(t *testing.T) *gophercloud.ServiceClient { |
| 33 | ao, err := openstack.AuthOptionsFromEnv() |
| 34 | th.AssertNoErr(t, err) |
| 35 | |
| 36 | client, err := openstack.AuthenticatedClient(ao) |
| 37 | th.AssertNoErr(t, err) |
| 38 | |
| 39 | c, err := openstack.NewOrchestrationV1(client, gophercloud.EndpointOpts{ |
| 40 | Region: os.Getenv("OS_REGION_NAME"), |
| 41 | }) |
| 42 | th.AssertNoErr(t, err) |
| 43 | return c |
| 44 | } |