blob: b0103859ca08edcd904f42e1000f2fb612b20f7e [file] [log] [blame]
Jon Perritt35e27e42014-12-05 11:10:46 -07001// +build acceptance
2
3package v1
4
5import (
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 Perrittc8cc45e2014-12-22 22:19:03 -070014const 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 Perritt35e27e42014-12-05 11:10:46 -070040func 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}