Skip to content

Commit e42cde8

Browse files
committed
Update Azure.Storage.Blobs
1 parent 462696f commit e42cde8

8 files changed

Lines changed: 56 additions & 22 deletions

File tree

.github/workflows/tests.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,18 @@ jobs:
3636
azure:
3737
name: "Test: AzureFileSystem"
3838
runs-on: ubuntu-latest
39-
services:
40-
azurite:
41-
image: mcr.microsoft.com/azure-storage/azurite
42-
ports:
43-
- 10000:10000
44-
- 10001:10001
45-
- 10002:10002
4639
steps:
40+
- name: Start Azurite
41+
run: |
42+
docker run -d \
43+
-p 10000:10000 \
44+
-p 10001:10001 \
45+
-p 10002:10002 \
46+
mcr.microsoft.com/azure-storage/azurite \
47+
azurite --skipApiVersionCheck \
48+
--blobHost 0.0.0.0 \
49+
--queueHost 0.0.0.0 \
50+
--tableHost 0.0.0.0
4751
- name: Setup .NET
4852
uses: actions/setup-dotnet@v4
4953
with:
@@ -58,7 +62,7 @@ jobs:
5862
- name: Build
5963
run: dotnet build -c Debug
6064
- name: Test
61-
run: dotnet test --no-build --filter TestCategory=Cloud:Azure
65+
run: dotnet test --no-build --filter TestCategory=Cloud:Azure -maxcpucount:1
6266

6367
s3:
6468
name: "Test: S3FileSystem"

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageVersion Include="Azure.Storage.Blobs" Version="12.21.2" />
8-
<PackageVersion Include="Azure.Storage.Blobs.Batch" Version="12.18.1" />
97
<PackageVersion Include="AWSSDK.S3" Version="4.0.18.6" />
8+
<PackageVersion Include="Azure.Storage.Blobs" Version="12.27.0" />
9+
<PackageVersion Include="Azure.Storage.Blobs.Batch" Version="12.24.0" />
1010
<PackageVersion Include="Google.Cloud.Storage.V1" Version="4.14.0" />
1111
<PackageVersion Include="Microsoft.Extensions.FileProviders.Abstractions" Version="6.0.1" />
1212
<PackageVersion Include="Microsoft.Extensions.FileProviders.Physical" Version="6.0.1" />

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
- "10000:10000"
77
- "10001:10001"
88
- "10002:10002"
9-
command: azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0
9+
command: azurite --skipApiVersionCheck --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0
1010

1111
rustfs:
1212
image: docker.io/rustfs/rustfs:latest

src/Ramstack.FileSystem.Azure/AzureDirectory.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ protected override async ValueTask DeleteCoreAsync(CancellationToken cancellatio
4747
var collection = _fs.AzureClient
4848
.GetBlobsAsync(
4949
prefix: GetPrefix(FullName),
50+
traits: BlobTraits.None,
51+
states: BlobStates.None,
5052
cancellationToken: cancellationToken);
5153

5254
var client = _fs.AzureClient.GetBlobBatchClient();
@@ -105,6 +107,8 @@ protected override async IAsyncEnumerable<VirtualNode> GetFileNodesCoreAsync([En
105107
.GetBlobsByHierarchyAsync(
106108
delimiter: "/",
107109
prefix: GetPrefix(FullName),
110+
traits: BlobTraits.None,
111+
states: BlobStates.None,
108112
cancellationToken: cancellationToken);
109113

110114
await foreach (var page in collection.AsPages().WithCancellation(cancellationToken).ConfigureAwait(false))
@@ -121,6 +125,8 @@ protected override async IAsyncEnumerable<VirtualFile> GetFilesCoreAsync([Enumer
121125
.GetBlobsByHierarchyAsync(
122126
delimiter: "/",
123127
prefix: GetPrefix(FullName),
128+
traits: BlobTraits.None,
129+
states: BlobStates.None,
124130
cancellationToken: cancellationToken);
125131

126132
await foreach (var page in collection.AsPages().WithCancellation(cancellationToken).ConfigureAwait(false))
@@ -136,6 +142,8 @@ protected override async IAsyncEnumerable<VirtualDirectory> GetDirectoriesCoreAs
136142
.GetBlobsByHierarchyAsync(
137143
delimiter: "/",
138144
prefix: GetPrefix(FullName),
145+
traits: BlobTraits.None,
146+
states: BlobStates.None,
139147
cancellationToken: cancellationToken);
140148

141149
await foreach (var page in collection.AsPages().WithCancellation(cancellationToken).ConfigureAwait(false))
@@ -162,7 +170,11 @@ protected override async IAsyncEnumerable<VirtualNode> GetFileNodesCoreAsync(str
162170
var directories = new HashSet<string> { FullName };
163171

164172
await foreach (var page in _fs.AzureClient
165-
.GetBlobsAsync(prefix: prefix, cancellationToken: cancellationToken)
173+
.GetBlobsAsync(
174+
prefix: prefix,
175+
traits: BlobTraits.None,
176+
states: BlobStates.None,
177+
cancellationToken: cancellationToken)
166178
.AsPages()
167179
.WithCancellation(cancellationToken)
168180
.ConfigureAwait(false))
@@ -210,7 +222,11 @@ protected override async IAsyncEnumerable<VirtualFile> GetFilesCoreAsync(string[
210222
var prefix = GetPrefix(FullName);
211223

212224
await foreach (var page in _fs.AzureClient
213-
.GetBlobsAsync(prefix: prefix, cancellationToken: cancellationToken)
225+
.GetBlobsAsync(
226+
prefix: prefix,
227+
traits: BlobTraits.None,
228+
states: BlobStates.None,
229+
cancellationToken: cancellationToken)
214230
.AsPages()
215231
.WithCancellation(cancellationToken)
216232
.ConfigureAwait(false))
@@ -239,7 +255,11 @@ protected override async IAsyncEnumerable<VirtualDirectory> GetDirectoriesCoreAs
239255
var directories = new HashSet<string> { FullName };
240256

241257
await foreach (var page in _fs.AzureClient
242-
.GetBlobsAsync(prefix: prefix, cancellationToken: cancellationToken)
258+
.GetBlobsAsync(
259+
prefix: prefix,
260+
traits: BlobTraits.None,
261+
states: BlobStates.None,
262+
cancellationToken: cancellationToken)
243263
.AsPages()
244264
.WithCancellation(cancellationToken)
245265
.ConfigureAwait(false))

src/Ramstack.FileSystem.Azure/Ramstack.FileSystem.Azure.csproj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
55
<Description>Provides an implementation of Ramstack.FileSystem based on Azure Blob Storage.</Description>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
@@ -40,9 +40,17 @@
4040
</Compile>
4141
</ItemGroup>
4242

43-
<ItemGroup>
43+
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
44+
<PackageReference Include="Azure.Storage.Blobs" VersionOverride="12.21.2" />
45+
<PackageReference Include="Azure.Storage.Blobs.Batch" VersionOverride="12.18.1" />
46+
</ItemGroup>
47+
48+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
4449
<PackageReference Include="Azure.Storage.Blobs" />
4550
<PackageReference Include="Azure.Storage.Blobs.Batch" />
51+
</ItemGroup>
52+
53+
<ItemGroup>
4654
<PackageReference Include="Microsoft.SourceLink.GitHub">
4755
<PrivateAssets>all</PrivateAssets>
4856
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

tests/Ramstack.FileSystem.Azure.Tests/Ramstack.FileSystem.Azure.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<LangVersion>preview</LangVersion>

tests/Ramstack.FileSystem.Azure.Tests/ReadonlyAzureFileSystemTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ namespace Ramstack.FileSystem.Azure;
77
[Category("Cloud:Azure")]
88
public class ReadonlyAzureFileSystemTests : VirtualFileSystemSpecificationTests
99
{
10-
private readonly TempFileStorage _storage = new TempFileStorage();
10+
private readonly TempFileStorage _storage = new();
11+
private readonly string _storageName = Guid.NewGuid().ToString("N");
1112

1213
[OneTimeSetUp]
1314
public async Task Setup()
@@ -38,11 +39,11 @@ protected override IVirtualFileSystem GetFileSystem() =>
3839
protected override DirectoryInfo GetDirectoryInfo() =>
3940
new DirectoryInfo(_storage.Root);
4041

41-
private static AzureFileSystem CreateFileSystem(bool isReadonly)
42+
private AzureFileSystem CreateFileSystem(bool isReadonly)
4243
{
4344
const string ConnectionString = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;";
4445

45-
return new AzureFileSystem(ConnectionString, "storage")
46+
return new AzureFileSystem(ConnectionString, _storageName)
4647
{
4748
IsReadOnly = isReadonly
4849
};

tests/Ramstack.FileSystem.Azure.Tests/WritableAzureFileSystemTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ namespace Ramstack.FileSystem.Azure;
99
public class WritableAzureFileSystemTests : VirtualFileSystemSpecificationTests
1010
{
1111
private readonly HashSet<string> _list = [];
12-
private readonly TempFileStorage _storage = new TempFileStorage();
12+
private readonly TempFileStorage _storage = new();
13+
private readonly string _storageName = Guid.NewGuid().ToString("N");
1314

1415
[OneTimeSetUp]
1516
public async Task Setup()
@@ -124,7 +125,7 @@ await fs.GetFilesAsync("/temp").AnyAsync(),
124125
}
125126

126127
protected override AzureFileSystem GetFileSystem() =>
127-
CreateFileSystem("storage");
128+
CreateFileSystem(_storageName);
128129

129130
protected override DirectoryInfo GetDirectoryInfo() =>
130131
new DirectoryInfo(_storage.Root);

0 commit comments

Comments
 (0)