Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(playwrighttesting): Using dependency injection instead of BlobClient in TestProcessor #46807

Merged
merged 11 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -34,7 +34,13 @@ public async Task UploadBufferAsync(string uri, string buffer, string fileRelati
_logger.Error($"Failed to upload buffer: {ex}");
}
}

public void UploadBlobFile(string uri, string fileRelativePath, string filePath)
{
string cloudFilePath = GetCloudFilePath(uri, fileRelativePath);
BlobClient blobClient = new(new Uri(cloudFilePath));
blobClient.Upload(filePath, overwrite: true);
_logger.Info($"Uploaded file {filePath} to {fileRelativePath}");
}
public string GetCloudFilePath(string uri, string fileRelativePath)
{
string[] parts = uri.Split(new string[] { ReporterConstants.s_sASUriSeparator }, StringSplitOptions.None);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ internal interface IBlobService
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
Task UploadBufferAsync(string uri, string buffer, string fileRelativePath);
string GetCloudFilePath(string uri, string fileRelativePath);
void UploadBlobFile(string uri, string fileRelativePath, string filePath);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,7 @@ private void UploadBuffer(string uri, string buffer, string fileRelativePath)

private void UploadBlobFile(string uri, string fileRelativePath, string filePath)
{
string cloudFilePath = _blobService.GetCloudFilePath(uri, fileRelativePath);
BlobClient blobClient = new(new Uri(cloudFilePath));
// Upload filePath to Blob
blobClient.Upload(filePath, overwrite: true);
_blobService.UploadBlobFile(uri, fileRelativePath, filePath);
_logger.Info($"Uploaded file {filePath} to {fileRelativePath}");
}

Expand Down