ehdou | c2b8dcd | 2017-01-11 06:01:00 +0200 | [diff] [blame^] | 1 | package v2 |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/gophercloud/gophercloud/acceptance/clients" |
| 7 | "github.com/gophercloud/gophercloud/openstack/sharedfilesystems/v2/availabilityzones" |
| 8 | ) |
| 9 | |
| 10 | func TestAvailabilityZonesList(t *testing.T) { |
| 11 | client, err := clients.NewSharedFileSystemV2Client() |
| 12 | if err != nil { |
| 13 | t.Fatalf("Unable to create shared file system client: %v", err) |
| 14 | } |
| 15 | |
| 16 | allPages, err := availabilityzones.List(client).AllPages() |
| 17 | if err != nil { |
| 18 | t.Fatalf("Unable to list availability zones: %v", err) |
| 19 | } |
| 20 | |
| 21 | zones, err := availabilityzones.ExtractAvailabilityZones(allPages) |
| 22 | if err != nil { |
| 23 | t.Fatalf("Unable to extract availability zones: %v", err) |
| 24 | } |
| 25 | |
| 26 | if len(zones) == 0 { |
| 27 | t.Fatal("At least one availability zone was expected to be found") |
| 28 | } |
| 29 | } |