File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
acceptance/openstack/blockstorage Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ // +build acceptance blockstorage
2+
3+ package blockstorage
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/blockstorage/apiversions"
11+ )
12+
13+ func TestAPIVersionsList (t * testing.T ) {
14+ client , err := clients .NewBlockStorageV2Client ()
15+ if err != nil {
16+ t .Fatalf ("Unable to create a blockstorage client: %v" , err )
17+ }
18+
19+ allPages , err := apiversions .List (client ).AllPages ()
20+ if err != nil {
21+ t .Fatalf ("Unable to retrieve API versions: %v" , err )
22+ }
23+
24+ allVersions , err := apiversions .ExtractAPIVersions (allPages )
25+ if err != nil {
26+ t .Fatalf ("Unable to extract API versions: %v" , err )
27+ }
28+
29+ for _ , v := range allVersions {
30+ tools .PrintResource (t , v )
31+ }
32+ }
33+
34+ func TestAPIVersionsGet (t * testing.T ) {
35+ client , err := clients .NewBlockStorageV2Client ()
36+ if err != nil {
37+ t .Fatalf ("Unable to create a blockstorage client: %v" , err )
38+ }
39+
40+ v , err := apiversions .Get (client , "v2" ).Extract ()
41+ if err != nil {
42+ t .Fatalf ("Unable to retrieve API version: %v" , err )
43+ }
44+
45+ tools .PrintResource (t , v )
46+ }
You can’t perform that action at this time.
0 commit comments