Skip to content

Commit 955c2f5

Browse files
authored
Merge pull request #652 from jtopjian/dbv1-config-acc-test
DBv1: configurations acceptance test
2 parents 578e2aa + ed46896 commit 955c2f5

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// +build acceptance db
2+
3+
package v1
4+
5+
import (
6+
"testing"
7+
8+
"github.com/gophercloud/gophercloud/acceptance/clients"
9+
"github.com/gophercloud/gophercloud/acceptance/tools"
10+
"github.com/gophercloud/gophercloud/openstack/db/v1/configurations"
11+
)
12+
13+
func TestConfigurationsCRUD(t *testing.T) {
14+
client, err := clients.NewDBV1Client()
15+
if err != nil {
16+
t.Fatalf("Unable to create a DB client: %v", err)
17+
}
18+
19+
choices, err := clients.AcceptanceTestChoicesFromEnv()
20+
if err != nil {
21+
t.Fatalf("Unable to get environment settings")
22+
}
23+
24+
createOpts := &configurations.CreateOpts{
25+
Name: "test",
26+
Description: "description",
27+
}
28+
29+
datastore := configurations.DatastoreOpts{
30+
Type: choices.DBDatastoreType,
31+
Version: choices.DBDatastoreVersion,
32+
}
33+
createOpts.Datastore = &datastore
34+
35+
values := make(map[string]interface{})
36+
values["collation_server"] = "latin1_swedish_ci"
37+
createOpts.Values = values
38+
39+
cgroup, err := configurations.Create(client, createOpts).Extract()
40+
if err != nil {
41+
t.Fatalf("Unable to create configuration: %v", err)
42+
}
43+
44+
err = configurations.Delete(client, cgroup.ID).ExtractErr()
45+
if err != nil {
46+
t.Fatalf("Unable to delete configuration: %v", err)
47+
}
48+
49+
tools.PrintResource(t, cgroup)
50+
}

0 commit comments

Comments
 (0)