From b68657bbb4a03465edc45245fb02b15f219b8758 Mon Sep 17 00:00:00 2001 From: "REDMOND\\wiboris" Date: Wed, 12 Jun 2024 12:01:48 -0700 Subject: [PATCH] update based on feedback --- .github/CODEOWNERS | 5 +-- sdk/batch/Azure.Compute.Batch/CHANGELOG.md | 10 ++---- sdk/batch/Azure.Compute.Batch/README.md | 4 +-- .../api/Azure.Compute.Batch.netstandard2.0.cs | 6 ++-- .../Custom/BatchNamedKeyCredentialPolicy.cs | 21 ++++-------- .../src/Custom/Constants.cs | 2 +- .../src/Custom/Models/BatchFileProperties.cs | 34 ++++++++----------- .../BatchPoolReplaceContent.Serialization.cs | 4 +++ .../Custom/Models/BatchPoolReplaceContent.cs | 18 ---------- .../src/GlobalSuppressions.cs | 9 +---- .../src/Properties/AssemblyInfo.cs | 2 +- .../tests/Azure.Compute.Batch.Tests.csproj | 4 --- .../Infrastructure/BatchClientBehavior.cs | 18 ---------- .../tests/Infrastructure/DetailLevel.cs | 21 ------------ .../tests/Infrastructure/IRefreshable.cs | 34 ------------------- .../tests/Infrastructure/PoolFixture.cs | 12 ------- .../tests/Infrastructure/PoolUtilites.cs | 15 -------- ...uxPoolFixture.cs => WindowsPoolFixture.cs} | 4 +-- .../Integration/BatchJobIntegrationTests.cs | 4 +-- .../Integration/BatchNodeIntegrationTests.cs | 14 ++++---- .../Integration/BatchPoolIntegrationTests.cs | 16 ++++----- .../Integration/BatchTaskIntegrationTests.cs | 10 +++--- .../Integration/EndToEndIntegrationTests.cs | 26 -------------- .../tests/Integration/FileIntegrationTests.cs | 10 +++--- sdk/batch/GlobalSuppressions.cs | 12 ------- 25 files changed, 65 insertions(+), 250 deletions(-) delete mode 100644 sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchPoolReplaceContent.cs delete mode 100644 sdk/batch/Azure.Compute.Batch/tests/Infrastructure/BatchClientBehavior.cs delete mode 100644 sdk/batch/Azure.Compute.Batch/tests/Infrastructure/DetailLevel.cs delete mode 100644 sdk/batch/Azure.Compute.Batch/tests/Infrastructure/IRefreshable.cs delete mode 100644 sdk/batch/Azure.Compute.Batch/tests/Infrastructure/PoolUtilites.cs rename sdk/batch/Azure.Compute.Batch/tests/Infrastructure/{IaasLinuxPoolFixture.cs => WindowsPoolFixture.cs} (91%) delete mode 100644 sdk/batch/Azure.Compute.Batch/tests/Integration/EndToEndIntegrationTests.cs delete mode 100644 sdk/batch/GlobalSuppressions.cs diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9a4583d0a6c5..28454f149192 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -157,10 +157,7 @@ # ServiceOwners: @rpsqrd @edyoung # PRLabel: %Batch -/sdk/batch/ @wiboris @dpwatrous - -# PRLabel: %Batch -/sdk/batch/Azure.Compute.Batch @wiboris @dpwatrous +/sdk/batch/ @wiboris @dpwatrous @wanghoppe @skapur12 # ServiceLabel: %Batch # ServiceOwners: @wiboris @dpwatrous diff --git a/sdk/batch/Azure.Compute.Batch/CHANGELOG.md b/sdk/batch/Azure.Compute.Batch/CHANGELOG.md index 3bcced74276d..1cf622ded57f 100644 --- a/sdk/batch/Azure.Compute.Batch/CHANGELOG.md +++ b/sdk/batch/Azure.Compute.Batch/CHANGELOG.md @@ -2,15 +2,9 @@ ## 1.0.0-beta.1 (2024-06-01) -### Breaking Changes +### Features Added -New design of track 2 initial commit. - -### Package Name - -The package name has been changed from `Microsoft.Azure.Batch` to `Azure.Compute.Batch`. - -### General New Features +New design of track 2 initial commit. This package, `Azure.Compute.Batch`, replaces `Microsoft.Azure.Batch`. This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities. diff --git a/sdk/batch/Azure.Compute.Batch/README.md b/sdk/batch/Azure.Compute.Batch/README.md index 73d7751649cd..24e1e8ae74d1 100644 --- a/sdk/batch/Azure.Compute.Batch/README.md +++ b/sdk/batch/Azure.Compute.Batch/README.md @@ -1,6 +1,6 @@ -# Azure Compute.Batch client library for .NET +# Azure Batch client library for .NET -Azure.Compute.Batch is a managed service that helps developers get secret simply and securely. +Azur Batch is a managed service that helps developers get secret simply and securely. Use the client library for to: diff --git a/sdk/batch/Azure.Compute.Batch/api/Azure.Compute.Batch.netstandard2.0.cs b/sdk/batch/Azure.Compute.Batch/api/Azure.Compute.Batch.netstandard2.0.cs index 1ad6b96f27c9..4636795b4283 100644 --- a/sdk/batch/Azure.Compute.Batch/api/Azure.Compute.Batch.netstandard2.0.cs +++ b/sdk/batch/Azure.Compute.Batch/api/Azure.Compute.Batch.netstandard2.0.cs @@ -478,10 +478,10 @@ internal BatchErrorMessage() { } public partial class BatchFileProperties { internal BatchFileProperties() { } - public bool BatchFileIsDirectory { get { throw null; } } - public string BatchFileMode { get { throw null; } } - public string BatchFileUrl { get { throw null; } } public System.DateTime CreationTime { get { throw null; } } + public string FileUrl { get { throw null; } } + public bool IsDirectory { get { throw null; } } + public string Mode { get { throw null; } } } public partial class BatchJob : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { diff --git a/sdk/batch/Azure.Compute.Batch/src/Custom/BatchNamedKeyCredentialPolicy.cs b/sdk/batch/Azure.Compute.Batch/src/Custom/BatchNamedKeyCredentialPolicy.cs index 715926c3225a..e1bf5ba97114 100644 --- a/sdk/batch/Azure.Compute.Batch/src/Custom/BatchNamedKeyCredentialPolicy.cs +++ b/sdk/batch/Azure.Compute.Batch/src/Custom/BatchNamedKeyCredentialPolicy.cs @@ -20,11 +20,6 @@ namespace Azure.Compute.Batch.Custom /// internal class BatchNamedKeyCredentialPolicy : HttpPipelineSynchronousPolicy { - /// - /// Whether to always add the x-ms-date header. - /// - private const bool IncludeXMsDate = true; - /// /// Batch Account name /// @@ -63,12 +58,8 @@ public override void OnSendingRequest(HttpMessage message) { base.OnSendingRequest(message); - // Add a x-ms-date header - if (IncludeXMsDate) - { - var date = DateTimeOffset.UtcNow.ToString("r", CultureInfo.InvariantCulture); - message.Request.Headers.SetValue(Constants.HeaderNames.Date, date); - } + var date = DateTimeOffset.UtcNow.ToString("r", CultureInfo.InvariantCulture); + message.Request.Headers.SetValue(Constants.HeaderNames.OCPDate, date); var stringToSign = BuildStringToSign(message); var signature = ComputeSasSignature(stringToSign); @@ -107,7 +98,7 @@ private string BuildStringToSign(HttpMessage message) stringBuilder.Append(contentLengthString == "0" ? "" : contentLengthString ?? "").Append('\n'); stringBuilder.Append(contentMD5 ?? "");// todo: fix base 64 VALUE stringBuilder.Append('\n'); - stringBuilder.Append(contentType ?? "").Append('\n'); // Empty date because x-ms-date is expected (as per web page above)) + stringBuilder.Append(contentType ?? "").Append('\n'); // Empty date because ocp-date is expected (as per web page above)) stringBuilder.Append('\n'); stringBuilder.Append(ifModifiedSince ?? "").Append('\n'); stringBuilder.Append(ifMatch ?? "").Append('\n'); @@ -122,7 +113,7 @@ private string BuildStringToSign(HttpMessage message) // If you change this method, make sure live tests are passing before merging PR. private void BuildCanonicalizedHeaders(StringBuilder stringBuilder, HttpMessage message) { - // Grab all the "x-ms-*" headers, trim whitespace, lowercase, sort, + // Grab all the "ocp-*" headers, trim whitespace, lowercase, sort, // and combine them with their values (separated by a colon). var headers = new List(); foreach (var header in message.Request.Headers) @@ -148,14 +139,14 @@ private void BuildCanonicalizedHeaders(StringBuilder stringBuilder, HttpMessage // If you change this method, make sure live tests are passing before merging PR. private void BuildCanonicalizedResource(StringBuilder stringBuilder, Uri resource) { - // https://docs.microsoft.com/en-us/rest/api/Batchservices/authentication-for-the-azure-Batch-services + // https://learn.microsoft.com/rest/api/batchservice/authenticate-requests-to-the-azure-batch-service stringBuilder.Append('/'); stringBuilder.Append(AccountName); if (resource.AbsolutePath.Length > 0) { // Any portion of the CanonicalizedResource string that is derived from // the resource's URI should be encoded exactly as it is in the URI. - // -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx + // -- https://msdn.microsoft.com/library/azure/dd179428.aspx stringBuilder.Append(resource.AbsolutePath);//EscapedPath() } else diff --git a/sdk/batch/Azure.Compute.Batch/src/Custom/Constants.cs b/sdk/batch/Azure.Compute.Batch/src/Custom/Constants.cs index 83d8fb28c5d6..56c002fcc581 100644 --- a/sdk/batch/Azure.Compute.Batch/src/Custom/Constants.cs +++ b/sdk/batch/Azure.Compute.Batch/src/Custom/Constants.cs @@ -15,7 +15,7 @@ internal static class Constants internal static class HeaderNames { public const string OCPPrefix = "ocp-"; - public const string Date = "ocp-date"; + public const string OCPDate = "ocp-date"; public const string SharedKey = "SharedKey"; public const string Authorization = "Authorization"; public const string ContentEncoding = "Content-Encoding"; diff --git a/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchFileProperties.cs b/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchFileProperties.cs index 6cc2ef3dcbfa..3d6d57cdef27 100644 --- a/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchFileProperties.cs +++ b/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchFileProperties.cs @@ -1,10 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - -#nullable disable - using System; using System.Collections.Generic; using System.Globalization; @@ -19,20 +15,20 @@ public partial class BatchFileProperties { internal BatchFileProperties(bool batchFileIsDirectory, string batchFileMode, string batchFileUrl, DateTime creationTime) { - BatchFileIsDirectory = batchFileIsDirectory; - BatchFileMode = batchFileMode; - BatchFileUrl = batchFileUrl; + IsDirectory = batchFileIsDirectory; + Mode = batchFileMode; + FileUrl = batchFileUrl; CreationTime = creationTime; } /// Whether the object represents a directory. - public bool BatchFileIsDirectory { get; } + public bool IsDirectory { get; } /// The file mode attribute in octal format. - public string BatchFileMode { get; } + public string Mode { get; } /// The URL of the file. - public string BatchFileUrl { get; } + public string FileUrl { get; } /// The file creation time. public DateTime CreationTime { get; } @@ -41,21 +37,21 @@ internal BatchFileProperties(bool batchFileIsDirectory, string batchFileMode, st /// The response to deserialize the model from. internal static BatchFileProperties FromResponse(Response response) { - string batchFileIsDirectoryStr = ""; - bool batchFileIsDirectory = false; - string batchFileMode = ""; - string batchFileUrl = ""; + string isDirectoryStr = ""; + bool isDirectory = false; + string mode = ""; + string fileUrl = ""; string creationTimeStr = ""; response.Headers.TryGetValue("ocp-creation-time", out creationTimeStr); - response.Headers.TryGetValue("ocp-batch-file-isdirectory", out batchFileIsDirectoryStr); - response.Headers.TryGetValue("ocp-batch-file-url", out batchFileUrl); - response.Headers.TryGetValue("ocp-batch-file-mode", out batchFileMode); + response.Headers.TryGetValue("ocp-batch-file-isdirectory", out isDirectoryStr); + response.Headers.TryGetValue("ocp-batch-file-url", out fileUrl); + response.Headers.TryGetValue("ocp-batch-file-mode", out mode); - Boolean.TryParse(batchFileIsDirectoryStr, out batchFileIsDirectory); + Boolean.TryParse(isDirectoryStr, out isDirectory); DateTime creationTime = DateTime.Parse(creationTimeStr, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); - return new BatchFileProperties(batchFileIsDirectory, batchFileMode, batchFileUrl, creationTime); + return new BatchFileProperties(isDirectory, mode, fileUrl, creationTime); } } } diff --git a/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchPoolReplaceContent.Serialization.cs b/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchPoolReplaceContent.Serialization.cs index 29ff9f976cb7..7ca106d168fa 100644 --- a/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchPoolReplaceContent.Serialization.cs +++ b/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchPoolReplaceContent.Serialization.cs @@ -13,6 +13,10 @@ namespace Azure.Compute.Batch { + /// + /// Customizing the Serialization of BatchPoolReplaceContent to handle the missing variable certificateReferences. This + /// is a work around will be removed in the next release + /// public partial class BatchPoolReplaceContent : IUtf8JsonSerializable, IJsonModel { void global::Azure.Core.IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); diff --git a/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchPoolReplaceContent.cs b/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchPoolReplaceContent.cs deleted file mode 100644 index e9b5ad886fb7..000000000000 --- a/sdk/batch/Azure.Compute.Batch/src/Custom/Models/BatchPoolReplaceContent.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.Compute.Batch -{ - /// Parameters for replacing properties on an Azure Batch Pool. - public partial class BatchPoolReplaceContent - { - } -} diff --git a/sdk/batch/Azure.Compute.Batch/src/GlobalSuppressions.cs b/sdk/batch/Azure.Compute.Batch/src/GlobalSuppressions.cs index 4c34569e52ea..58a20923fe5d 100644 --- a/sdk/batch/Azure.Compute.Batch/src/GlobalSuppressions.cs +++ b/sdk/batch/Azure.Compute.Batch/src/GlobalSuppressions.cs @@ -10,11 +10,4 @@ using System.Reflection; using System.Security.Cryptography; -[assembly: SuppressMessage("Usage", "AZC0030:Use one of the following pre-approved namespace groups (https://azure.github.io/azure-sdk/registered_namespaces.html): Azure.AI, Azure.Analytics, Azure.Communication, Azure.Containers, Azure.Core.Expressions, Azure.Data, Azure.DigitalTwins, Azure.Identity, Azure.IoT, Azure.Learn, Azure.Management, Azure.Media, Azure.Messaging, Azure.MixedReality, Azure.Monitor, Azure.ResourceManager, Azure.Search, Azure.Security, Azure.Storage, Azure.Template, Microsoft.Extensions.Azure", Justification = "", Scope = "namespaceanddescendants", Target = "~N:Azure.Compute.Batch")] -[assembly: SuppressMessage("Usage", "AZC0001:Use one of the following pre-approved namespace groups (https://azure.github.io/azure-sdk/registered_namespaces.html): Azure.AI, Azure.Analytics, Azure.Communication, Azure.Containers, Azure.Core.Expressions, Azure.Data, Azure.DigitalTwins, Azure.Identity, Azure.IoT, Azure.Learn, Azure.Management, Azure.Media, Azure.Messaging, Azure.MixedReality, Azure.Monitor, Azure.ResourceManager, Azure.Search, Azure.Security, Azure.Storage, Azure.Template, Microsoft.Extensions.Azure", Justification = "", Scope = "namespaceanddescendants", Target = "~N:Azure.Compute.Batch")] -[assembly: SuppressMessage("Usage", "AZC0002:DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.", Justification = "", Scope = "namespaceanddescendants", Target = "~N:Azure.Compute.Batch")] -[assembly: SuppressMessage("Usage", "AZC0012:Avoid single word type names", Justification = "", Scope = "type", Target = "~T:Azure.Compute.Batch.Schedule")] -[assembly: SuppressMessage("Usage", "AZC0001:Use one of the following pre-approved namespace groups (https://azure.github.io/azure-sdk/registered_namespaces.html): Azure.AI, Azure.Analytics, Azure.Communication, Azure.Containers, Azure.Core.Expressions, Azure.Data, Azure.DigitalTwins, Azure.Identity, Azure.IoT, Azure.Learn, Azure.Management, Azure.Media, Azure.Messaging, Azure.MixedReality, Azure.Monitor, Azure.ResourceManager, Azure.Search, Azure.Security, Azure.Storage, Azure.Template, Microsoft.Extensions.Azure", Justification = "", Scope = "namespace", Target = "~N:Azure.Compute.Batch.Models")] -[assembly: SuppressMessage("Usage", "AZC0012:Avoid single word type names", Justification = "", Scope = "type", Target = "~T:Azure.Compute.Batch.Models.Schedule")] -[assembly: SuppressMessage("Usage", "AZC0012:Avoid single word type names", Justification = "", Scope = "type", Target = "~T:Azure.Compute.Batch.Models.Schedule")] -[assembly: SuppressMessage("Usage", "AZC0012:Avoid single word type names", Justification = "", Scope = "type", Target = "~T:Azure.Compute.Batch.Models.Schedule")] +[assembly: SuppressMessage("Usage", "AZC0030:Model name 'ExitOptions' ends with 'Options'. Suggest to rename it to 'ExitConfig' or any other appropriate name.", Justification = "SDK Review Approved, ExitCodeMapping and ExitCodeRangeMapping models have parameter called exitOptions which we wanted to match", Scope = "namespaceanddescendants", Target = "~N:Azure.Compute.Batch")] diff --git a/sdk/batch/Azure.Compute.Batch/src/Properties/AssemblyInfo.cs b/sdk/batch/Azure.Compute.Batch/src/Properties/AssemblyInfo.cs index 5165a039e89d..7e4658d064cc 100644 --- a/sdk/batch/Azure.Compute.Batch/src/Properties/AssemblyInfo.cs +++ b/sdk/batch/Azure.Compute.Batch/src/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ // Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. // See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers // for the list of possible values. -[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Batch")] diff --git a/sdk/batch/Azure.Compute.Batch/tests/Azure.Compute.Batch.Tests.csproj b/sdk/batch/Azure.Compute.Batch/tests/Azure.Compute.Batch.Tests.csproj index 54309afb2d60..7e81c1fafc10 100644 --- a/sdk/batch/Azure.Compute.Batch/tests/Azure.Compute.Batch.Tests.csproj +++ b/sdk/batch/Azure.Compute.Batch/tests/Azure.Compute.Batch.Tests.csproj @@ -22,8 +22,4 @@ - - - - diff --git a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/BatchClientBehavior.cs b/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/BatchClientBehavior.cs deleted file mode 100644 index c53355b1bbc2..000000000000 --- a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/BatchClientBehavior.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Azure.Compute.Batch.Tests.Infrastructure -{ - /// - /// Derived classes modify operational behaviors of a Azure Batch Service client. Derived classes can be called out of order and simultaneously by several threads. Implementations should be threadsafe. - /// - public abstract class BatchClientBehavior - { - } -} diff --git a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/DetailLevel.cs b/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/DetailLevel.cs deleted file mode 100644 index 7af86e4f891b..000000000000 --- a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/DetailLevel.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Azure.Compute.Batch.Tests.Infrastructure -{ - /// - /// Controls the amount of detail requested from the Azure Batch service when listing or - /// retrieving resources. - /// - /// The only supported implementation of DetailLevel is . - /// Other implementations are ignored. - public abstract class DetailLevel - { - } -} diff --git a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/IRefreshable.cs b/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/IRefreshable.cs deleted file mode 100644 index ac4c420a8ebd..000000000000 --- a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/IRefreshable.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace Azure.Compute.Batch.Tests.Infrastructure -{ - /// - /// Provides a mechanism for refreshing a resource. - /// - public interface IRefreshable - { - /// - /// Begins asynchronous call to refresh the current object. - /// - /// Controls the detail level of the data returned by a call to the Azure Batch Service. If a detail level which omits the "Name" property is specified, refresh will fail. - /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. - /// A for controlling the lifetime of the asynchronous operation. - /// A object that represents the asynchronous operation. - System.Threading.Tasks.Task RefreshAsync(DetailLevel detailLevel = null, IEnumerable additionalBehaviors = null, CancellationToken cancellationToken = default(CancellationToken)); - - /// - /// Blocking call to force a refresh of the current object. - /// - /// Controls the detail level of the data returned by a call to the Azure Batch Service. If a detail level which omits the "Name" property is specified, refresh will fail. - /// A collection of BatchClientBehavior instances that are applied after the CustomBehaviors on the current object. - void Refresh(DetailLevel detailLevel = null, IEnumerable additionalBehaviors = null); - } -} diff --git a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/PoolFixture.cs b/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/PoolFixture.cs index 7b1f97e45f18..784f2b214f9c 100644 --- a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/PoolFixture.cs +++ b/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/PoolFixture.cs @@ -34,18 +34,6 @@ protected PoolFixture(string poolId, BatchClient batchClient, bool isPlayback) PlayBack = isPlayback; } - public async void Dispose() - { - //This should not throw so swallow exceptions? - try - { - await this.client.DeletePoolAsync(PoolId); - } - catch (Exception) - { - } - } - public async Task FindPoolIfExistsAsync() { // reuse existing pool if it exists diff --git a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/PoolUtilites.cs b/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/PoolUtilites.cs deleted file mode 100644 index 4b1289fba2ac..000000000000 --- a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/PoolUtilites.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Azure.Compute.Batch.Tests.Infrastructure -{ - internal class PoolUtilites - { - } -} diff --git a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/IaasLinuxPoolFixture.cs b/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/WindowsPoolFixture.cs similarity index 91% rename from sdk/batch/Azure.Compute.Batch/tests/Infrastructure/IaasLinuxPoolFixture.cs rename to sdk/batch/Azure.Compute.Batch/tests/Infrastructure/WindowsPoolFixture.cs index 00e769d3fd8e..399994f9d976 100644 --- a/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/IaasLinuxPoolFixture.cs +++ b/sdk/batch/Azure.Compute.Batch/tests/Infrastructure/WindowsPoolFixture.cs @@ -11,9 +11,9 @@ namespace Azure.Compute.Batch.Tests.Infrastructure { - internal class IaasLinuxPoolFixture : PoolFixture + internal class WindowsPoolFixture : PoolFixture { - public IaasLinuxPoolFixture(BatchClient batchClient, string poolID, bool isPlayback) : base(poolID, batchClient, isPlayback) { } + public WindowsPoolFixture(BatchClient batchClient, string poolID, bool isPlayback) : base(poolID, batchClient, isPlayback) { } public async Task CreatePoolAsync(int targetDedicatedNodes = 1) { diff --git a/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchJobIntegrationTests.cs b/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchJobIntegrationTests.cs index bc5e1456d290..c7beac82d817 100644 --- a/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchJobIntegrationTests.cs +++ b/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchJobIntegrationTests.cs @@ -40,7 +40,7 @@ public BatchJobIntegrationTests(bool isAsync) : base(isAsync) public async Task JobOperations() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "JobOperations", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "JobOperations", isPlayBack()); string poolID = iaasWindowsPoolFixture.PoolId; string jobID = "batchJob1"; string taskID = "Task1"; @@ -131,7 +131,7 @@ public async Task JobOperations() public async Task PatchJob() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "PatchJob", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "PatchJob", isPlayBack()); string poolID = iaasWindowsPoolFixture.PoolId; string jobID = "batchJob2"; string commandLine = "cmd /c echo Hello World"; diff --git a/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchNodeIntegrationTests.cs b/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchNodeIntegrationTests.cs index cd180760bceb..d6262892b923 100644 --- a/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchNodeIntegrationTests.cs +++ b/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchNodeIntegrationTests.cs @@ -34,7 +34,7 @@ public BatchNodeIntegrationTests(bool isAsync) : base(isAsync) public async Task ListBatchNode() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "ListBatchNode", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "ListBatchNode", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -61,7 +61,7 @@ public async Task ListBatchNode() public async Task BatchNodeUser() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "BatchNodeUser", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "BatchNodeUser", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; var userName = "User1"; var userPassWord = "Password1"; @@ -109,7 +109,7 @@ public async Task BatchNodeUser() public async Task RebootBatchNode() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "RebootBatchNode", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "RebootBatchNode", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -138,7 +138,7 @@ public async Task RebootBatchNode() public async Task BatchNodeExtension() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "BatchNodeExtension", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "BatchNodeExtension", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -187,7 +187,7 @@ public async Task BatchNodeExtension() public async Task GetRemoteLoginSettings() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "GetRemoteLoginSettings", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "GetRemoteLoginSettings", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -216,7 +216,7 @@ public async Task GetRemoteLoginSettings() public async Task Scheduling() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "Scheduling", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "Scheduling", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -240,7 +240,7 @@ public async Task Scheduling() response = await client.EnableNodeSchedulingAsync(poolID, batchNodeID); Assert.AreEqual(200, response.Status); - UploadBatchServiceLogsContent uploadBatchServiceLogsContent = new UploadBatchServiceLogsContent("http://fake.com", DateTimeOffset.Parse("2026-05-01T00:00:00.0000000Z")); + UploadBatchServiceLogsContent uploadBatchServiceLogsContent = new UploadBatchServiceLogsContent("http://contoso.com", DateTimeOffset.Parse("2026-05-01T00:00:00.0000000Z")); UploadBatchServiceLogsResult uploadBatchServiceLogsResult = await client.UploadNodeLogsAsync(poolID, batchNodeID, uploadBatchServiceLogsContent); Assert.NotNull(uploadBatchServiceLogsResult); diff --git a/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchPoolIntegrationTests.cs b/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchPoolIntegrationTests.cs index 1382e5ed18fc..c710a1911481 100644 --- a/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchPoolIntegrationTests.cs +++ b/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchPoolIntegrationTests.cs @@ -35,7 +35,7 @@ public BatchPoolIntegrationTests(bool isAsync) : base(isAsync) public async Task GetPoolNodeCounts() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "GetPoolNodeCounts", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "GetPoolNodeCounts", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -65,7 +65,7 @@ public async Task GetPoolNodeCounts() public async Task PoolExists() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "PoolExists", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "PoolExists", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -90,7 +90,7 @@ public async Task PoolExists() public async Task PoolGetPoolUsageMetrics() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "PoolGetPoolUsageMetrics", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "PoolGetPoolUsageMetrics", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -118,7 +118,7 @@ public async Task PoolGetPoolUsageMetrics() public async Task PoolRemoveNodes() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "PoolRemoveNodes", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "PoolRemoveNodes", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -157,7 +157,7 @@ public async Task PoolRemoveNodes() public async Task AutoScale() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "AutoScale", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "AutoScale", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; string poolASFormulaOrig = "$TargetDedicated = 0;"; string poolASFormulaNew = "$TargetDedicated = 1;"; @@ -210,7 +210,7 @@ public async Task AutoScale() public async Task ResizePool() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "ResizePool", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "ResizePool", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -244,7 +244,7 @@ public async Task ResizePool() public async Task ReplacePool() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "ReplacePool", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "ReplacePool", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try @@ -279,7 +279,7 @@ public async Task ReplacePool() public async Task PatchPool() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "PatchPool", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "PatchPool", isPlayBack()); var poolID = iaasWindowsPoolFixture.PoolId; try diff --git a/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchTaskIntegrationTests.cs b/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchTaskIntegrationTests.cs index 2d0def90dde3..6996d4c655b3 100644 --- a/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchTaskIntegrationTests.cs +++ b/sdk/batch/Azure.Compute.Batch/tests/Integration/BatchTaskIntegrationTests.cs @@ -36,7 +36,7 @@ public BatchTaskIntegrationTests(bool isAsync) : base(isAsync) public async Task AddTask() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "AddTask", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "AddTask", isPlayBack()); string poolID = iaasWindowsPoolFixture.PoolId; string jobID = "batchJob1"; string taskID = "Task1"; @@ -74,7 +74,7 @@ public async Task AddTask() public async Task AddTaskCollection() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "AddTaskCollection", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "AddTaskCollection", isPlayBack()); string poolID = iaasWindowsPoolFixture.PoolId; string jobID = "batchJob1"; string taskID = "Task1"; @@ -122,7 +122,7 @@ public async Task AddTaskCollection() public async Task TaskUpdate() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "TaskUpdate", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "TaskUpdate", isPlayBack()); string poolID = iaasWindowsPoolFixture.PoolId; string jobID = "batchJob1"; string taskID = "Task1"; @@ -183,7 +183,7 @@ public async Task TaskUpdate() public async Task TaskListSubTasks() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "TaskListSubTasks", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "TaskListSubTasks", isPlayBack()); string poolID = iaasWindowsPoolFixture.PoolId; string jobID = "batchJob1"; string taskID = "Task1"; @@ -239,7 +239,7 @@ public async Task TaskListSubTasks() public async Task TaskReactive() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "TaskReactive", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "TaskReactive", isPlayBack()); string poolID = iaasWindowsPoolFixture.PoolId; string jobID = "batchJob1"; string taskID = "Task1"; diff --git a/sdk/batch/Azure.Compute.Batch/tests/Integration/EndToEndIntegrationTests.cs b/sdk/batch/Azure.Compute.Batch/tests/Integration/EndToEndIntegrationTests.cs deleted file mode 100644 index 98dab379a717..000000000000 --- a/sdk/batch/Azure.Compute.Batch/tests/Integration/EndToEndIntegrationTests.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; -using Azure.Compute.Batch.Tests.Infrastructure; -using Azure.Core.TestFramework; -using NUnit.Framework; - -namespace Azure.Compute.Batch.Tests.Integration -{ - internal class EndToEndIntegrationTests : BatchLiveTestBase - { - public EndToEndIntegrationTests(bool isAsync) : base(isAsync) - { - } - - public EndToEndIntegrationTests(bool isAsync, RecordedTestMode? mode = null) : base(isAsync, mode) - { - } - } -} diff --git a/sdk/batch/Azure.Compute.Batch/tests/Integration/FileIntegrationTests.cs b/sdk/batch/Azure.Compute.Batch/tests/Integration/FileIntegrationTests.cs index b5ffdaccad11..665b92b2594f 100644 --- a/sdk/batch/Azure.Compute.Batch/tests/Integration/FileIntegrationTests.cs +++ b/sdk/batch/Azure.Compute.Batch/tests/Integration/FileIntegrationTests.cs @@ -39,7 +39,7 @@ public FileIntegrationTests(bool isAsync) : base(isAsync) public async Task GetTaskFile() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "GetTaskFile", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "GetTaskFile", isPlayBack()); string poolId = iaasWindowsPoolFixture.PoolId; string jobId = "batchJob1"; try @@ -65,7 +65,7 @@ public async Task GetTaskFile() BatchFileProperties batchFilePropertiesesponse = await client.GetTaskFilePropertiesAsync(jobId, t.Id, outputFileName); Assert.IsNotNull(batchFilePropertiesesponse); - Assert.IsNotEmpty(batchFilePropertiesesponse.BatchFileUrl); + Assert.IsNotEmpty(batchFilePropertiesesponse.FileUrl); BinaryData fileContents = await client.GetTaskFileAsync(jobId, t.Id, outputFileName); using (var reader = new StreamReader(fileContents.ToStream())) @@ -94,7 +94,7 @@ public async Task GetTaskFile() public async Task DeleteTaskFile() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "DeleteTaskFile", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "DeleteTaskFile", isPlayBack()); string poolId = iaasWindowsPoolFixture.PoolId; string jobId = "batchJob1"; string taskId = "batchTask1"; @@ -137,7 +137,7 @@ public async Task DeleteTaskFile() public async Task GetNodeFile() { var client = CreateBatchClient(); - IaasLinuxPoolFixture iaasWindowsPoolFixture = new IaasLinuxPoolFixture(client, "GetNodeFile", isPlayBack()); + WindowsPoolFixture iaasWindowsPoolFixture = new WindowsPoolFixture(client, "GetNodeFile", isPlayBack()); string poolId = iaasWindowsPoolFixture.PoolId; string jobId = "batchJob1"; string file = "workitems\\batchJob1\\job-1\\task-0\\stdout.txt"; @@ -160,7 +160,7 @@ public async Task GetNodeFile() { BatchFileProperties batchFileProperties = await client.GetNodeFilePropertiesAsync(poolId, item.Id, file); Assert.IsNotNull(batchFileProperties); - Assert.IsNotEmpty(batchFileProperties.BatchFileUrl); + Assert.IsNotEmpty(batchFileProperties.FileUrl); BinaryData fileContents = await client.GetNodeFileAsync(poolId, item.Id, file); using (var reader = new StreamReader(fileContents.ToStream())) diff --git a/sdk/batch/GlobalSuppressions.cs b/sdk/batch/GlobalSuppressions.cs deleted file mode 100644 index 6fbc274a95f6..000000000000 --- a/sdk/batch/GlobalSuppressions.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. - -using System.Diagnostics.CodeAnalysis; - -[assembly: SuppressMessage("Usage", "AZC0002:DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.", Justification = "", Scope = "namespaceanddescendants", Target = "~N:Azure.Compute.Batch")] -[assembly: SuppressMessage("Usage", "AZC0012:Avoid single word type names", Justification = "", Scope = "type", Target = "~T:Azure.Compute.Batch.Schedule")]