Skip to content

Commit 8cc924c

Browse files
authored
Merge pull request #2005 from andyzhangx/cleanup-go-autorest
cleanup: remove unused getCloudEnvironment func
2 parents 2c52756 + 6495c08 commit 8cc924c

File tree

3 files changed

+1
-52
lines changed

3 files changed

+1
-52
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ require (
1414
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.0
1515
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.3.1
1616
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2
17-
github.com/Azure/go-autorest/autorest v0.11.30
1817
github.com/container-storage-interface/spec v1.11.0
1918
github.com/go-ini/ini v1.67.0
2019
github.com/golang/protobuf v1.5.4
@@ -59,6 +58,7 @@ require (
5958
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.3.0 // indirect
6059
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.1.1 // indirect
6160
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
61+
github.com/Azure/go-autorest/autorest v0.11.30 // indirect
6262
github.com/Azure/go-autorest/autorest/adal v0.9.24 // indirect
6363
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
6464
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect

pkg/blob/azure.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
2626
network "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
2727
"github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets"
28-
azure2 "github.com/Azure/go-autorest/autorest/azure"
2928
"golang.org/x/net/context"
3029
"k8s.io/apimachinery/pkg/util/wait"
3130
"k8s.io/client-go/kubernetes"
@@ -280,21 +279,6 @@ func (d *Driver) getStorageEndPointSuffix() string {
280279
return d.cloud.Environment.StorageEndpointSuffix
281280
}
282281

283-
func (d *Driver) getCloudEnvironment() azure2.Environment {
284-
if d.cloud == nil || d.cloud.Environment == nil {
285-
return azure2.PublicCloud
286-
}
287-
return azure2.Environment{
288-
Name: d.cloud.Environment.Name,
289-
ServiceManagementEndpoint: d.cloud.Environment.ServiceManagementEndpoint,
290-
ResourceManagerEndpoint: d.cloud.Environment.ResourceManagerEndpoint,
291-
ActiveDirectoryEndpoint: d.cloud.Environment.ActiveDirectoryEndpoint,
292-
StorageEndpointSuffix: d.cloud.Environment.StorageEndpointSuffix,
293-
ContainerRegistryDNSSuffix: d.cloud.Environment.ContainerRegistryDNSSuffix,
294-
TokenAudience: d.cloud.Environment.TokenAudience,
295-
}
296-
}
297-
298282
// getBackOff returns a backoff object based on the config
299283
func getBackOff(config azureconfig.Config) wait.Backoff {
300284
steps := config.CloudProviderBackoffRetries

pkg/blob/azure_test.go

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"time"
2929

3030
network "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
31-
"github.com/Azure/go-autorest/autorest/azure"
3231
"github.com/stretchr/testify/assert"
3332
"go.uber.org/mock/gomock"
3433
"k8s.io/apimachinery/pkg/util/wait"
@@ -420,40 +419,6 @@ func TestGetStorageEndPointSuffix(t *testing.T) {
420419
}
421420
}
422421

423-
func TestGetCloudEnvironment(t *testing.T) {
424-
d := NewFakeDriver()
425-
426-
ctrl := gomock.NewController(t)
427-
defer ctrl.Finish()
428-
429-
tests := []struct {
430-
name string
431-
cloud *storage.AccountRepo
432-
expectedEnv azure.Environment
433-
}{
434-
{
435-
name: "nil cloud",
436-
cloud: nil,
437-
expectedEnv: azure.PublicCloud,
438-
},
439-
{
440-
name: "cloud with environment",
441-
cloud: &storage.AccountRepo{
442-
Environment: &azclient.Environment{
443-
Name: "AzureChinaCloud",
444-
},
445-
},
446-
expectedEnv: azure.ChinaCloud,
447-
},
448-
}
449-
450-
for _, test := range tests {
451-
d.cloud = test.cloud
452-
env := d.getCloudEnvironment()
453-
assert.Equal(t, test.expectedEnv.Name, env.Name, test.name)
454-
}
455-
}
456-
457422
func TestGetBackOff(t *testing.T) {
458423
tests := []struct {
459424
desc string

0 commit comments

Comments
 (0)