Skip to content

Commit

Permalink
Merge pull request #467 from JesusAlvarezTorres/azs-disk-client
Browse files Browse the repository at this point in the history
feat: disk client changes for Azure Stack Hub support
  • Loading branch information
andyzhangx committed Jan 23, 2021
2 parents a06fd06 + 083cf6d commit 992f486
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/azureclients/diskclient/azure_diskclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var _ Interface = &Client{}
type Client struct {
armClient armclient.Interface
subscriptionID string
cloudName string

// Rate limiting configures.
rateLimiterReader flowcontrol.RateLimiter
Expand Down Expand Up @@ -76,6 +77,7 @@ func New(config *azclients.ClientConfig) *Client {
rateLimiterReader: rateLimiterReader,
rateLimiterWriter: rateLimiterWriter,
subscriptionID: config.SubscriptionID,
cloudName: config.CloudName,
}

return client
Expand Down
21 changes: 21 additions & 0 deletions pkg/azureclients/diskclient/azure_diskclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@ func TestNew(t *testing.T) {
assert.NotEmpty(t, diskClient.rateLimiterWriter)
}

func TestNewAzureStack(t *testing.T) {
config := &azclients.ClientConfig{
CloudName: "AZURESTACKCLOUD",
SubscriptionID: "sub",
ResourceManagerEndpoint: "endpoint",
Location: "eastus",
RateLimitConfig: &azclients.RateLimitConfig{
CloudProviderRateLimit: true,
CloudProviderRateLimitQPS: 0.5,
CloudProviderRateLimitBucket: 1,
CloudProviderRateLimitQPSWrite: 0.5,
CloudProviderRateLimitBucketWrite: 1,
},
Backoff: &retry.Backoff{Steps: 1},
}

diskClient := New(config)
assert.Equal(t, "AZURESTACKCLOUD", diskClient.cloudName)
assert.Equal(t, "sub", diskClient.subscriptionID)
}

func TestGetNotFound(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand Down

0 comments on commit 992f486

Please sign in to comment.