Skip to content

Commit

Permalink
Make queryRegionToZones a provider method
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakan Memisoglu committed Sep 9, 2019
1 parent 9cdbbf7 commit 3404dc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/blockstorage/awsebs/awsebs.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,8 @@ func (s *ebsStorage) FromRegion(ctx context.Context, region string) ([]string, e
return staticRegionToZones(region)
}

func queryRegionToZones(ctx context.Context, region string) ([]string, error) {
ec2Cli, err := newEC2Client(region, nil, "")
func (s *ebsStorage) queryRegionToZones(ctx context.Context, region string) ([]string, error) {
ec2Cli, err := newEC2Client(region, nil, s.role)
if err != nil {
return nil, errors.Wrapf(err, "Could not get EC2 client")
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/blockstorage/awsebs/awsebs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ func (s AWSEBSSuite) TestQueryRegionToZones(c *C) {
c.Skip("Only works on AWS")
ctx := context.Background()
region := "us-east-1"
zs, err := queryRegionToZones(ctx, region)
ec2Cli, err := newEC2Client(region, nil, "")
c.Assert(err, IsNil)
provider := &ebsStorage{ec2Cli: ec2Cli}
zs, err := provider.queryRegionToZones(ctx, region)
c.Assert(err, IsNil)
c.Assert(zs, DeepEquals, []string{"us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d", "us-east-1e", "us-east-1f"})
}

0 comments on commit 3404dc1

Please sign in to comment.