blob: 2c28dcbcc986d35ecd7dcd6d2a209bab055b52c1 [file] [log] [blame]
Jon Perritt35e27e42014-12-05 11:10:46 -07001// +build acceptance
2
3package v1
4
5import (
Jon Perrittf7d3d142015-02-09 18:44:26 -07006 "fmt"
Jon Perritt35e27e42014-12-05 11:10:46 -07007 "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 Perrittf7d3d142015-02-09 18:44:26 -070015var template = fmt.Sprintf(`
Jon Perrittc8cc45e2014-12-22 22:19:03 -070016{
Jon Perrittf7d3d142015-02-09 18:44:26 -070017 "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 Perrittc8cc45e2014-12-22 22:19:03 -070028 }
Jon Perrittf7d3d142015-02-09 18:44:26 -070029 }
30}`, os.Getenv("OS_FLAVOR_ID"), os.Getenv("OS_IMAGE_ID"))
Jon Perrittc8cc45e2014-12-22 22:19:03 -070031
Jon Perritt35e27e42014-12-05 11:10:46 -070032func 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}