move unit tests into 'testing' directories
diff --git a/openstack/orchestration/v1/stacks/environment_test.go b/openstack/orchestration/v1/stacks/environment_test.go
index 5f8a430..a7e3aae 100644
--- a/openstack/orchestration/v1/stacks/environment_test.go
+++ b/openstack/orchestration/v1/stacks/environment_test.go
@@ -11,6 +11,7 @@
)
func TestEnvironmentValidation(t *testing.T) {
+
environmentJSON := new(Environment)
environmentJSON.Bin = []byte(ValidJSONEnvironment)
err := environmentJSON.Validate()
diff --git a/openstack/orchestration/v1/stacks/fixtures.go b/openstack/orchestration/v1/stacks/fixtures.go
index 4126cf6..d6fd075 100644
--- a/openstack/orchestration/v1/stacks/fixtures.go
+++ b/openstack/orchestration/v1/stacks/fixtures.go
@@ -1,412 +1,5 @@
-// +build fixtures
-
package stacks
-import (
- "fmt"
- "net/http"
- "testing"
- "time"
-
- "github.com/gophercloud/gophercloud"
- th "github.com/gophercloud/gophercloud/testhelper"
- fake "github.com/gophercloud/gophercloud/testhelper/client"
-)
-
-// CreateExpected represents the expected object from a Create request.
-var CreateExpected = &CreatedStack{
- ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- Links: []gophercloud.Link{
- gophercloud.Link{
- Href: "http://168.28.170.117:8004/v1/98606384f58drad0bhdb7d02779549ac/stacks/stackcreated/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- Rel: "self",
- },
- },
-}
-
-// CreateOutput represents the response body from a Create request.
-const CreateOutput = `
-{
- "stack": {
- "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- "links": [
- {
- "href": "http://168.28.170.117:8004/v1/98606384f58drad0bhdb7d02779549ac/stacks/stackcreated/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- "rel": "self"
- }
- ]
- }
-}`
-
-// HandleCreateSuccessfully creates an HTTP handler at `/stacks` on the test handler mux
-// that responds with a `Create` response.
-func HandleCreateSuccessfully(t *testing.T, output string) {
- th.Mux.HandleFunc("/stacks", func(w http.ResponseWriter, r *http.Request) {
- th.TestMethod(t, r, "POST")
- th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
- th.TestHeader(t, r, "Accept", "application/json")
- w.WriteHeader(http.StatusCreated)
- fmt.Fprintf(w, output)
- })
-}
-
-// ListExpected represents the expected object from a List request.
-var ListExpected = []ListedStack{
- ListedStack{
- Description: "Simple template to test heat commands",
- Links: []gophercloud.Link{
- gophercloud.Link{
- Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- Rel: "self",
- },
- },
- StatusReason: "Stack CREATE completed successfully",
- Name: "postman_stack",
- CreationTime: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC)),
- Status: "CREATE_COMPLETE",
- ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- Tags: []string{"rackspace", "atx"},
- },
- ListedStack{
- Description: "Simple template to test heat commands",
- Links: []gophercloud.Link{
- gophercloud.Link{
- Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada",
- Rel: "self",
- },
- },
- StatusReason: "Stack successfully updated",
- Name: "gophercloud-test-stack-2",
- CreationTime: gophercloud.JSONRFC3339NoZ(time.Date(2014, 12, 11, 17, 39, 16, 0, time.UTC)),
- UpdatedTime: gophercloud.JSONRFC3339NoZ(time.Date(2014, 12, 11, 17, 40, 37, 0, time.UTC)),
- Status: "UPDATE_COMPLETE",
- ID: "db6977b2-27aa-4775-9ae7-6213212d4ada",
- Tags: []string{"sfo", "satx"},
- },
-}
-
-// FullListOutput represents the response body from a List request without a marker.
-const FullListOutput = `
-{
- "stacks": [
- {
- "description": "Simple template to test heat commands",
- "links": [
- {
- "href": "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- "rel": "self"
- }
- ],
- "stack_status_reason": "Stack CREATE completed successfully",
- "stack_name": "postman_stack",
- "creation_time": "2015-02-03T20:07:39",
- "updated_time": null,
- "stack_status": "CREATE_COMPLETE",
- "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- "tags": ["rackspace", "atx"]
- },
- {
- "description": "Simple template to test heat commands",
- "links": [
- {
- "href": "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada",
- "rel": "self"
- }
- ],
- "stack_status_reason": "Stack successfully updated",
- "stack_name": "gophercloud-test-stack-2",
- "creation_time": "2014-12-11T17:39:16",
- "updated_time": "2014-12-11T17:40:37",
- "stack_status": "UPDATE_COMPLETE",
- "id": "db6977b2-27aa-4775-9ae7-6213212d4ada",
- "tags": ["sfo", "satx"]
- }
- ]
-}
-`
-
-// HandleListSuccessfully creates an HTTP handler at `/stacks` on the test handler mux
-// that responds with a `List` response.
-func HandleListSuccessfully(t *testing.T, output string) {
- th.Mux.HandleFunc("/stacks", func(w http.ResponseWriter, r *http.Request) {
- th.TestMethod(t, r, "GET")
- th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
- th.TestHeader(t, r, "Accept", "application/json")
-
- w.Header().Set("Content-Type", "application/json")
- r.ParseForm()
- marker := r.Form.Get("marker")
- switch marker {
- case "":
- fmt.Fprintf(w, output)
- case "db6977b2-27aa-4775-9ae7-6213212d4ada":
- fmt.Fprintf(w, `[]`)
- default:
- t.Fatalf("Unexpected marker: [%s]", marker)
- }
- })
-}
-
-// GetExpected represents the expected object from a Get request.
-var GetExpected = &RetrievedStack{
- DisableRollback: true,
- Description: "Simple template to test heat commands",
- Parameters: map[string]string{
- "flavor": "m1.tiny",
- "OS::stack_name": "postman_stack",
- "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- },
- StatusReason: "Stack CREATE completed successfully",
- Name: "postman_stack",
- Outputs: []map[string]interface{}{},
- CreationTime: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC)),
- Links: []gophercloud.Link{
- gophercloud.Link{
- Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- Rel: "self",
- },
- },
- Capabilities: []interface{}{},
- NotificationTopics: []interface{}{},
- Status: "CREATE_COMPLETE",
- ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- TemplateDescription: "Simple template to test heat commands",
- Tags: []string{"rackspace", "atx"},
-}
-
-// GetOutput represents the response body from a Get request.
-const GetOutput = `
-{
- "stack": {
- "disable_rollback": true,
- "description": "Simple template to test heat commands",
- "parameters": {
- "flavor": "m1.tiny",
- "OS::stack_name": "postman_stack",
- "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87"
- },
- "stack_status_reason": "Stack CREATE completed successfully",
- "stack_name": "postman_stack",
- "outputs": [],
- "creation_time": "2015-02-03T20:07:39",
- "links": [
- {
- "href": "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- "rel": "self"
- }
- ],
- "capabilities": [],
- "notification_topics": [],
- "timeout_mins": null,
- "stack_status": "CREATE_COMPLETE",
- "updated_time": null,
- "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- "template_description": "Simple template to test heat commands",
- "tags": ["rackspace", "atx"]
- }
-}
-`
-
-// HandleGetSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87`
-// on the test handler mux that responds with a `Get` response.
-func HandleGetSuccessfully(t *testing.T, output string) {
- th.Mux.HandleFunc("/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", func(w http.ResponseWriter, r *http.Request) {
- th.TestMethod(t, r, "GET")
- th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
- th.TestHeader(t, r, "Accept", "application/json")
-
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- fmt.Fprintf(w, output)
- })
-}
-
-// HandleUpdateSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87`
-// on the test handler mux that responds with an `Update` response.
-func HandleUpdateSuccessfully(t *testing.T) {
- th.Mux.HandleFunc("/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada", func(w http.ResponseWriter, r *http.Request) {
- th.TestMethod(t, r, "PUT")
- th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
- th.TestHeader(t, r, "Accept", "application/json")
-
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusAccepted)
- })
-}
-
-// HandleDeleteSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87`
-// on the test handler mux that responds with a `Delete` response.
-func HandleDeleteSuccessfully(t *testing.T) {
- th.Mux.HandleFunc("/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada", func(w http.ResponseWriter, r *http.Request) {
- th.TestMethod(t, r, "DELETE")
- th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
- th.TestHeader(t, r, "Accept", "application/json")
-
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusNoContent)
- })
-}
-
-// GetExpected represents the expected object from a Get request.
-var PreviewExpected = &PreviewedStack{
- DisableRollback: true,
- Description: "Simple template to test heat commands",
- Parameters: map[string]string{
- "flavor": "m1.tiny",
- "OS::stack_name": "postman_stack",
- "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- },
- Name: "postman_stack",
- CreationTime: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC)),
- Links: []gophercloud.Link{
- gophercloud.Link{
- Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- Rel: "self",
- },
- },
- Capabilities: []interface{}{},
- NotificationTopics: []interface{}{},
- ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- TemplateDescription: "Simple template to test heat commands",
-}
-
-// HandlePreviewSuccessfully creates an HTTP handler at `/stacks/preview`
-// on the test handler mux that responds with a `Preview` response.
-func HandlePreviewSuccessfully(t *testing.T, output string) {
- th.Mux.HandleFunc("/stacks/preview", func(w http.ResponseWriter, r *http.Request) {
- th.TestMethod(t, r, "POST")
- th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
- th.TestHeader(t, r, "Accept", "application/json")
-
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- fmt.Fprintf(w, output)
- })
-}
-
-// AbandonExpected represents the expected object from an Abandon request.
-var AbandonExpected = &AbandonedStack{
- Status: "COMPLETE",
- Name: "postman_stack",
- Template: map[string]interface{}{
- "heat_template_version": "2013-05-23",
- "description": "Simple template to test heat commands",
- "parameters": map[string]interface{}{
- "flavor": map[string]interface{}{
- "default": "m1.tiny",
- "type": "string",
- },
- },
- "resources": map[string]interface{}{
- "hello_world": map[string]interface{}{
- "type": "OS::Nova::Server",
- "properties": map[string]interface{}{
- "key_name": "heat_key",
- "flavor": map[string]interface{}{
- "get_param": "flavor",
- },
- "image": "ad091b52-742f-469e-8f3c-fd81cadf0743",
- "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n",
- },
- },
- },
- },
- Action: "CREATE",
- ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- Resources: map[string]interface{}{
- "hello_world": map[string]interface{}{
- "status": "COMPLETE",
- "name": "hello_world",
- "resource_id": "8a310d36-46fc-436f-8be4-37a696b8ac63",
- "action": "CREATE",
- "type": "OS::Nova::Server",
- },
- },
- Files: map[string]string{
- "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "heat_template_version: 2014-10-16\nparameters:\n flavor:\n type: string\n description: Flavor for the server to be created\n default: 4353\n hidden: true\nresources:\n test_server:\n type: \"OS::Nova::Server\"\n properties:\n name: test-server\n flavor: 2 GB General Purpose v1\n image: Debian 7 (Wheezy) (PVHVM)\n",
- },
- StackUserProjectID: "897686",
- ProjectID: "897686",
- Environment: map[string]interface{}{
- "encrypted_param_names": make([]map[string]interface{}, 0),
- "parameter_defaults": make(map[string]interface{}),
- "parameters": make(map[string]interface{}),
- "resource_registry": map[string]interface{}{
- "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml",
- "resources": make(map[string]interface{}),
- },
- },
-}
-
-// AbandonOutput represents the response body from an Abandon request.
-const AbandonOutput = `
-{
- "status": "COMPLETE",
- "name": "postman_stack",
- "template": {
- "heat_template_version": "2013-05-23",
- "description": "Simple template to test heat commands",
- "parameters": {
- "flavor": {
- "default": "m1.tiny",
- "type": "string"
- }
- },
- "resources": {
- "hello_world": {
- "type": "OS::Nova::Server",
- "properties": {
- "key_name": "heat_key",
- "flavor": {
- "get_param": "flavor"
- },
- "image": "ad091b52-742f-469e-8f3c-fd81cadf0743",
- "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n"
- }
- }
- }
- },
- "action": "CREATE",
- "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
- "resources": {
- "hello_world": {
- "status": "COMPLETE",
- "name": "hello_world",
- "resource_id": "8a310d36-46fc-436f-8be4-37a696b8ac63",
- "action": "CREATE",
- "type": "OS::Nova::Server"
- }
- },
- "files": {
- "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "heat_template_version: 2014-10-16\nparameters:\n flavor:\n type: string\n description: Flavor for the server to be created\n default: 4353\n hidden: true\nresources:\n test_server:\n type: \"OS::Nova::Server\"\n properties:\n name: test-server\n flavor: 2 GB General Purpose v1\n image: Debian 7 (Wheezy) (PVHVM)\n"
-},
- "environment": {
- "encrypted_param_names": [],
- "parameter_defaults": {},
- "parameters": {},
- "resource_registry": {
- "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml",
- "resources": {}
- }
- },
- "stack_user_project_id": "897686",
- "project_id": "897686"
-}`
-
-// HandleAbandonSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87/abandon`
-// on the test handler mux that responds with an `Abandon` response.
-func HandleAbandonSuccessfully(t *testing.T, output string) {
- th.Mux.HandleFunc("/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c8/abandon", func(w http.ResponseWriter, r *http.Request) {
- th.TestMethod(t, r, "DELETE")
- th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
- th.TestHeader(t, r, "Accept", "application/json")
-
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- fmt.Fprintf(w, output)
- })
-}
-
// ValidJSONTemplate is a valid OpenStack Heat template in JSON format
const ValidJSONTemplate = `
{
@@ -432,29 +25,6 @@
}
`
-// ValidJSONTemplateParsed is the expected parsed version of ValidJSONTemplate
-var ValidJSONTemplateParsed = map[string]interface{}{
- "heat_template_version": "2014-10-16",
- "parameters": map[string]interface{}{
- "flavor": map[string]interface{}{
- "default": 4353,
- "description": "Flavor for the server to be created",
- "hidden": true,
- "type": "string",
- },
- },
- "resources": map[string]interface{}{
- "test_server": map[string]interface{}{
- "properties": map[string]interface{}{
- "flavor": "2 GB General Purpose v1",
- "image": "Debian 7 (Wheezy) (PVHVM)",
- "name": "test-server",
- },
- "type": "OS::Nova::Server",
- },
- },
-}
-
// ValidYAMLTemplate is a valid OpenStack Heat template in YAML format
const ValidYAMLTemplate = `
heat_template_version: 2014-10-16
@@ -493,39 +63,84 @@
// ValidJSONEnvironment is a valid environment for a stack in JSON format
const ValidJSONEnvironment = `
{
- "parameters": {
- "user_key": "userkey"
- },
- "resource_registry": {
- "My::WP::Server": "file:///home/shardy/git/heat-templates/hot/F18/WordPress_Native.yaml",
- "OS::Quantum*": "OS::Neutron*",
- "AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml",
- "OS::Metering::Alarm": "OS::Ceilometer::Alarm",
- "AWS::RDS::DBInstance": "file:///etc/heat/templates/AWS_RDS_DBInstance.yaml",
- "resources": {
- "my_db_server": {
- "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml"
- },
- "my_server": {
- "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml",
- "hooks": "pre-create"
- },
- "nested_stack": {
- "nested_resource": {
- "hooks": "pre-update"
- },
- "another_resource": {
- "hooks": [
- "pre-create",
- "pre-update"
- ]
- }
- }
- }
- }
+ "parameters": {
+ "user_key": "userkey"
+ },
+ "resource_registry": {
+ "My::WP::Server": "file:///home/shardy/git/heat-templates/hot/F18/WordPress_Native.yaml",
+ "OS::Quantum*": "OS::Neutron*",
+ "AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml",
+ "OS::Metering::Alarm": "OS::Ceilometer::Alarm",
+ "AWS::RDS::DBInstance": "file:///etc/heat/templates/AWS_RDS_DBInstance.yaml",
+ "resources": {
+ "my_db_server": {
+ "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml"
+ },
+ "my_server": {
+ "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml",
+ "hooks": "pre-create"
+ },
+ "nested_stack": {
+ "nested_resource": {
+ "hooks": "pre-update"
+ },
+ "another_resource": {
+ "hooks": [
+ "pre-create",
+ "pre-update"
+ ]
+ }
+ }
+ }
+ }
}
`
+// ValidYAMLEnvironment is a valid environment for a stack in YAML format
+const ValidYAMLEnvironment = `
+parameters:
+ user_key: userkey
+resource_registry:
+ My::WP::Server: file:///home/shardy/git/heat-templates/hot/F18/WordPress_Native.yaml
+ # allow older templates with Quantum in them.
+ "OS::Quantum*": "OS::Neutron*"
+ # Choose your implementation of AWS::CloudWatch::Alarm
+ "AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml"
+ #"AWS::CloudWatch::Alarm": "OS::Heat::CWLiteAlarm"
+ "OS::Metering::Alarm": "OS::Ceilometer::Alarm"
+ "AWS::RDS::DBInstance": "file:///etc/heat/templates/AWS_RDS_DBInstance.yaml"
+ resources:
+ my_db_server:
+ "OS::DBInstance": file:///home/mine/all_my_cool_templates/db.yaml
+ my_server:
+ "OS::DBInstance": file:///home/mine/all_my_cool_templates/db.yaml
+ hooks: pre-create
+ nested_stack:
+ nested_resource:
+ hooks: pre-update
+ another_resource:
+ hooks: [pre-create, pre-update]
+`
+
+// InvalidEnvironment is an invalid environment as it has an extra section called `resources`
+const InvalidEnvironment = `
+parameters:
+ flavor:
+ type: string
+ description: Flavor for the server to be created
+ default: 4353
+ hidden: true
+resources:
+ test_server:
+ type: "OS::Nova::Server"
+ properties:
+ name: test-server
+ flavor: 2 GB General Purpose v1
+ image: Debian 7 (Wheezy) (PVHVM)
+parameter_defaults:
+ KeyName: heat_key
+`
+
// ValidJSONEnvironmentParsed is the expected parsed version of ValidJSONEnvironment
var ValidJSONEnvironmentParsed = map[string]interface{}{
"parameters": map[string]interface{}{
@@ -560,47 +175,25 @@
},
}
-// ValidYAMLEnvironment is a valid environment for a stack in YAML format
-const ValidYAMLEnvironment = `
-parameters:
- user_key: userkey
-resource_registry:
- My::WP::Server: file:///home/shardy/git/heat-templates/hot/F18/WordPress_Native.yaml
- # allow older templates with Quantum in them.
- "OS::Quantum*": "OS::Neutron*"
- # Choose your implementation of AWS::CloudWatch::Alarm
- "AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml"
- #"AWS::CloudWatch::Alarm": "OS::Heat::CWLiteAlarm"
- "OS::Metering::Alarm": "OS::Ceilometer::Alarm"
- "AWS::RDS::DBInstance": "file:///etc/heat/templates/AWS_RDS_DBInstance.yaml"
- resources:
- my_db_server:
- "OS::DBInstance": file:///home/mine/all_my_cool_templates/db.yaml
- my_server:
- "OS::DBInstance": file:///home/mine/all_my_cool_templates/db.yaml
- hooks: pre-create
- nested_stack:
- nested_resource:
- hooks: pre-update
- another_resource:
- hooks: [pre-create, pre-update]
-`
-
-// InvalidEnvironment is an invalid environment as it has an extra section called `resources`
-const InvalidEnvironment = `
-parameters:
- flavor:
- type: string
- description: Flavor for the server to be created
- default: 4353
- hidden: true
-resources:
- test_server:
- type: "OS::Nova::Server"
- properties:
- name: test-server
- flavor: 2 GB General Purpose v1
- image: Debian 7 (Wheezy) (PVHVM)
-parameter_defaults:
- KeyName: heat_key
-`
+// ValidJSONTemplateParsed is the expected parsed version of ValidJSONTemplate
+var ValidJSONTemplateParsed = map[string]interface{}{
+ "heat_template_version": "2014-10-16",
+ "parameters": map[string]interface{}{
+ "flavor": map[string]interface{}{
+ "default": 4353,
+ "description": "Flavor for the server to be created",
+ "hidden": true,
+ "type": "string",
+ },
+ },
+ "resources": map[string]interface{}{
+ "test_server": map[string]interface{}{
+ "properties": map[string]interface{}{
+ "flavor": "2 GB General Purpose v1",
+ "image": "Debian 7 (Wheezy) (PVHVM)",
+ "name": "test-server",
+ },
+ "type": "OS::Nova::Server",
+ },
+ },
+}
diff --git a/openstack/orchestration/v1/stacks/testing/doc.go b/openstack/orchestration/v1/stacks/testing/doc.go
new file mode 100644
index 0000000..7603f83
--- /dev/null
+++ b/openstack/orchestration/v1/stacks/testing/doc.go
@@ -0,0 +1 @@
+package testing
diff --git a/openstack/orchestration/v1/stacks/testing/fixtures.go b/openstack/orchestration/v1/stacks/testing/fixtures.go
new file mode 100644
index 0000000..2afbed2
--- /dev/null
+++ b/openstack/orchestration/v1/stacks/testing/fixtures.go
@@ -0,0 +1,407 @@
+package testing
+
+import (
+ "fmt"
+ "net/http"
+ "testing"
+ "time"
+
+ "github.com/gophercloud/gophercloud"
+ "github.com/gophercloud/gophercloud/openstack/orchestration/v1/stacks"
+ th "github.com/gophercloud/gophercloud/testhelper"
+ fake "github.com/gophercloud/gophercloud/testhelper/client"
+)
+
+// CreateExpected represents the expected object from a Create request.
+var CreateExpected = &stacks.CreatedStack{
+ ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ Links: []gophercloud.Link{
+ {
+ Href: "http://168.28.170.117:8004/v1/98606384f58drad0bhdb7d02779549ac/stacks/stackcreated/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ Rel: "self",
+ },
+ },
+}
+
+// CreateOutput represents the response body from a Create request.
+const CreateOutput = `
+{
+ "stack": {
+ "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ "links": [
+ {
+ "href": "http://168.28.170.117:8004/v1/98606384f58drad0bhdb7d02779549ac/stacks/stackcreated/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ "rel": "self"
+ }
+ ]
+ }
+}`
+
+// HandleCreateSuccessfully creates an HTTP handler at `/stacks` on the test handler mux
+// that responds with a `Create` response.
+func HandleCreateSuccessfully(t *testing.T, output string) {
+ th.Mux.HandleFunc("/stacks", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "POST")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ th.TestHeader(t, r, "Accept", "application/json")
+ w.WriteHeader(http.StatusCreated)
+ fmt.Fprintf(w, output)
+ })
+}
+
+// ListExpected represents the expected object from a List request.
+var ListExpected = []stacks.ListedStack{
+ {
+ Description: "Simple template to test heat commands",
+ Links: []gophercloud.Link{
+ {
+ Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ Rel: "self",
+ },
+ },
+ StatusReason: "Stack CREATE completed successfully",
+ Name: "postman_stack",
+ CreationTime: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC)),
+ Status: "CREATE_COMPLETE",
+ ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ Tags: []string{"rackspace", "atx"},
+ },
+ {
+ Description: "Simple template to test heat commands",
+ Links: []gophercloud.Link{
+ {
+ Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada",
+ Rel: "self",
+ },
+ },
+ StatusReason: "Stack successfully updated",
+ Name: "gophercloud-test-stack-2",
+ CreationTime: gophercloud.JSONRFC3339NoZ(time.Date(2014, 12, 11, 17, 39, 16, 0, time.UTC)),
+ UpdatedTime: gophercloud.JSONRFC3339NoZ(time.Date(2014, 12, 11, 17, 40, 37, 0, time.UTC)),
+ Status: "UPDATE_COMPLETE",
+ ID: "db6977b2-27aa-4775-9ae7-6213212d4ada",
+ Tags: []string{"sfo", "satx"},
+ },
+}
+
+// FullListOutput represents the response body from a List request without a marker.
+const FullListOutput = `
+{
+ "stacks": [
+ {
+ "description": "Simple template to test heat commands",
+ "links": [
+ {
+ "href": "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ "rel": "self"
+ }
+ ],
+ "stack_status_reason": "Stack CREATE completed successfully",
+ "stack_name": "postman_stack",
+ "creation_time": "2015-02-03T20:07:39",
+ "updated_time": null,
+ "stack_status": "CREATE_COMPLETE",
+ "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ "tags": ["rackspace", "atx"]
+ },
+ {
+ "description": "Simple template to test heat commands",
+ "links": [
+ {
+ "href": "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada",
+ "rel": "self"
+ }
+ ],
+ "stack_status_reason": "Stack successfully updated",
+ "stack_name": "gophercloud-test-stack-2",
+ "creation_time": "2014-12-11T17:39:16",
+ "updated_time": "2014-12-11T17:40:37",
+ "stack_status": "UPDATE_COMPLETE",
+ "id": "db6977b2-27aa-4775-9ae7-6213212d4ada",
+ "tags": ["sfo", "satx"]
+ }
+ ]
+}
+`
+
+// HandleListSuccessfully creates an HTTP handler at `/stacks` on the test handler mux
+// that responds with a `List` response.
+func HandleListSuccessfully(t *testing.T, output string) {
+ th.Mux.HandleFunc("/stacks", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "GET")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ th.TestHeader(t, r, "Accept", "application/json")
+
+ w.Header().Set("Content-Type", "application/json")
+ r.ParseForm()
+ marker := r.Form.Get("marker")
+ switch marker {
+ case "":
+ fmt.Fprintf(w, output)
+ case "db6977b2-27aa-4775-9ae7-6213212d4ada":
+ fmt.Fprintf(w, `[]`)
+ default:
+ t.Fatalf("Unexpected marker: [%s]", marker)
+ }
+ })
+}
+
+// GetExpected represents the expected object from a Get request.
+var GetExpected = &stacks.RetrievedStack{
+ DisableRollback: true,
+ Description: "Simple template to test heat commands",
+ Parameters: map[string]string{
+ "flavor": "m1.tiny",
+ "OS::stack_name": "postman_stack",
+ "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ },
+ StatusReason: "Stack CREATE completed successfully",
+ Name: "postman_stack",
+ Outputs: []map[string]interface{}{},
+ CreationTime: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC)),
+ Links: []gophercloud.Link{
+ {
+ Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ Rel: "self",
+ },
+ },
+ Capabilities: []interface{}{},
+ NotificationTopics: []interface{}{},
+ Status: "CREATE_COMPLETE",
+ ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ TemplateDescription: "Simple template to test heat commands",
+ Tags: []string{"rackspace", "atx"},
+}
+
+// GetOutput represents the response body from a Get request.
+const GetOutput = `
+{
+ "stack": {
+ "disable_rollback": true,
+ "description": "Simple template to test heat commands",
+ "parameters": {
+ "flavor": "m1.tiny",
+ "OS::stack_name": "postman_stack",
+ "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87"
+ },
+ "stack_status_reason": "Stack CREATE completed successfully",
+ "stack_name": "postman_stack",
+ "outputs": [],
+ "creation_time": "2015-02-03T20:07:39",
+ "links": [
+ {
+ "href": "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ "rel": "self"
+ }
+ ],
+ "capabilities": [],
+ "notification_topics": [],
+ "timeout_mins": null,
+ "stack_status": "CREATE_COMPLETE",
+ "updated_time": null,
+ "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ "template_description": "Simple template to test heat commands",
+ "tags": ["rackspace", "atx"]
+ }
+}
+`
+
+// HandleGetSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87`
+// on the test handler mux that responds with a `Get` response.
+func HandleGetSuccessfully(t *testing.T, output string) {
+ th.Mux.HandleFunc("/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "GET")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ th.TestHeader(t, r, "Accept", "application/json")
+
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusOK)
+ fmt.Fprintf(w, output)
+ })
+}
+
+// HandleUpdateSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87`
+// on the test handler mux that responds with an `Update` response.
+func HandleUpdateSuccessfully(t *testing.T) {
+ th.Mux.HandleFunc("/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "PUT")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ th.TestHeader(t, r, "Accept", "application/json")
+
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusAccepted)
+ })
+}
+
+// HandleDeleteSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87`
+// on the test handler mux that responds with a `Delete` response.
+func HandleDeleteSuccessfully(t *testing.T) {
+ th.Mux.HandleFunc("/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "DELETE")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ th.TestHeader(t, r, "Accept", "application/json")
+
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusNoContent)
+ })
+}
+
+// GetExpected represents the expected object from a Get request.
+var PreviewExpected = &stacks.PreviewedStack{
+ DisableRollback: true,
+ Description: "Simple template to test heat commands",
+ Parameters: map[string]string{
+ "flavor": "m1.tiny",
+ "OS::stack_name": "postman_stack",
+ "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ },
+ Name: "postman_stack",
+ CreationTime: gophercloud.JSONRFC3339NoZ(time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC)),
+ Links: []gophercloud.Link{
+ {
+ Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ Rel: "self",
+ },
+ },
+ Capabilities: []interface{}{},
+ NotificationTopics: []interface{}{},
+ ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ TemplateDescription: "Simple template to test heat commands",
+}
+
+// HandlePreviewSuccessfully creates an HTTP handler at `/stacks/preview`
+// on the test handler mux that responds with a `Preview` response.
+func HandlePreviewSuccessfully(t *testing.T, output string) {
+ th.Mux.HandleFunc("/stacks/preview", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "POST")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ th.TestHeader(t, r, "Accept", "application/json")
+
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusOK)
+ fmt.Fprintf(w, output)
+ })
+}
+
+// AbandonExpected represents the expected object from an Abandon request.
+var AbandonExpected = &stacks.AbandonedStack{
+ Status: "COMPLETE",
+ Name: "postman_stack",
+ Template: map[string]interface{}{
+ "heat_template_version": "2013-05-23",
+ "description": "Simple template to test heat commands",
+ "parameters": map[string]interface{}{
+ "flavor": map[string]interface{}{
+ "default": "m1.tiny",
+ "type": "string",
+ },
+ },
+ "resources": map[string]interface{}{
+ "hello_world": map[string]interface{}{
+ "type": "OS::Nova::Server",
+ "properties": map[string]interface{}{
+ "key_name": "heat_key",
+ "flavor": map[string]interface{}{
+ "get_param": "flavor",
+ },
+ "image": "ad091b52-742f-469e-8f3c-fd81cadf0743",
+ "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n",
+ },
+ },
+ },
+ },
+ Action: "CREATE",
+ ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ Resources: map[string]interface{}{
+ "hello_world": map[string]interface{}{
+ "status": "COMPLETE",
+ "name": "hello_world",
+ "resource_id": "8a310d36-46fc-436f-8be4-37a696b8ac63",
+ "action": "CREATE",
+ "type": "OS::Nova::Server",
+ },
+ },
+ Files: map[string]string{
+ "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "heat_template_version: 2014-10-16\nparameters:\n flavor:\n type: string\n description: Flavor for the server to be created\n default: 4353\n hidden: true\nresources:\n test_server:\n type: \"OS::Nova::Server\"\n properties:\n name: test-server\n flavor: 2 GB General Purpose v1\n image: Debian 7 (Wheezy) (PVHVM)\n",
+ },
+ StackUserProjectID: "897686",
+ ProjectID: "897686",
+ Environment: map[string]interface{}{
+ "encrypted_param_names": make([]map[string]interface{}, 0),
+ "parameter_defaults": make(map[string]interface{}),
+ "parameters": make(map[string]interface{}),
+ "resource_registry": map[string]interface{}{
+ "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml",
+ "resources": make(map[string]interface{}),
+ },
+ },
+}
+
+// AbandonOutput represents the response body from an Abandon request.
+const AbandonOutput = `
+{
+ "status": "COMPLETE",
+ "name": "postman_stack",
+ "template": {
+ "heat_template_version": "2013-05-23",
+ "description": "Simple template to test heat commands",
+ "parameters": {
+ "flavor": {
+ "default": "m1.tiny",
+ "type": "string"
+ }
+ },
+ "resources": {
+ "hello_world": {
+ "type": "OS::Nova::Server",
+ "properties": {
+ "key_name": "heat_key",
+ "flavor": {
+ "get_param": "flavor"
+ },
+ "image": "ad091b52-742f-469e-8f3c-fd81cadf0743",
+ "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n"
+ }
+ }
+ }
+ },
+ "action": "CREATE",
+ "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87",
+ "resources": {
+ "hello_world": {
+ "status": "COMPLETE",
+ "name": "hello_world",
+ "resource_id": "8a310d36-46fc-436f-8be4-37a696b8ac63",
+ "action": "CREATE",
+ "type": "OS::Nova::Server"
+ }
+ },
+ "files": {
+ "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "heat_template_version: 2014-10-16\nparameters:\n flavor:\n type: string\n description: Flavor for the server to be created\n default: 4353\n hidden: true\nresources:\n test_server:\n type: \"OS::Nova::Server\"\n properties:\n name: test-server\n flavor: 2 GB General Purpose v1\n image: Debian 7 (Wheezy) (PVHVM)\n"
+},
+ "environment": {
+ "encrypted_param_names": [],
+ "parameter_defaults": {},
+ "parameters": {},
+ "resource_registry": {
+ "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml",
+ "resources": {}
+ }
+ },
+ "stack_user_project_id": "897686",
+ "project_id": "897686"
+}`
+
+// HandleAbandonSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87/abandon`
+// on the test handler mux that responds with an `Abandon` response.
+func HandleAbandonSuccessfully(t *testing.T, output string) {
+ th.Mux.HandleFunc("/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c8/abandon", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "DELETE")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ th.TestHeader(t, r, "Accept", "application/json")
+
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusOK)
+ fmt.Fprintf(w, output)
+ })
+}
diff --git a/openstack/orchestration/v1/stacks/requests_test.go b/openstack/orchestration/v1/stacks/testing/requests_test.go
similarity index 74%
rename from openstack/orchestration/v1/stacks/requests_test.go
rename to openstack/orchestration/v1/stacks/testing/requests_test.go
index 5cff622..bdc6229 100644
--- a/openstack/orchestration/v1/stacks/requests_test.go
+++ b/openstack/orchestration/v1/stacks/testing/requests_test.go
@@ -1,9 +1,10 @@
-package stacks
+package testing
import (
"testing"
"github.com/gophercloud/gophercloud"
+ "github.com/gophercloud/gophercloud/openstack/orchestration/v1/stacks"
"github.com/gophercloud/gophercloud/pagination"
th "github.com/gophercloud/gophercloud/testhelper"
fake "github.com/gophercloud/gophercloud/testhelper/client"
@@ -13,7 +14,7 @@
th.SetupHTTP()
defer th.TeardownHTTP()
HandleCreateSuccessfully(t, CreateOutput)
- template := new(Template)
+ template := new(stacks.Template)
template.Bin = []byte(`
{
"heat_template_version": "2013-05-23",
@@ -25,13 +26,13 @@
}
}
}`)
- createOpts := CreateOpts{
+ createOpts := stacks.CreateOpts{
Name: "stackcreated",
Timeout: 60,
TemplateOpts: template,
DisableRollback: gophercloud.Disabled,
}
- actual, err := Create(fake.ServiceClient(), createOpts).Extract()
+ actual, err := stacks.Create(fake.ServiceClient(), createOpts).Extract()
th.AssertNoErr(t, err)
expected := CreateExpected
@@ -42,7 +43,7 @@
th.SetupHTTP()
defer th.TeardownHTTP()
HandleCreateSuccessfully(t, CreateOutput)
- template := new(Template)
+ template := new(stacks.Template)
template.Bin = []byte(`
{
"stack_name": "postman_stack",
@@ -70,14 +71,14 @@
}
}
}`)
- adoptOpts := AdoptOpts{
+ adoptOpts := stacks.AdoptOpts{
AdoptStackData: `{environment{parameters{}}}`,
Name: "stackcreated",
Timeout: 60,
TemplateOpts: template,
DisableRollback: gophercloud.Disabled,
}
- actual, err := Adopt(fake.ServiceClient(), adoptOpts).Extract()
+ actual, err := stacks.Adopt(fake.ServiceClient(), adoptOpts).Extract()
th.AssertNoErr(t, err)
expected := CreateExpected
@@ -90,9 +91,9 @@
HandleListSuccessfully(t, FullListOutput)
count := 0
- err := List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
+ err := stacks.List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
count++
- actual, err := ExtractStacks(page)
+ actual, err := stacks.ExtractStacks(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, ListExpected, actual)
@@ -108,7 +109,7 @@
defer th.TeardownHTTP()
HandleGetSuccessfully(t, GetOutput)
- actual, err := Get(fake.ServiceClient(), "postman_stack", "16ef0584-4458-41eb-87c8-0dc8d5f66c87").Extract()
+ actual, err := stacks.Get(fake.ServiceClient(), "postman_stack", "16ef0584-4458-41eb-87c8-0dc8d5f66c87").Extract()
th.AssertNoErr(t, err)
expected := GetExpected
@@ -120,7 +121,7 @@
defer th.TeardownHTTP()
HandleUpdateSuccessfully(t)
- template := new(Template)
+ template := new(stacks.Template)
template.Bin = []byte(`
{
"heat_template_version": "2013-05-23",
@@ -132,10 +133,10 @@
}
}
}`)
- updateOpts := UpdateOpts{
+ updateOpts := stacks.UpdateOpts{
TemplateOpts: template,
}
- err := Update(fake.ServiceClient(), "gophercloud-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada", updateOpts).ExtractErr()
+ err := stacks.Update(fake.ServiceClient(), "gophercloud-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada", updateOpts).ExtractErr()
th.AssertNoErr(t, err)
}
@@ -144,7 +145,7 @@
defer th.TeardownHTTP()
HandleDeleteSuccessfully(t)
- err := Delete(fake.ServiceClient(), "gophercloud-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada").ExtractErr()
+ err := stacks.Delete(fake.ServiceClient(), "gophercloud-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada").ExtractErr()
th.AssertNoErr(t, err)
}
@@ -153,7 +154,7 @@
defer th.TeardownHTTP()
HandlePreviewSuccessfully(t, GetOutput)
- template := new(Template)
+ template := new(stacks.Template)
template.Bin = []byte(`
{
"heat_template_version": "2013-05-23",
@@ -165,13 +166,13 @@
}
}
}`)
- previewOpts := PreviewOpts{
+ previewOpts := stacks.PreviewOpts{
Name: "stackcreated",
Timeout: 60,
TemplateOpts: template,
DisableRollback: gophercloud.Disabled,
}
- actual, err := Preview(fake.ServiceClient(), previewOpts).Extract()
+ actual, err := stacks.Preview(fake.ServiceClient(), previewOpts).Extract()
th.AssertNoErr(t, err)
expected := PreviewExpected
@@ -183,7 +184,7 @@
defer th.TeardownHTTP()
HandleAbandonSuccessfully(t, AbandonOutput)
- actual, err := Abandon(fake.ServiceClient(), "postman_stack", "16ef0584-4458-41eb-87c8-0dc8d5f66c8").Extract()
+ actual, err := stacks.Abandon(fake.ServiceClient(), "postman_stack", "16ef0584-4458-41eb-87c8-0dc8d5f66c8").Extract()
th.AssertNoErr(t, err)
expected := AbandonExpected