Skip to content

Commit

Permalink
Run MHSM tests weekly, disable attestation in Canary (#36651)
Browse files Browse the repository at this point in the history
* Run MHSM tests weekly, disable attestation in Canary

* Fixed cspell issues.
  • Loading branch information
vcolin7 authored Sep 7, 2023
1 parent 3c084d3 commit 8d1552b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@
"sdk/identity/azure-identity/**",
"sdk/keyvault/azure-security-keyvault-administration/**",
"sdk/keyvault/azure-security-keyvault-certificates/**",
"sdk/keyvault/azure-security-test-keyvault-jca/**",
"sdk/keyvault/azure-security-keyvault-jca/**",
"sdk/keyvault/azure-security-keyvault-secrets/**",
"sdk/keyvault/azure-security-keyvault-keys/**",
"sdk/keyvault/azure-security-keyvault-secrets/**",
"sdk/keyvault/azure-security-test-keyvault-jca/**",
"sdk/keyvault/test-resources.json",
"sdk/formrecognizer/azure-ai-formrecognizer/**",
"sdk/core/azure-core/**",
"sdk/maps/azure-maps-render/**",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ public void listKeys(HttpClient httpClient, KeyServiceVersion serviceVersion) {
@MethodSource("getTestParameters")
public void releaseKey(HttpClient httpClient, KeyServiceVersion serviceVersion) {
// TODO: Remove assumption once Key Vault allows for creating exportable keys.
Assumptions.assumeTrue(runManagedHsmTest);
Assumptions.assumeTrue(runManagedHsmTest && runReleaseKeyTest);

createKeyAsyncClient(httpClient, serviceVersion);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ public void listKeyVersions(HttpClient httpClient, KeyServiceVersion serviceVers
@MethodSource("getTestParameters")
public void releaseKey(HttpClient httpClient, KeyServiceVersion serviceVersion) {
// TODO: Remove assumption once Key Vault allows for creating exportable keys.
Assumptions.assumeTrue(runManagedHsmTest);
Assumptions.assumeTrue(runManagedHsmTest && runReleaseKeyTest);

createKeyClient(httpClient, serviceVersion);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.azure.core.http.policy.RetryStrategy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.http.rest.Response;
import com.azure.core.test.TestMode;
import com.azure.core.test.TestProxyTestBase;
import com.azure.core.test.models.BodilessMatcher;
import com.azure.core.test.models.CustomMatcher;
Expand Down Expand Up @@ -79,6 +80,8 @@ public abstract class KeyClientTestBase extends TestProxyTestBase {

protected boolean isHsmEnabled = false;
protected boolean runManagedHsmTest = false;
protected boolean runReleaseKeyTest = getTestMode() == TestMode.PLAYBACK
|| Configuration.getGlobalConfiguration().get("AZURE_KEYVAULT_ATTESTATION_URL") != null;

@Override
protected String getTestName() {
Expand Down
5 changes: 4 additions & 1 deletion sdk/keyvault/platform-matrix.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"displayNames": {
"@{ enableAttestation = $true }": "",
"@{ enableAttestation = $false }": "NoAttestation",
"@{ enableHsm = $true }": "HSM"
},
"matrix": {
"$IMPORT": "eng/pipelines/templates/stages/platform-matrix.json"
"$IMPORT": "eng/pipelines/templates/stages/platform-matrix.json",
"ArmTemplateParameters": "@{ enableAttestation = $true }"
},
"exclude": [
{
Expand Down
10 changes: 10 additions & 0 deletions sdk/keyvault/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
"description": "The location of the Managed HSM. By default, this is 'northcentralus'."
}
},
"enableAttestation": {
"type": "bool",
"defaultValue": true,
"metadata": {
"description": "Whether to enable deployment of attestation resources. The default is true."
}
},
"enableHsm": {
"type": "bool",
"defaultValue": false,
Expand Down Expand Up @@ -405,6 +412,7 @@
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2020-12-01",
"name": "[variables('attestationFarm')]",
"condition": "[parameters('enableAttestation')]",
"location": "[parameters('location')]",
"kind": "linux",
"sku": {
Expand All @@ -418,6 +426,7 @@
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"name": "[variables('attestationSite')]",
"condition": "[parameters('enableAttestation')]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('attestationFarm'))]"
],
Expand Down Expand Up @@ -556,6 +565,7 @@
},
"AZURE_KEYVAULT_ATTESTATION_URL": {
"type": "string",
"condition": "[parameters('enableAttestation')]",
"value": "[format('https://{0}/', reference(variables('attestationSite')).defaultHostName)]"
},
"KEY_VAULT_ENDPOINT_SUFFIX": {
Expand Down
6 changes: 6 additions & 0 deletions sdk/keyvault/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ stages:
CloudConfig:
Public:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
${{ if not(contains(variables['Build.DefinitionName'], 'tests-weekly')) }}:
MatrixFilters:
- ArmTemplateParameters=^(?!.*enableHsm.*true)
UsGov:
SubscriptionConfiguration: $(sub-config-gov-test-resources)
MatrixFilters:
Expand All @@ -26,6 +29,9 @@ stages:
# Given test coverage of non-canary regions we probably don't need to test in canary.
MatrixFilters:
- ArmTemplateParameters=^(?!.*enableHsm.*true)
# Some resource providers required for attestation are not supported in canary.
MatrixReplace:
- 'ArmTemplateParameters=(.*)enableAttestation.*?\$true(.*)/$1enableAttestation \= $false$2'
MatrixConfigs:
- Name: Key_Vault_live_test
Path: sdk/keyvault/platform-matrix.json
Expand Down

0 comments on commit 8d1552b

Please sign in to comment.