@@ -28,6 +28,7 @@ import (
28
28
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29
29
"sigs.k8s.io/cloud-provider-azure/pkg/azureclients/storageaccountclient/mockstorageaccountclient"
30
30
"sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmclient/mockvmclient"
31
+ providerazureconsts "sigs.k8s.io/cloud-provider-azure/pkg/consts"
31
32
"sigs.k8s.io/cloud-provider-azure/pkg/retry"
32
33
33
34
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-08-01/compute"
@@ -156,13 +157,13 @@ func TestDeleteOutdatedDeployments(t *testing.T) {
156
157
157
158
for _ , test := range testCases {
158
159
testAS := newTestAgentPool (newTestAzureManager (t ), "testAS" )
159
- testAS .manager .azClient .deploymentsClient = & DeploymentsClientMock {
160
+ testAS .manager .azClient .deploymentClient = & DeploymentClientMock {
160
161
FakeStore : test .deployments ,
161
162
}
162
163
163
164
err := testAS .deleteOutdatedDeployments ()
164
165
assert .Equal (t , test .expectedErr , err , test .desc )
165
- existedDeployments , err := testAS .manager .azClient .deploymentsClient .List (context .Background (), "" , "" , to . Int32Ptr ( 0 ) )
166
+ existedDeployments , _ := testAS .manager .azClient .deploymentClient .List (context .Background (), "" )
166
167
existedDeploymentsNames := make (map [string ]bool )
167
168
for _ , deployment := range existedDeployments {
168
169
existedDeploymentsNames [* deployment .Name ] = true
@@ -185,7 +186,7 @@ func TestGetVMsFromCache(t *testing.T) {
185
186
mockVMClient := mockvmclient .NewMockInterface (ctrl )
186
187
testAS .manager .azClient .virtualMachinesClient = mockVMClient
187
188
mockVMClient .EXPECT ().List (gomock .Any (), testAS .manager .config .ResourceGroup ).Return (expectedVMs , nil )
188
- testAS .manager .config .VMType = vmTypeStandard
189
+ testAS .manager .config .VMType = providerazureconsts . VMTypeStandard
189
190
ac , err := newAzureCache (testAS .manager .azClient , refreshInterval , * testAS .manager .config )
190
191
assert .NoError (t , err )
191
192
testAS .manager .azureCache = ac
@@ -204,7 +205,7 @@ func TestGetVMIndexes(t *testing.T) {
204
205
mockVMClient := mockvmclient .NewMockInterface (ctrl )
205
206
as .manager .azClient .virtualMachinesClient = mockVMClient
206
207
mockVMClient .EXPECT ().List (gomock .Any (), as .manager .config .ResourceGroup ).Return (expectedVMs , nil )
207
- as .manager .config .VMType = vmTypeStandard
208
+ as .manager .config .VMType = providerazureconsts . VMTypeStandard
208
209
ac , err := newAzureCache (as .manager .azClient , refreshInterval , * as .manager .config )
209
210
assert .NoError (t , err )
210
211
as .manager .azureCache = ac
@@ -244,7 +245,7 @@ func TestGetCurSize(t *testing.T) {
244
245
mockVMClient := mockvmclient .NewMockInterface (ctrl )
245
246
as .manager .azClient .virtualMachinesClient = mockVMClient
246
247
mockVMClient .EXPECT ().List (gomock .Any (), as .manager .config .ResourceGroup ).Return (expectedVMs , nil )
247
- as .manager .config .VMType = vmTypeStandard
248
+ as .manager .config .VMType = providerazureconsts . VMTypeStandard
248
249
ac , err := newAzureCache (as .manager .azClient , refreshInterval , * as .manager .config )
249
250
assert .NoError (t , err )
250
251
as .manager .azureCache = ac
@@ -269,7 +270,7 @@ func TestAgentPoolTargetSize(t *testing.T) {
269
270
as .manager .azClient .virtualMachinesClient = mockVMClient
270
271
expectedVMs := getExpectedVMs ()
271
272
mockVMClient .EXPECT ().List (gomock .Any (), as .manager .config .ResourceGroup ).Return (expectedVMs , nil )
272
- as .manager .config .VMType = vmTypeStandard
273
+ as .manager .config .VMType = providerazureconsts . VMTypeStandard
273
274
ac , err := newAzureCache (as .manager .azClient , refreshInterval , * as .manager .config )
274
275
assert .NoError (t , err )
275
276
as .manager .azureCache = ac
@@ -289,7 +290,7 @@ func TestAgentPoolIncreaseSize(t *testing.T) {
289
290
as .manager .azClient .virtualMachinesClient = mockVMClient
290
291
expectedVMs := getExpectedVMs ()
291
292
mockVMClient .EXPECT ().List (gomock .Any (), as .manager .config .ResourceGroup ).Return (expectedVMs , nil ).MaxTimes (2 )
292
- as .manager .config .VMType = vmTypeStandard
293
+ as .manager .config .VMType = providerazureconsts . VMTypeStandard
293
294
ac , err := newAzureCache (as .manager .azClient , refreshInterval , * as .manager .config )
294
295
assert .NoError (t , err )
295
296
as .manager .azureCache = ac
@@ -318,7 +319,7 @@ func TestDecreaseTargetSize(t *testing.T) {
318
319
as .manager .azClient .virtualMachinesClient = mockVMClient
319
320
expectedVMs := getExpectedVMs ()
320
321
mockVMClient .EXPECT ().List (gomock .Any (), as .manager .config .ResourceGroup ).Return (expectedVMs , nil ).MaxTimes (3 )
321
- as .manager .config .VMType = vmTypeStandard
322
+ as .manager .config .VMType = providerazureconsts . VMTypeStandard
322
323
ac , err := newAzureCache (as .manager .azClient , refreshInterval , * as .manager .config )
323
324
assert .NoError (t , err )
324
325
as .manager .azureCache = ac
@@ -437,9 +438,9 @@ func TestAgentPoolDeleteNodes(t *testing.T) {
437
438
mockSAClient := mockstorageaccountclient .NewMockInterface (ctrl )
438
439
as .manager .azClient .storageAccountsClient = mockSAClient
439
440
mockVMClient .EXPECT ().List (gomock .Any (), as .manager .config .ResourceGroup ).Return (expectedVMs , nil )
440
- as .manager .config .VMType = vmTypeStandard
441
+ as .manager .config .VMType = providerazureconsts . VMTypeStandard
441
442
ac , err := newAzureCache (as .manager .azClient , refreshInterval , * as .manager .config )
442
- as .manager .config .VMType = vmTypeVMSS
443
+ as .manager .config .VMType = providerazureconsts . VMTypeVMSS
443
444
assert .NoError (t , err )
444
445
as .manager .azureCache = ac
445
446
@@ -505,7 +506,7 @@ func TestAgentPoolNodes(t *testing.T) {
505
506
mockVMClient := mockvmclient .NewMockInterface (ctrl )
506
507
as .manager .azClient .virtualMachinesClient = mockVMClient
507
508
mockVMClient .EXPECT ().List (gomock .Any (), as .manager .config .ResourceGroup ).Return (expectedVMs , nil )
508
- as .manager .config .VMType = vmTypeStandard
509
+ as .manager .config .VMType = providerazureconsts . VMTypeStandard
509
510
ac , err := newAzureCache (as .manager .azClient , refreshInterval , * as .manager .config )
510
511
assert .NoError (t , err )
511
512
as .manager .azureCache = ac
0 commit comments