blob: 56e10f4c65697eaa693293236ce27e11b1eea1b5 [file] [log] [blame]
jrperritt3d966162016-06-06 14:08:54 -05001package testing
Jamie Hannaforded7f4532015-02-17 14:56:30 +01002
Jamie Hannaforde65ad952015-11-16 14:05:11 +01003import (
4 "fmt"
5 "time"
jrperritt3d966162016-06-06 14:08:54 -05006
7 "github.com/gophercloud/gophercloud/openstack/db/v1/configurations"
Jamie Hannaforde65ad952015-11-16 14:05:11 +01008)
Jamie Hannaforded7f4532015-02-17 14:56:30 +01009
Jamie Hannaforde65ad952015-11-16 14:05:11 +010010var (
11 timestamp = "2015-11-12T14:22:42Z"
12 timeVal, _ = time.Parse(time.RFC3339, timestamp)
13)
14
15var singleConfigJSON = `
Jamie Hannaforded7f4532015-02-17 14:56:30 +010016{
Jamie Hannaforde65ad952015-11-16 14:05:11 +010017 "created": "` + timestamp + `",
Jamie Hannaforded7f4532015-02-17 14:56:30 +010018 "datastore_name": "mysql",
19 "datastore_version_id": "b00000b0-00b0-0b00-00b0-000b000000bb",
20 "datastore_version_name": "5.6",
21 "description": "example_description",
22 "id": "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
23 "name": "example-configuration-name",
Jamie Hannaforde65ad952015-11-16 14:05:11 +010024 "updated": "` + timestamp + `"
Jamie Hannaforded7f4532015-02-17 14:56:30 +010025}
26`
27
Jamie Hannaforde65ad952015-11-16 14:05:11 +010028var singleConfigWithValuesJSON = `
Jamie Hannaforded7f4532015-02-17 14:56:30 +010029{
Jamie Hannaforde65ad952015-11-16 14:05:11 +010030 "created": "` + timestamp + `",
Jamie Hannaforded7f4532015-02-17 14:56:30 +010031 "datastore_name": "mysql",
32 "datastore_version_id": "b00000b0-00b0-0b00-00b0-000b000000bb",
33 "datastore_version_name": "5.6",
34 "description": "example description",
35 "id": "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
36 "instance_count": 0,
37 "name": "example-configuration-name",
Jamie Hannaforde65ad952015-11-16 14:05:11 +010038 "updated": "` + timestamp + `",
Jamie Hannaforded7f4532015-02-17 14:56:30 +010039 "values": {
40 "collation_server": "latin1_swedish_ci",
41 "connect_timeout": 120
42 }
43}
44`
45
46var (
Jamie Hannafordd2b755f2015-10-07 14:01:57 +020047 ListConfigsJSON = fmt.Sprintf(`{"configurations": [%s]}`, singleConfigJSON)
48 GetConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigJSON)
49 CreateConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigWithValuesJSON)
Jamie Hannaforded7f4532015-02-17 14:56:30 +010050)
51
Jamie Hannafordd2b755f2015-10-07 14:01:57 +020052var CreateReq = `
Jamie Hannaforded7f4532015-02-17 14:56:30 +010053{
54 "configuration": {
55 "datastore": {
56 "type": "a00000a0-00a0-0a00-00a0-000a000000aa",
57 "version": "b00000b0-00b0-0b00-00b0-000b000000bb"
58 },
59 "description": "example description",
60 "name": "example-configuration-name",
61 "values": {
62 "collation_server": "latin1_swedish_ci",
63 "connect_timeout": 120
64 }
65 }
66}
67`
68
Jamie Hannafordd2b755f2015-10-07 14:01:57 +020069var UpdateReq = `
Jamie Hannaforded7f4532015-02-17 14:56:30 +010070{
71 "configuration": {
72 "values": {
73 "connect_timeout": 300
74 }
75 }
76}
77`
78
Jamie Hannafordd2b755f2015-10-07 14:01:57 +020079var ListInstancesJSON = `
Jamie Hannaforded7f4532015-02-17 14:56:30 +010080{
81 "instances": [
82 {
83 "id": "d4603f69-ec7e-4e9b-803f-600b9205576f",
84 "name": "json_rack_instance"
85 }
86 ]
87}
88`
89
Jamie Hannafordd2b755f2015-10-07 14:01:57 +020090var ListParamsJSON = `
Jamie Hannaford23867bb2015-02-17 15:56:48 +010091{
92 "configuration-parameters": [
93 {
94 "max": 1,
95 "min": 0,
96 "name": "innodb_file_per_table",
97 "restart_required": true,
98 "type": "integer"
99 },
100 {
101 "max": 4294967296,
102 "min": 0,
103 "name": "key_buffer_size",
104 "restart_required": false,
105 "type": "integer"
106 },
107 {
108 "max": 65535,
109 "min": 2,
110 "name": "connect_timeout",
111 "restart_required": false,
112 "type": "integer"
113 },
114 {
115 "max": 4294967296,
116 "min": 0,
117 "name": "join_buffer_size",
118 "restart_required": false,
119 "type": "integer"
120 }
121 ]
122}
123`
124
Jamie Hannafordd2b755f2015-10-07 14:01:57 +0200125var GetParamJSON = `
Jamie Hannaford23867bb2015-02-17 15:56:48 +0100126{
127 "max": 1,
128 "min": 0,
129 "name": "innodb_file_per_table",
130 "restart_required": true,
131 "type": "integer"
132}
133`
134
jrperritt3d966162016-06-06 14:08:54 -0500135var ExampleConfig = configurations.Config{
Jamie Hannaforde65ad952015-11-16 14:05:11 +0100136 Created: timeVal,
Jamie Hannaforded7f4532015-02-17 14:56:30 +0100137 DatastoreName: "mysql",
138 DatastoreVersionID: "b00000b0-00b0-0b00-00b0-000b000000bb",
139 DatastoreVersionName: "5.6",
140 Description: "example_description",
141 ID: "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
142 Name: "example-configuration-name",
Jamie Hannaforde65ad952015-11-16 14:05:11 +0100143 Updated: timeVal,
Jamie Hannaforded7f4532015-02-17 14:56:30 +0100144}
145
jrperritt3d966162016-06-06 14:08:54 -0500146var ExampleConfigWithValues = configurations.Config{
Jamie Hannaforde65ad952015-11-16 14:05:11 +0100147 Created: timeVal,
Jamie Hannaforded7f4532015-02-17 14:56:30 +0100148 DatastoreName: "mysql",
149 DatastoreVersionID: "b00000b0-00b0-0b00-00b0-000b000000bb",
150 DatastoreVersionName: "5.6",
151 Description: "example description",
152 ID: "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
153 Name: "example-configuration-name",
Jamie Hannaforde65ad952015-11-16 14:05:11 +0100154 Updated: timeVal,
Jamie Hannaforded7f4532015-02-17 14:56:30 +0100155 Values: map[string]interface{}{
156 "collation_server": "latin1_swedish_ci",
157 "connect_timeout": 120,
158 },
159}