Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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

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 @@ -9,7 +9,7 @@
Provides developers with libraries for the updated compute platform under Azure Resource manager to deploy virtual machine, virtual machine extensions and availability set management capabilities. Launch, restart, scale, capture and manage VMs, VM Extensions and more. Note: This client library is for Virtual Machines under Azure Resource Manager.
Development of this library has shifted focus to the Azure Unified SDK. The future development will be focused on "Azure.ResourceManager.Compute" (https://www.nuget.org/packages/Azure.ResourceManager.Compute/). Please see the package changelog for more information.
</Description>
<Version>57.0.0</Version>
<Version>58.0.0</Version>
<AssemblyName>Microsoft.Azure.Management.Compute</AssemblyName>
<PackageTags>management;virtual machine;compute;</PackageTags>
<PackageReleaseNotes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void TestCapacityReservationOperations()
string originalTestLocation = Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION");
using (MockContext context = MockContext.Start(this.GetType()))
{
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", "eastus");
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", "eastus2euap");
EnsureClientsInitialized(context);

string baseRGName = ComputeManagementTestUtilities.GenerateName(TestPrefix);
Expand Down Expand Up @@ -51,8 +51,8 @@ public void TestCapacityReservationOperations()

//Create CapacityReservation within the CapacityReservationGroup and validate
var createdCR = CreateCapacityReservation(rgName, crgName, crName, "Standard_DS1_v2", availabilityZone: "1");
var returnedCR = m_CrpClient.CapacityReservations.Get(rgName, crgName, crName);
ValidateCapacityReservation(createdCR, returnedCR);
var returnedCRWithInstanceView = m_CrpClient.CapacityReservations.Get(rgName, crgName, crName, expand: "instanceView");
ValidateCapacityReservation(createdCR, returnedCRWithInstanceView, isInstanceViewIncluded : true);

//List CapacityReservations
var listCRsResponse = m_CrpClient.CapacityReservations.ListByCapacityReservationGroup(rgName, crgName);
Expand All @@ -78,7 +78,7 @@ public void TestNonZonalCapacityReservationGroupInstanceView()
string originalTestLocation = Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION");
using (MockContext context = MockContext.Start(this.GetType()))
{
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", "southcentralus");
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", "eastus2euap");
EnsureClientsInitialized(context);

string baseRGName = ComputeManagementTestUtilities.GenerateName(TestPrefix);
Expand All @@ -95,8 +95,8 @@ public void TestNonZonalCapacityReservationGroupInstanceView()

//Create CapacityReservation within the CapacityReservationGroup and validate
var createdCR = CreateCapacityReservation(rgName, crgName, crName, "Standard_DS1_v2");
var returnedCR = m_CrpClient.CapacityReservations.Get(rgName, crgName, crName);
ValidateCapacityReservation(createdCR, returnedCR);
var returnedCR = m_CrpClient.CapacityReservations.Get(rgName, crgName, crName, expand: "instanceView");
ValidateCapacityReservation(createdCR, returnedCR, isInstanceViewIncluded: true);

// Validate Capacity Reservation group instance view
CapacityReservationGroup returnedCRGWithInstanceView = m_CrpClient.CapacityReservationGroups.Get(rgName, crgName, CapacityReservationGroupInstanceViewTypes.InstanceView);
Expand Down Expand Up @@ -153,7 +153,7 @@ private void ValidateCapacityReservationGroupInstanceView(CapacityReservationGro
}
}

private void ValidateCapacityReservation(CapacityReservation expectedCR, CapacityReservation actualCR)
private void ValidateCapacityReservation(CapacityReservation expectedCR, CapacityReservation actualCR, bool isInstanceViewIncluded = false)
{
if (expectedCR == null)
{
Expand All @@ -176,7 +176,14 @@ private void ValidateCapacityReservation(CapacityReservation expectedCR, Capacit
Assert.Equal(expectedCR.ReservationId, actualCR.ReservationId);
Assert.NotNull(actualCR.Sku);
Assert.Equal(expectedCR.Sku.Name, actualCR.Sku.Name);
Assert.NotNull(actualCR.PlatformFaultDomainCount);
Assert.Equal(expectedCR.PlatformFaultDomainCount, actualCR.PlatformFaultDomainCount);
Assert.Equal(expectedCR.Sku.Capacity, actualCR.Sku.Capacity);
if(isInstanceViewIncluded)
{
Assert.NotNull(actualCR.InstanceView.UtilizationInfo.CurrentCapacity);
Assert.Equal(actualCR.Sku.Capacity, actualCR.InstanceView.UtilizationInfo.CurrentCapacity);
}
if (expectedCR.Zones != null)
{
Assert.Equal(1, actualCR.Zones.Count);
Expand Down
Loading