Skip to content

Commit

Permalink
Updating DiskRP API version to 2018-04-01 and adding zone resilient p…
Browse files Browse the repository at this point in the history
…roperty to image storage profile
  • Loading branch information
hyonholee committed Mar 14, 2018
1 parent 8e94ed2 commit f2b5f16
Show file tree
Hide file tree
Showing 48 changed files with 14,879 additions and 11,383 deletions.
2 changes: 1 addition & 1 deletion src/SDKs/Compute/AzSdk.RP.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--This file and it's contents are updated at build time moving or editing might result in build failure. Take due deligence while editing this file-->
<PropertyGroup>
<AzureApiTag>Compute_2017-12-01;Compute_2017-03-30;Compute_2017-09-01;ContainerService_2017-01-31;</AzureApiTag>
<AzureApiTag>Compute_2017-12-01;Compute_2018-04-01;Compute_2017-09-01;ContainerService_2017-01-31;</AzureApiTag>
<PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags>
</PropertyGroup>
</Project>
28 changes: 14 additions & 14 deletions src/SDKs/Compute/Compute.Tests/DiskRPTests/DiskRPTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class DiskRPTestsBase : VMTestBase
private string DiskRPLocation = ComputeManagementTestUtilities.DefaultLocation.ToLower();

#region Execution
protected void Disk_CRUD_Execute(DiskCreateOption diskCreateOption, string methodName, int? diskSizeGB = null, string location = null, IList<string> zones = null)
protected void Disk_CRUD_Execute(string diskCreateOption, string methodName, int? diskSizeGB = null, string location = null, IList<string> zones = null)
{
using (MockContext context = MockContext.Start(this.GetType().FullName, methodName))
{
Expand Down Expand Up @@ -103,7 +103,7 @@ protected void Disk_CRUD_Execute(DiskCreateOption diskCreateOption, string metho
}

}
protected void Snapshot_CRUD_Execute(DiskCreateOption diskCreateOption, string methodName, int? diskSizeGB = null, string location = null)
protected void Snapshot_CRUD_Execute(string diskCreateOption, string methodName, int? diskSizeGB = null, string location = null)
{
using (MockContext context = MockContext.Start(this.GetType().FullName, methodName))
{
Expand Down Expand Up @@ -186,7 +186,7 @@ protected void Snapshot_CRUD_Execute(DiskCreateOption diskCreateOption, string m
}

}
protected void Disk_List_Execute(DiskCreateOption diskCreateOption, string methodName, int? diskSizeGB = null)
protected void Disk_List_Execute(string diskCreateOption, string methodName, int? diskSizeGB = null)
{
using (MockContext context = MockContext.Start(this.GetType().FullName, methodName))
{
Expand Down Expand Up @@ -249,7 +249,7 @@ protected void Disk_List_Execute(DiskCreateOption diskCreateOption, string metho
}
}

protected void Snapshot_List_Execute(DiskCreateOption diskCreateOption, string methodName, int? diskSizeGB = null)
protected void Snapshot_List_Execute(string diskCreateOption, string methodName, int? diskSizeGB = null)
{
using (MockContext context = MockContext.Start(this.GetType().FullName, methodName))
{
Expand Down Expand Up @@ -282,7 +282,7 @@ protected void Snapshot_List_Execute(DiskCreateOption diskCreateOption, string m

// Generate 4 snapshots using disks info
Snapshot snapshot11 = GenerateDefaultSnapshot(diskOut11.Id);
Snapshot snapshot12 = GenerateDefaultSnapshot(diskOut12.Id);
Snapshot snapshot12 = GenerateDefaultSnapshot(diskOut12.Id, SnapshotStorageAccountTypes.StandardZRS);
Snapshot snapshot21 = GenerateDefaultSnapshot(diskOut21.Id);
Snapshot snapshot22 = GenerateDefaultSnapshot(diskOut22.Id);

Expand Down Expand Up @@ -328,7 +328,7 @@ protected void Snapshot_List_Execute(DiskCreateOption diskCreateOption, string m
#region Generation
public static readonly GrantAccessData AccessDataDefault = new GrantAccessData { Access = AccessLevel.Read, DurationInSeconds = 1000 };

protected Disk GenerateDefaultDisk(DiskCreateOption diskCreateOption, string rgName, int? diskSizeGB = null, IList<string> zones = null)
protected Disk GenerateDefaultDisk(string diskCreateOption, string rgName, int? diskSizeGB = null, IList<string> zones = null)
{
Disk disk;

Expand All @@ -355,7 +355,7 @@ protected Disk GenerateDefaultDisk(DiskCreateOption diskCreateOption, string rgN
/// Generates a disk used when the DiskCreateOption is Import
/// </summary>
/// <returns></returns>
private Disk GenerateImportDisk(DiskCreateOption diskCreateOption, string rgName)
private Disk GenerateImportDisk(string diskCreateOption, string rgName)
{
// Create a VM, so we can use its OS disk for creating the image
string storageAccountName = ComputeManagementTestUtilities.GenerateName(DiskNamePrefix);
Expand Down Expand Up @@ -383,7 +383,7 @@ private Disk GenerateImportDisk(DiskCreateOption diskCreateOption, string rgName
return disk;
}

private Disk GenerateBaseDisk(DiskCreateOption diskCreateOption)
private Disk GenerateBaseDisk(string diskCreateOption)
{
var disk = new Disk
{
Expand All @@ -397,26 +397,26 @@ private Disk GenerateBaseDisk(DiskCreateOption diskCreateOption)
{
CreateOption = diskCreateOption,
};
disk.OsType = OperatingSystemTypes.Windows;
disk.OsType = OperatingSystemTypes.Linux;

return disk;
}

protected Snapshot GenerateDefaultSnapshot(string sourceDiskId)
protected Snapshot GenerateDefaultSnapshot(string sourceDiskId, string snapshotStorageAccountTypes = SnapshotStorageAccountTypes.StandardLRS)
{
Snapshot snapshot = GenerateBaseSnapshot(sourceDiskId);
Snapshot snapshot = GenerateBaseSnapshot(sourceDiskId, snapshotStorageAccountTypes);
return snapshot;
}

private Snapshot GenerateBaseSnapshot(string sourceDiskId)
private Snapshot GenerateBaseSnapshot(string sourceDiskId, string snapshotStorageAccountTypes)
{
var snapshot = new Snapshot()
{
Location = DiskRPLocation
};
snapshot.Sku = new DiskSku()
snapshot.Sku = new SnapshotSku()
{
Name = StorageAccountTypes.StandardLRS
Name = snapshotStorageAccountTypes ?? SnapshotStorageAccountTypes.StandardLRS
};
snapshot.CreationData = new CreationData()
{
Expand Down
10 changes: 7 additions & 3 deletions src/SDKs/Compute/Compute.Tests/ScenarioTests/ImageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ public class ImageTests : VMTestBase
[Trait("Name", "TestImageOperations")]
public void TestImageOperations()
{
string originalTestLocation = Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION");
using (MockContext context = MockContext.Start(this.GetType().FullName))
{
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", "FranceCentral");
EnsureClientsInitialized(context);

// Create resource group
Expand Down Expand Up @@ -104,17 +106,16 @@ public void TestImageOperations()
BlobUri = createdVM.StorageProfile.OsDisk.Vhd.Uri,
OsState = OperatingSystemStateTypes.Generalized,
OsType = OperatingSystemTypes.Windows,
DiskSizeGB = createdVM.StorageProfile.OsDisk.DiskSizeGB
},
DataDisks = new List<ImageDataDisk>()
{
new ImageDataDisk()
{
BlobUri = createdVM.StorageProfile.DataDisks[0].Vhd.Uri,
Lun = createdVM.StorageProfile.DataDisks[0].Lun,
DiskSizeGB = createdVM.StorageProfile.DataDisks[0].DiskSizeGB
}
}
},
ZoneResilient = true
}
};

Expand All @@ -136,6 +137,7 @@ public void TestImageOperations()
}

m_ResourcesClient.ResourceGroups.Delete(rgName);
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", originalTestLocation);
}
}
}
Expand Down Expand Up @@ -178,6 +180,8 @@ void ValidateImage(Image imageIn, Image imageOut)
Assert.NotNull(dataDiskOut.DiskSizeGB);
}
}

Assert.Equal(imageIn.StorageProfile.ZoneResilient, imageOut.StorageProfile.ZoneResilient);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void TestVMScenarioOperations_ManagedDisks_PirImage_Zones()
}

private void TestVMScenarioOperationsInternal(string methodName, bool hasManagedDisks = false, IList<string> zones = null, string vmSize = VirtualMachineSizeTypes.StandardA0,
StorageAccountTypes storageAccountType = StorageAccountTypes.StandardLRS, bool? writeAcceleratorEnabled = null)
string storageAccountType = StorageAccountTypes.StandardLRS, bool? writeAcceleratorEnabled = null)
{
using (MockContext context = MockContext.Start(this.GetType().FullName, methodName))
{
Expand Down
6 changes: 3 additions & 3 deletions src/SDKs/Compute/Compute.Tests/ScenarioTests/VMTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected void EnsureClientsInitialized(MockContext context)
}
else
{
m_location = Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION").Replace(" ", "").ToLower();
m_location = Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION").Replace(" ", "");
}
}
}
Expand Down Expand Up @@ -210,7 +210,7 @@ protected VirtualMachine CreateVM(
bool waitForCompletion = true,
bool hasManagedDisks = false,
string vmSize = VirtualMachineSizeTypes.StandardA0,
StorageAccountTypes storageAccountType = StorageAccountTypes.StandardLRS,
string storageAccountType = StorageAccountTypes.StandardLRS,
bool? writeAcceleratorEnabled = null,
IList<string> zones = null)
{
Expand Down Expand Up @@ -731,7 +731,7 @@ protected string CreateAvailabilitySet(string rgName, string asName, bool hasMan
}

protected VirtualMachine CreateDefaultVMInput(string rgName, string storageAccountName, ImageReference imageRef, string asetId, string nicId, bool hasManagedDisks = false,
string vmSize = VirtualMachineSizeTypes.StandardA0, StorageAccountTypes storageAccountType = StorageAccountTypes.StandardLRS, bool? writeAcceleratorEnabled = null)
string vmSize = VirtualMachineSizeTypes.StandardA0, string storageAccountType = StorageAccountTypes.StandardLRS, bool? writeAcceleratorEnabled = null)
{
// Generate Container name to hold disk VHds
string containerName = ComputeManagementTestUtilities.GenerateName(TestPrefix);
Expand Down
Loading

0 comments on commit f2b5f16

Please sign in to comment.