Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,11 @@ async Task<IEnumerable<T>> IAsyncConverter<MultiBlobContext, IEnumerable<T>>.Con
// sub directories.
string prefix = context.Prefix;
var container = context.Container;
IAsyncEnumerable<BlobItem> blobItems = container.GetBlobsAsync(prefix: prefix, cancellationToken: cancellationToken);
IAsyncEnumerable<BlobItem> blobItems = container.GetBlobsAsync(
traits: BlobTraits.None,
states: BlobStates.None,
prefix: prefix,
cancellationToken: cancellationToken);

// create an IEnumerable<T> of the correct type, performing any required conversions on the blobs
var list = await ConvertBlobs(blobItems, container).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ private static async Task GetLogsWithPrefixAsync(List<BlobBaseClient> selectedLo
{
// List the blobs using the prefix
BlobContainerClient container = blobClient.GetBlobContainerClient(LogContainer);
var blobs = container.GetBlobsAsync(traits: BlobTraits.Metadata, prefix: prefix, cancellationToken: cancellationToken).ConfigureAwait(false);
var blobs = container.GetBlobsAsync(
traits: BlobTraits.Metadata,
states: BlobStates.None,
prefix: prefix,
cancellationToken: cancellationToken).ConfigureAwait(false);

// iterate through each blob and figure the start and end times in the metadata
// Type cast to IStorageBlob is safe due to useFlatBlobListing: true above.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,11 @@ private void ScanContainers(object state)
{
// Non-async is correct here. ScanContainers occurs on a background thread. Unless it blocks, no one
// else is around to observe the results.
items = container.GetBlobs(prefix: null, cancellationToken: CancellationToken.None).ToList();
items = container.GetBlobs(
traits: BlobTraits.None,
states: BlobStates.None,
prefix: null,
cancellationToken: CancellationToken.None).ToList();
}
catch (RequestFailedException exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs" />
<PackageReference Include="Microsoft.Extensions.Azure" />
<PackageReference Include="Azure.Storage.Blobs" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\..\Azure.Storage.Blobs\src\Azure.Storage.Blobs.csproj" />
<!-- The PackageReference is commented out because Azure.Storage.Blobs is now included via ProjectReference above. -->
<!-- It is retained here until after the next release, and the dependency will be switched back to a PackageReference in the future. -->
<!-- <PackageReference Include="Azure.Storage.Blobs" /> -->
<PackageReference Include="Azure.Storage.Queues" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,31 @@ public void Setup()
{
return new TestAsyncPageable<BlobItem>(_blobItems);
});
_blobContainerMock.Setup(x => x.GetBlobsAsync(It.IsAny<GetBlobsOptions>(), It.IsAny<CancellationToken>()))
.Returns(() =>
{
return new TestAsyncPageable<BlobItem>(_blobItems);
});
_secondBlobContainerMock.Setup(x => x.GetBlobsAsync(It.IsAny<BlobTraits>(), It.IsAny<BlobStates>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
.Returns(() =>
{
return new TestAsyncPageable<BlobItem>(_secondBlobItems);
});
_secondBlobContainerMock.Setup(x => x.GetBlobsAsync(It.IsAny<GetBlobsOptions>(), It.IsAny<CancellationToken>()))
.Returns(() =>
{
return new TestAsyncPageable<BlobItem>(_secondBlobItems);
});
_logsContainerMock.Setup(x => x.GetBlobsAsync(It.IsAny<BlobTraits>(), It.IsAny<BlobStates>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
.Returns(() =>
{
return new TestAsyncPageable<BlobItem>(new List<BlobItem>());
});
_logsContainerMock.Setup(x => x.GetBlobsAsync(It.IsAny<GetBlobsOptions>(), It.IsAny<CancellationToken>()))
.Returns(() =>
{
return new TestAsyncPageable<BlobItem>(new List<BlobItem>());
});
}

[Test]
Expand Down Expand Up @@ -231,7 +246,7 @@ public void BlobPolling_IgnoresClockSkew()
// We should see the new item. We'll see 2 blobs, but only process 1 (due to receipt).
RunExecuterWithExpectedBlobs(expectedNames, product, executor, 1);

_blobContainerMock.Verify(x => x.GetBlobsAsync(It.IsAny<BlobTraits>(), It.IsAny<BlobStates>(), It.IsAny<string>(), It.IsAny<CancellationToken>()),
_blobContainerMock.Verify(x => x.GetBlobsAsync(It.IsAny<GetBlobsOptions>(), It.IsAny<CancellationToken>()),
Times.Exactly(2));
Assert.AreEqual(expectedNames, executor.BlobReceipts);
}
Expand Down Expand Up @@ -269,7 +284,7 @@ public void BlobPolling_IncludesPreviousBatch()
// We should see the new item. We'll see 2 blobs, but only process 1 (due to receipt).
RunExecuterWithExpectedBlobs(expectedNames, product, executor, 1);

_blobContainerMock.Verify(x => x.GetBlobsAsync(It.IsAny<BlobTraits>(), It.IsAny<BlobStates>(), It.IsAny<string>(), It.IsAny<CancellationToken>()),
_blobContainerMock.Verify(x => x.GetBlobsAsync(It.IsAny<GetBlobsOptions>(), It.IsAny<CancellationToken>()),
Times.Exactly(2));
Assert.AreEqual(expectedNames, executor.BlobReceipts);
}
Expand Down Expand Up @@ -391,7 +406,7 @@ public async Task ExecuteAsync_UpdatesScanInfo_WithEarliestFailure()
DateTime? storedTime = await testScanInfoManager.LoadLatestScanAsync(accountName, ContainerName);
Assert.True(storedTime < earliestErrorTime);
Assert.AreEqual(1, testScanInfoManager.UpdateCounts[accountName][ContainerName]);
_blobContainerMock.Verify(x => x.GetBlobsAsync(It.IsAny<BlobTraits>(), It.IsAny<BlobStates>(), It.IsAny<string>(), It.IsAny<CancellationToken>()),
_blobContainerMock.Verify(x => x.GetBlobsAsync(It.IsAny<GetBlobsOptions>(), It.IsAny<CancellationToken>()),
Times.Exactly(2));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core.TestFramework;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
using Azure.Storage.Blobs.Specialized;
using Azure.Storage.Queues;
using Azure.Storage.Queues.Models;
Expand Down Expand Up @@ -51,7 +53,11 @@ public async Task BlobToBlob_DifferentAccounts_PrimaryToSecondary_Succeeds()

await TestHelpers.Await(async () =>
{
var pageable = _fixture.OutputContainer2.GetBlobsAsync(prefix: "blob1");
var pageable = _fixture.OutputContainer2.GetBlobsAsync(
traits: BlobTraits.None,
states: BlobStates.None,
prefix: "blob1",
cancellationToken: CancellationToken.None);
var enumerator = pageable.GetAsyncEnumerator();
var result = await enumerator.MoveNextAsync() && enumerator.Current.Properties.ContentLength > 0;
if (result)
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/ci.functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pr:
- release/*
paths:
include:
- sdk/storage/ci.webjobs.yml
- sdk/storage/ci.functions.yml
- sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage/
- sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Blobs/
- sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/
Expand Down
Loading