Merge pull request #1069 from cloudskiff/fix_azure_hide_errors

Fix azure may hide some errors
main
Elie 2021-09-17 13:27:12 +02:00 committed by GitHub
commit a71b5a349e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -63,6 +63,10 @@ func (s *storageRepository) ListAllStorageAccount() ([]*armstorage.StorageAccoun
results = append(results, resp.StorageAccountListResult.Value...)
}
if err := pager.Err(); err != nil {
return nil, err
}
s.cache.Put("ListAllStorageAccount", results)
return results, nil
@ -92,6 +96,10 @@ func (s *storageRepository) ListAllStorageContainer(account *armstorage.StorageA
}
}
if err := pager.Err(); err != nil {
return nil, err
}
s.cache.Put(cacheKey, results)
return results, nil

View File

@ -50,7 +50,7 @@ func Test_ListAllStorageAccount_MultiplesResults(t *testing.T) {
fakeClient := &mockStorageAccountClient{}
mockPager := &azure.MockStorageAccountPager{}
mockPager.On("Err").Return(nil).Times(2)
mockPager.On("Err").Return(nil).Times(3)
mockPager.On("NextPage", mock.Anything).Return(true).Times(2)
mockPager.On("NextPage", mock.Anything).Return(false).Times(1)
mockPager.On("PageResponse").Return(armstorage.StorageAccountListResultResponse{
@ -207,7 +207,7 @@ func Test_ListAllStorageContainer_MultiplesResults(t *testing.T) {
fakeClient := &mockBlobContainerClient{}
mockPager := &azure.MockListContainerItemPager{}
mockPager.On("Err").Return(nil).Times(2)
mockPager.On("Err").Return(nil).Times(3)
mockPager.On("NextPage", mock.Anything).Return(true).Times(2)
mockPager.On("NextPage", mock.Anything).Return(false).Times(1)
mockPager.On("PageResponse").Return(armstorage.ListContainerItemsResponse{