Jon Perritt | 35e27e4 | 2014-12-05 11:10:46 -0700 | [diff] [blame] | 1 | // +build acceptance |
| 2 | |
| 3 | package v1 |
| 4 | |
| 5 | import ( |
| 6 | "os" |
| 7 | "testing" |
| 8 | |
| 9 | "github.com/rackspace/gophercloud" |
| 10 | "github.com/rackspace/gophercloud/openstack" |
| 11 | th "github.com/rackspace/gophercloud/testhelper" |
| 12 | ) |
| 13 | |
Jon Perritt | c8cc45e | 2014-12-22 22:19:03 -0700 | [diff] [blame^] | 14 | const template = ` |
| 15 | { |
| 16 | "heat_template_version": "2013-05-23", |
| 17 | "description": "Simple template to test heat commands", |
| 18 | "parameters": { |
| 19 | "flavor": { |
| 20 | "default": "m1.tiny", |
| 21 | "type": "string" |
| 22 | } |
| 23 | }, |
| 24 | "resources": { |
| 25 | "hello_world": { |
| 26 | "type":"OS::Nova::Server", |
| 27 | "properties": { |
| 28 | "key_name": "heat_key", |
| 29 | "flavor": { |
| 30 | "get_param": "flavor" |
| 31 | }, |
| 32 | "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", |
| 33 | "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | ` |
| 39 | |
Jon Perritt | 35e27e4 | 2014-12-05 11:10:46 -0700 | [diff] [blame] | 40 | func newClient(t *testing.T) *gophercloud.ServiceClient { |
| 41 | ao, err := openstack.AuthOptionsFromEnv() |
| 42 | th.AssertNoErr(t, err) |
| 43 | |
| 44 | client, err := openstack.AuthenticatedClient(ao) |
| 45 | th.AssertNoErr(t, err) |
| 46 | |
| 47 | c, err := openstack.NewOrchestrationV1(client, gophercloud.EndpointOpts{ |
| 48 | Region: os.Getenv("OS_REGION_NAME"), |
| 49 | }) |
| 50 | th.AssertNoErr(t, err) |
| 51 | return c |
| 52 | } |