Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 3c3c784

Browse files
author
Jamie Hannaford
committed
changes to acceptance tests
1 parent 1b2f8cb commit 3c3c784

File tree

4 files changed

+16
-26
lines changed

4 files changed

+16
-26
lines changed

acceptance/openstack/db/v1/database_test.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,20 @@
33
package v1
44

55
import (
6-
"github.com/rackspace/gophercloud/acceptance/tools"
76
db "github.com/rackspace/gophercloud/openstack/db/v1/databases"
87
"github.com/rackspace/gophercloud/pagination"
98
)
109

1110
func (c context) createDBs() {
12-
dbs := []string{
13-
tools.RandomString("db_", 5),
14-
tools.RandomString("db_", 5),
15-
tools.RandomString("db_", 5),
16-
}
17-
1811
opts := db.BatchCreateOpts{
19-
db.CreateOpts{Name: dbs[0]},
20-
db.CreateOpts{Name: dbs[1]},
21-
db.CreateOpts{Name: dbs[2]},
12+
db.CreateOpts{Name: "db1"},
13+
db.CreateOpts{Name: "db2"},
14+
db.CreateOpts{Name: "db3"},
2215
}
2316

2417
err := db.Create(c.client, c.instanceID, opts).ExtractErr()
2518
c.AssertNoErr(err)
26-
c.Logf("Created three databases on instance %s: %s, %s, %s", c.instanceID, dbs[0], dbs[1], dbs[2])
27-
c.DBIDs = dbs
19+
c.Logf("Created three databases on instance %s: db1, db2, db3", c.instanceID)
2820
}
2921

3022
func (c context) listDBs() {
@@ -45,7 +37,7 @@ func (c context) listDBs() {
4537
}
4638

4739
func (c context) deleteDBs() {
48-
for _, id := range c.DBIDs {
40+
for _, id := range []string{"db1", "db2", "db3"} {
4941
err := db.Delete(c.client, c.instanceID, id).ExtractErr()
5042
c.AssertNoErr(err)
5143
c.Logf("Deleted DB %s", id)

acceptance/openstack/db/v1/instance_test.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@ func TestRunner(t *testing.T) {
2222
c.getFlavor()
2323

2424
// INSTANCE tests
25-
//c.createInstance()
26-
c.instanceID = "dbf901f4-fe23-48b7-8c1d-ee60ec85a660"
27-
25+
c.createInstance()
2826
c.listInstances()
2927
c.getInstance()
3028
c.isRootEnabled()
3129
c.enableRootUser()
3230
c.isRootEnabled()
3331
c.restartInstance()
34-
c.resizeInstance()
35-
c.resizeVol()
32+
//c.resizeInstance()
33+
//c.resizeVol()
3634

3735
// DATABASE tests
3836
c.createDBs()
@@ -54,8 +52,8 @@ func (c context) createInstance() {
5452
}
5553

5654
opts := instances.CreateOpts{
57-
FlavorRef: "1",
58-
Size: 1,
55+
FlavorRef: "2",
56+
Size: 5,
5957
Name: tools.RandomString("gopher_db", 5),
6058
Datastore: &instances.DatastoreOpts{Type: os.Getenv(envDSType)},
6159
}
@@ -123,7 +121,7 @@ func (c context) restartInstance() {
123121

124122
func (c context) resizeInstance() {
125123
id := c.instanceID
126-
err := instances.ResizeInstance(c.client, id, "2").ExtractErr()
124+
err := instances.ResizeInstance(c.client, id, "3").ExtractErr()
127125
c.AssertNoErr(err)
128126
c.Logf("Resizing %s. Waiting...", id)
129127
c.WaitUntilActive(id)
@@ -132,7 +130,7 @@ func (c context) resizeInstance() {
132130

133131
func (c context) resizeVol() {
134132
id := c.instanceID
135-
err := instances.ResizeVolume(c.client, id, 2).ExtractErr()
133+
err := instances.ResizeVolume(c.client, id, 4).ExtractErr()
136134
c.AssertNoErr(err)
137135
c.Logf("Resizing volume of %s. Waiting...", id)
138136
c.WaitUntilActive(id)

acceptance/openstack/db/v1/user_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ func (c context) createUsers() {
1616
tools.RandomString("user_", 5),
1717
}
1818

19-
db1 := db.CreateOpts{Name: c.DBIDs[0]}
20-
db2 := db.CreateOpts{Name: c.DBIDs[1]}
21-
db3 := db.CreateOpts{Name: c.DBIDs[2]}
19+
db1 := db.CreateOpts{Name: "db1"}
20+
db2 := db.CreateOpts{Name: "db2"}
21+
db3 := db.CreateOpts{Name: "db3"}
2222

2323
opts := u.BatchCreateOpts{
2424
u.CreateOpts{

acceptance/rackspace/db/v1/instance_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (c *context) createInstance() {
9696
func (c *context) listInstances() {
9797
c.Logf("Listing instances")
9898

99-
err := instances.List(c.client).EachPage(func(page pagination.Page) (bool, error) {
99+
err := instances.List(c.client, nil).EachPage(func(page pagination.Page) (bool, error) {
100100
instanceList, err := instances.ExtractInstances(page)
101101
c.AssertNoErr(err)
102102

0 commit comments

Comments
 (0)