Skip to content

Commit

Permalink
SDK generated from Swagger for Image Deprecation related changes (#32660
Browse files Browse the repository at this point in the history
)

* SDK generated from Swagger for Image Deprecation related changes

* Regenerated SDK for swagger changes

* Added tests for ImageDeprecationStatus
  • Loading branch information
RajalakshmiSwaminathan authored Jan 4, 2023
1 parent 13eaf90 commit 3336184
Show file tree
Hide file tree
Showing 8 changed files with 397 additions and 1 deletion.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,56 @@ public void TestVMImageListSkus()
Assert.True(skus.Count(sku => sku.Name == "2012-R2-Datacenter") != 0);
}
}

[Fact]
public void TestVMImage_ImageDeprecationStatusProperties_ActiveImage()
{
using (MockContext context = MockContext.Start(this.GetType()))
{
ComputeManagementClient _pirClient = ComputeManagementTestUtilities.GetComputeManagementClient(context,
new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK });

// Validate if images return correct ImageDeprecationStatus for Active images
string imagePublisher = "MicrosoftWindowsServer";
string imageOffer = "WindowsServer";
string imageSku = "2016-Datacenter";
string imageVersion = "14393.5501.221105";
var vmimage = _pirClient.VirtualMachineImages.Get(
ComputeManagementTestUtilities.DefaultLocation, imagePublisher, imageOffer, imageSku, imageVersion);
Assert.NotNull(vmimage.ImageDeprecationStatus);
Assert.True(vmimage.ImageDeprecationStatus.ImageState.Equals("Active"));
Assert.Null(vmimage.ImageDeprecationStatus.ScheduledDeprecationTime);
Assert.Null(vmimage.ImageDeprecationStatus.AlternativeOption);
}
}

[Fact]
public void TestVMImage_ImageDeprecationStatusProperties_ScheduledForDeprecationImage()
{
using (MockContext context = MockContext.Start(this.GetType()))
{
ComputeManagementClient _pirClient = ComputeManagementTestUtilities.GetComputeManagementClient(context,
new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK });

// Validate if images return correct ImageDeprecationStatus for ScheduledForDeprecation images
string imagePublisher = "MicrosoftWindowsDesktop";
string imageOffer = "Windows-10";
string imageSku = "20h2-pro-g2";
string imageVersion = "19042.1645.220403";
var vmimage = _pirClient.VirtualMachineImages.Get(
ComputeManagementTestUtilities.DefaultLocation, imagePublisher, imageOffer, imageSku, imageVersion);
Assert.NotNull(vmimage.ImageDeprecationStatus);
Assert.True(vmimage.ImageDeprecationStatus.ImageState.Equals("ScheduledForDeprecation"));
Assert.NotNull(vmimage.ImageDeprecationStatus.ScheduledDeprecationTime);

// Currently no public image has this optional field set.
if (vmimage.ImageDeprecationStatus.AlternativeOption != null)
{
Assert.NotNull(vmimage.ImageDeprecationStatus.AlternativeOption.Type);
Assert.NotNull(vmimage.ImageDeprecationStatus.AlternativeOption.Value);
}
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3336184

Please sign in to comment.