update unit and acceptance tests
diff --git a/openstack/blockstorage/v1/snapshots/requests.go b/openstack/blockstorage/v1/snapshots/requests.go
index f823b3d..7dcbc46 100644
--- a/openstack/blockstorage/v1/snapshots/requests.go
+++ b/openstack/blockstorage/v1/snapshots/requests.go
@@ -49,13 +49,12 @@
return res
}
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var res DeleteResult
- _, res.Err = perigee.Request("DELETE", deleteURL(client, id), perigee.Options{
+func Delete(client *gophercloud.ServiceClient, id string) error {
+ _, err := perigee.Request("DELETE", deleteURL(client, id), perigee.Options{
MoreHeaders: client.Provider.AuthenticatedHeaders(),
- OkCodes: []int{204},
+ OkCodes: []int{202, 204},
})
- return res
+ return err
}
func Get(client *gophercloud.ServiceClient, id string) GetResult {
@@ -116,7 +115,7 @@
_, res.Err = perigee.Request("PUT", updateURL(client, id), perigee.Options{
MoreHeaders: client.Provider.AuthenticatedHeaders(),
- OkCodes: []int{200},
+ OkCodes: []int{202, 204},
ReqBody: &reqBody,
Results: &res.Resp,
})
diff --git a/openstack/blockstorage/v1/snapshots/requests_test.go b/openstack/blockstorage/v1/snapshots/requests_test.go
index dae53fd..4050990 100644
--- a/openstack/blockstorage/v1/snapshots/requests_test.go
+++ b/openstack/blockstorage/v1/snapshots/requests_test.go
@@ -155,6 +155,6 @@
w.WriteHeader(http.StatusNoContent)
})
- res := Delete(ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22")
- th.AssertNoErr(t, res.Err)
+ err := Delete(ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22")
+ th.AssertNoErr(t, err)
}
diff --git a/openstack/blockstorage/v1/snapshots/results.go b/openstack/blockstorage/v1/snapshots/results.go
index cc3a419..363d6e2 100644
--- a/openstack/blockstorage/v1/snapshots/results.go
+++ b/openstack/blockstorage/v1/snapshots/results.go
@@ -80,5 +80,3 @@
type UpdateResult struct {
commonResult
}
-
-type DeleteResult commonResult
diff --git a/openstack/blockstorage/v1/volumes/requests.go b/openstack/blockstorage/v1/volumes/requests.go
index 2a4ce91..7704012 100644
--- a/openstack/blockstorage/v1/volumes/requests.go
+++ b/openstack/blockstorage/v1/volumes/requests.go
@@ -60,7 +60,7 @@
// ListOpts holds options for listing volumes. It is passed to the volumes.List function.
type ListOpts struct {
- // AllTenants is an admin-only option. Set it to true to see a tenant volumes.
+ // AllTenants is an admin-only option. Set it to true to see all tenant volumes.
AllTenants bool
// List only volumes that contain Metadata.
Metadata map[string]string
@@ -123,11 +123,10 @@
}
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var res DeleteResult
- _, res.Err = perigee.Request("DELETE", deleteURL(client, id), perigee.Options{
+func Delete(client *gophercloud.ServiceClient, id string) error {
+ _, err := perigee.Request("DELETE", deleteURL(client, id), perigee.Options{
MoreHeaders: client.Provider.AuthenticatedHeaders(),
- OkCodes: []int{204},
+ OkCodes: []int{202, 204},
})
- return res
+ return err
}
diff --git a/openstack/blockstorage/v1/volumes/requests_test.go b/openstack/blockstorage/v1/volumes/requests_test.go
index 2ae8dd3..54ff91d 100644
--- a/openstack/blockstorage/v1/volumes/requests_test.go
+++ b/openstack/blockstorage/v1/volumes/requests_test.go
@@ -155,6 +155,6 @@
w.WriteHeader(http.StatusNoContent)
})
- res := Delete(ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22")
- th.AssertNoErr(t, res.Err)
+ err := Delete(ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22")
+ th.AssertNoErr(t, err)
}
diff --git a/openstack/blockstorage/v1/volumes/results.go b/openstack/blockstorage/v1/volumes/results.go
index 961582d..7bf83a5 100644
--- a/openstack/blockstorage/v1/volumes/results.go
+++ b/openstack/blockstorage/v1/volumes/results.go
@@ -80,5 +80,3 @@
type UpdateResult struct {
commonResult
}
-
-type DeleteResult commonResult
diff --git a/openstack/blockstorage/v1/volumetypes/requests.go b/openstack/blockstorage/v1/volumetypes/requests.go
index 678d331..466d043 100644
--- a/openstack/blockstorage/v1/volumetypes/requests.go
+++ b/openstack/blockstorage/v1/volumetypes/requests.go
@@ -12,7 +12,7 @@
Name string
}
-func Create(client *gophercloud.ServiceClient, opts CreateOpts) CreateResult {
+func Create(client *gophercloud.ServiceClient, opts *CreateOpts) CreateResult {
type volumeType struct {
ExtraSpecs map[string]interface{} `json:"extra_specs,omitempty"`
Name *string `json:"name,omitempty"`
@@ -39,19 +39,17 @@
return res
}
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var res DeleteResult
+func Delete(client *gophercloud.ServiceClient, id string) error {
_, err := perigee.Request("DELETE", deleteURL(client, id), perigee.Options{
MoreHeaders: client.Provider.AuthenticatedHeaders(),
OkCodes: []int{202},
})
- res.Err = err
- return res
+ return err
}
func Get(client *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- resp, err := perigee.Request("GET", getURL(client, id), perigee.Options{
+ _, err := perigee.Request("GET", getURL(client, id), perigee.Options{
MoreHeaders: client.Provider.AuthenticatedHeaders(),
OkCodes: []int{200},
Results: &res.Resp,
diff --git a/openstack/blockstorage/v1/volumetypes/requests_test.go b/openstack/blockstorage/v1/volumetypes/requests_test.go
index 79f919a..a9c6512 100644
--- a/openstack/blockstorage/v1/volumetypes/requests_test.go
+++ b/openstack/blockstorage/v1/volumetypes/requests_test.go
@@ -149,7 +149,7 @@
`)
})
- options := CreateOpts{Name: "vol-type-001"}
+ options := &CreateOpts{Name: "vol-type-001"}
n, err := Create(ServiceClient(), options).Extract()
th.AssertNoErr(t, err)
@@ -167,6 +167,6 @@
w.WriteHeader(http.StatusAccepted)
})
- res := Delete(ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22")
- th.AssertNoErr(t, res.Err)
+ err := Delete(ServiceClient(), "d32019d3-bc6e-4319-9c1d-6722fc136a22")
+ th.AssertNoErr(t, err)
}
diff --git a/openstack/blockstorage/v1/volumetypes/results.go b/openstack/blockstorage/v1/volumetypes/results.go
index 54847be..fa10ae7 100644
--- a/openstack/blockstorage/v1/volumetypes/results.go
+++ b/openstack/blockstorage/v1/volumetypes/results.go
@@ -66,5 +66,3 @@
type CreateResult struct {
commonResult
}
-
-type DeleteResult commonResult