Skip to content

Commit

Permalink
Trusted Launch Test (#18562)
Browse files Browse the repository at this point in the history
* Delete test json files (#18003)

* Delete TestVMExtensionOperations.json

* Delete TestVMScaleSetExtensions.json

* Resolve conflicts for -updated merge (#18015)

* Update SdkInfo_ComputeManagementClient.cs

* Update VirtualMachineRunCommandsOperations.cs

* Update VirtualMachineScaleSetVMRunCommandsOperations.cs

* Create TestVMExtensionOperations.json

* Delete TestVMExtensionOperations.json

* Create TestVMExtensionOperations.json

* Create TestVMScaleSetExtensions.json

* Compute 2020 12 updated (#17975)

* adding 2020-12-01 compute generated files

* update default sku

* update tests

* test updates

* records

* tests fixes

* all the recorded tests

* more update

* more update

* more update

* last test fixes

* Updated TestVMIdentitySystemAssignedUserAssigned SDK Test to create User Assigned Identity using SDK (#17861)

* Updated TestVMIdentitySystemAssignedUserAssigned SDK Test to create User Assigned MI using MSI SDK

* Resolved Merge Conflicts and updated the test

Co-authored-by: Pavan Rachapudy <vrachapu@microsoft.com>

* Delete AppGW tests (#17977)

* Delete VMScaleSetAppGwWithAS.json

* Delete VMScaleSetAppGwWithAS_A1V2.json

* Delete VMScaleSetAppGwWithAS_SPG_False.json

* Delete VMScaleSetAppGwWithAS_Spot.json

* Delete VMScaleSetAppGWTests.cs

* Delete deprecated ContainerService tests (#17976)

* Delete ContainerServiceOperationalTests.cs

* Delete ContainerServiceTestsBase.cs

* Delete ContainerServiceUpdateTests.cs

* Delete TestDCOSOperations.json

* Delete TestSwarmOperations.json

* Delete TestContainerServiceUpdateOperations.json

* test

* remove test text

Co-authored-by: pavanrachapudy <pavanrachapudy@gmail.com>
Co-authored-by: Pavan Rachapudy <vrachapu@microsoft.com>
Co-authored-by: Adam Sandor <adsandor@microsoft.com>

* new recording files

* 2020-12 release features generated, tests pass

* Update DiskRPTestsBase.cs (#18355)

* Remove CloudService tests (#18423)

* Delete CloudServiceExtensionTests.cs

* Delete CloudServiceOperationTests.cs

* Delete CloudServiceRoleInstanceTests.cs

* Delete CloudServiceScenarioTests.cs

* Delete CloudServiceTestsBase.cs

* Delete CloudServiceUpdateTests.cs

* Delete MultiRole_CreateUpdateGetAndDeleteWithExtension_WorkerAndWebRole.json

* Delete MultiRole_CreateUpdateGetAndDeleteWithExtension_WorkerAndWebRole_MultiRoleExtension.json

* Delete Test_Create_PowerOff_Start_CloudServiceOperation.json

* Delete Test_ListCloudServicesOperation.json

* Delete Test_CloudServiceRoleInstanceOperations.json

* Delete TestCloudServiceScenarioOperations.json

* Delete TestCloudServiceScenarioOperations_DeleteCloudService.json

* Delete TestCloudServiceScenarioOperations_ExtensionProfile.json

* Delete TestCloudServiceScenarioOperations_InstanceView.json

* Delete TestCloudServiceOperations_ScaleIn_ScaleOut.json

* Delete TestCloudServiceUpdateOperations.json

* Update AzSdk.RP.props

* Update AzSdk.RP.props

remove containerService

* Delete ServiceConfigurationHelpers.cs

* regenerate on released 2020-12-01 swagger

* re-recorded test jsons

* test fixes

* Update VMScenarioTests.cs

* Update VMTestBase.cs

* Create TestVMScenarioOperations_TrustedLaunch.json

* Update OrchestrationMode.cs

Co-authored-by: Theodore Chang <thchan@microsoft.com>
Co-authored-by: pavanrachapudy <pavanrachapudy@gmail.com>
Co-authored-by: Pavan Rachapudy <vrachapu@microsoft.com>
  • Loading branch information
4 people authored Mar 3, 2021
1 parent da9e91b commit 31e9a8c
Show file tree
Hide file tree
Showing 4 changed files with 1,776 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using Compute.Tests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,27 @@ public void TestVMScenarioOperations_EncryptionAtHost()
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", originalTestLocation);
}
}

/// <summary>
/// To record this test case, you need to run it in region which support Encryption at host
/// </summary>
[Fact]
[Trait("Name", "TestVMScenarioOperations_TrustedLaunch")]
public void TestVMScenarioOperations_TrustedLaunch()
{
string originalTestLocation = Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION");
try
{
ImageReference image = new ImageReference(publisher: "MicrosoftWindowsServer", offer: "windowsserver-gen2preview-preview", version: "18363.592.2001092016", sku: "windows10-tvm");
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", "eastus2euap");
TestVMScenarioOperationsInternal("TestVMScenarioOperations_TrustedLaunch", vmSize: VirtualMachineSizeTypes.StandardD2sV3, hasManagedDisks: true,
osDiskStorageAccountType: StorageAccountTypes.StandardSSDLRS, securityType: "TrustedLaunch", imageReference: image, validateListAvailableSize: false);
}
finally
{
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", originalTestLocation);
}
}

/// <summary>
/// To record this test case, you need to run it in region which support DiskEncryptionSet resource for the Disks
Expand Down Expand Up @@ -241,7 +262,7 @@ public void TestVMScenarioOperations_PpgScenario()
private void TestVMScenarioOperationsInternal(string methodName, bool hasManagedDisks = false, IList<string> zones = null, string vmSize = "Standard_A1_v2",
string osDiskStorageAccountType = "Standard_LRS", string dataDiskStorageAccountType = "Standard_LRS", bool? writeAcceleratorEnabled = null,
bool hasDiffDisks = false, bool callUpdateVM = false, bool isPpgScenario = false, string diskEncryptionSetId = null, bool? encryptionAtHostEnabled = null,
bool isAutomaticPlacementOnDedicatedHostGroupScenario = false, ImageReference imageReference = null, bool validateListAvailableSize = true)
string securityType = null, bool isAutomaticPlacementOnDedicatedHostGroupScenario = false, ImageReference imageReference = null, bool validateListAvailableSize = true)
{
using (MockContext context = MockContext.Start(this.GetType(), methodName))
{
Expand Down Expand Up @@ -280,7 +301,7 @@ private void TestVMScenarioOperationsInternal(string methodName, bool hasManaged

CreateVM(rgName, asName, storageAccountName, imageRef, out inputVM, hasManagedDisks: hasManagedDisks,hasDiffDisks: hasDiffDisks, vmSize: vmSize, osDiskStorageAccountType: osDiskStorageAccountType,
dataDiskStorageAccountType: dataDiskStorageAccountType, writeAcceleratorEnabled: writeAcceleratorEnabled, zones: zones, ppgName: ppgName,
diskEncryptionSetId: diskEncryptionSetId, encryptionAtHostEnabled: encryptionAtHostEnabled, dedicatedHostGroupReferenceId: dedicatedHostGroupReferenceId,
diskEncryptionSetId: diskEncryptionSetId, encryptionAtHostEnabled: encryptionAtHostEnabled, securityType: securityType, dedicatedHostGroupReferenceId: dedicatedHostGroupReferenceId,
dedicatedHostGroupName: dedicatedHostGroupName, dedicatedHostName: dedicatedHostName);

// Instance view is not completely populated just after VM is provisioned. So we wait here for a few minutes to
Expand Down Expand Up @@ -326,6 +347,12 @@ private void TestVMScenarioOperationsInternal(string methodName, bool hasManaged
listVMSizesResponse = m_CrpClient.AvailabilitySets.ListAvailableSizes(rgName, asName);
Helpers.ValidateVirtualMachineSizeListResponse(listVMSizesResponse, hasAZ: zones != null, writeAcceleratorEnabled: writeAcceleratorEnabled, hasDiffDisks: hasDiffDisks);
}

if(securityType != null && securityType.Equals("TrustedLaunch"))
{
Assert.True(inputVM.SecurityProfile.UefiSettings.VTpmEnabled);
Assert.True(inputVM.SecurityProfile.UefiSettings.SecureBootEnabled);
}

if(isPpgScenario)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ protected VirtualMachine CreateVM(
string ppgName = null,
string diskEncryptionSetId = null,
bool? encryptionAtHostEnabled = null,
string securityType = null,
string dedicatedHostGroupReferenceId = null,
string dedicatedHostGroupName = null,
string dedicatedHostName = null)
Expand Down Expand Up @@ -296,6 +297,30 @@ protected VirtualMachine CreateVM(
EncryptionAtHost = encryptionAtHostEnabled.Value
};
}

if (securityType != null && securityType.Equals("TrustedLaunch"))
{
if(inputVM.SecurityProfile != null)
{
inputVM.SecurityProfile.UefiSettings = new UefiSettings
{
VTpmEnabled = true,
SecureBootEnabled = true
};
}
else
{
inputVM.SecurityProfile = new SecurityProfile
{
UefiSettings = new UefiSettings
{
VTpmEnabled = true,
SecureBootEnabled = true
}
};
}

}

if (zones != null)
{
Expand Down
Loading

0 comments on commit 31e9a8c

Please sign in to comment.