Skip to content

Commit 4c7c2a8

Browse files
Add max age to allow coverage.
1 parent d078a25 commit 4c7c2a8

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/ImageSharp.Web.Providers.Azure/Caching/AzureBlobStorageCacheResolver.cs renamed to src/ImageSharp.Web.Providers.Azure/Resolvers/AzureBlobStorageCacheResolver.cs

File renamed without changes.

tests/ImageSharp.Web.Tests/Processing/PhysicalFileSystemCacheServerTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Net;
77
using System.Net.Http;
88
using System.Threading.Tasks;
9-
using Microsoft.AspNetCore.Http;
109
using SixLabors.ImageSharp.Formats;
1110
using SixLabors.ImageSharp.Web.Tests.TestUtilities;
1211
using Xunit;

tests/ImageSharp.Web.Tests/TestUtilities/AzureBlobStorageImageProviderFactory.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.IO;
66
using System.Linq;
7+
using System.Net.Http.Headers;
78
using Azure.Storage.Blobs;
89
using Azure.Storage.Blobs.Models;
910
using Microsoft.AspNetCore.Hosting;
@@ -44,7 +45,21 @@ private static void InitializeAzureStorage(IServiceProvider services, AzureBlobS
4445
{
4546
IFileInfo file = environment.WebRootFileProvider.GetFileInfo(TestConstants.ImagePath);
4647
using Stream stream = file.CreateReadStream();
47-
blob.Upload(stream, true);
48+
49+
// Set the max-age property so we get coverage for testing is in our Azure provider.
50+
var cacheControl = new CacheControlHeaderValue
51+
{
52+
Public = true,
53+
MaxAge = TimeSpan.FromDays(7),
54+
MustRevalidate = true
55+
};
56+
57+
var headers = new BlobHttpHeaders
58+
{
59+
CacheControl = cacheControl.ToString(),
60+
};
61+
62+
blob.Upload(stream, httpHeaders: headers);
4863
}
4964
}
5065
}

0 commit comments

Comments
 (0)