diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Implementation/BlobService.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Implementation/BlobService.cs
index 6b436c45f9ff2..6c0613f15d26c 100644
--- a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Implementation/BlobService.cs
+++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Implementation/BlobService.cs
@@ -35,6 +35,23 @@ public async Task UploadBufferAsync(string uri, string buffer, string fileRelati
_logger.Error($"Failed to upload buffer: {ex}");
}
}
+
+ public void UploadBuffer(string uri, string buffer, string fileRelativePath)
+ {
+ try
+ {
+ string cloudFilePath = GetCloudFilePath(uri, fileRelativePath);
+ BlobClient blobClient = new(new Uri(cloudFilePath));
+ byte[] bufferBytes = Encoding.UTF8.GetBytes(buffer);
+ blobClient.Upload(new BinaryData(bufferBytes), overwrite: true);
+ _logger.Info($"Uploaded buffer to {fileRelativePath}");
+ }
+ catch (Exception ex)
+ {
+ _logger.Error($"Failed to upload buffer: {ex}");
+ }
+ }
+
public void UploadBlobFile(string uri, string fileRelativePath, string filePath)
{
string cloudFilePath = GetCloudFilePath(uri, fileRelativePath);
diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Interface/IBlobService.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Interface/IBlobService.cs
index 587903f1418fe..a91303f592631 100644
--- a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Interface/IBlobService.cs
+++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Interface/IBlobService.cs
@@ -14,7 +14,8 @@ internal interface IBlobService
///
/// A representing the result of the asynchronous operation.
Task UploadBufferAsync(string uri, string buffer, string fileRelativePath);
- string GetCloudFilePath(string uri, string fileRelativePath);
+ void UploadBuffer(string uri, string buffer, string fileRelativePath);
+ string GetCloudFilePath(string uri, string fileRelativePath);
void UploadBlobFile(string uri, string fileRelativePath, string filePath);
public string? GetCloudFileName(string filePath, string testExecutionId);
}
diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Processor/TestProcessor.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Processor/TestProcessor.cs
index 6bf1c260b2a19..44320035a8c57 100644
--- a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Processor/TestProcessor.cs
+++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/src/Processor/TestProcessor.cs
@@ -8,6 +8,7 @@
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
+using Azure.Core.Pipeline;
using Azure.Developer.MicrosoftPlaywrightTesting.TestLogger.Implementation;
using Azure.Developer.MicrosoftPlaywrightTesting.TestLogger.Interface;
using Azure.Developer.MicrosoftPlaywrightTesting.TestLogger.Model;
@@ -174,7 +175,7 @@ public void TestRunCompleteHandler(object? sender, TestRunCompleteEventArgs e)
// Upload rawResult to blob storage using sasUri
var rawTestResultJson = JsonSerializer.Serialize(rawResult);
var filePath = $"{testResult.TestExecutionId}/rawTestResult.json";
- _blobService.UploadBufferAsync(sasUri!.Uri!, rawTestResultJson, filePath);
+ _blobService.UploadBuffer(sasUri!.Uri!, rawTestResultJson, filePath);
}
else
{
diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/tests/Implementation/BlobServiceTests.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/tests/Implementation/BlobServiceTests.cs
index eaa6006b8459e..b3c0de7e2f3ae 100644
--- a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/tests/Implementation/BlobServiceTests.cs
+++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/tests/Implementation/BlobServiceTests.cs
@@ -35,6 +35,18 @@ public async Task UploadBufferAsync_WithException_LogsError()
_loggerMock!.Verify(logger => logger.Error(It.IsAny()), Times.Once);
}
+ [Test]
+ public void UploadBuffer_WithException_LogsError()
+ {
+ string uri = "invalid_uri";
+ string buffer = "Test buffer";
+ string fileRelativePath = "test/path";
+
+ _blobService!.UploadBuffer(uri, buffer, fileRelativePath);
+
+ _loggerMock!.Verify(logger => logger.Error(It.IsAny()), Times.Once);
+ }
+
[Test]
public void GetCloudFilePath_WithValidParameters_ReturnsCorrectPath()
{