Skip to content

Commit 23e95a8

Browse files
authored
Fix live Key Vault tests (#24593)
* Fix live Key Vault tests The services for the attestation mock service container were conditioned, which required the `output` parameter to be conditioned and it wasn't. Initially testing locally with enableHsm=true so didn't catch it. * Ignore tests that unnecessary require Attestation Secure Key Release isn't yet supported on Key Vault, so ignore any tests that try to get this now-optional variable.
1 parent 509cdb9 commit 23e95a8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

sdk/keyvault/Azure.Security.KeyVault.Shared/tests/KeyVaultTestEnvironment.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ public class KeyVaultTestEnvironment : TestEnvironment
7575
/// <summary>
7676
/// Gets the value of the "AZURE_KEYVAULT_ATTESTATION_URL" variable.
7777
/// </summary>
78-
public Uri AttestationUri => new(GetRecordedVariable("AZURE_KEYVAULT_ATTESTATION_URL"), UriKind.Absolute);
78+
public Uri AttestationUri => Uri.TryCreate(GetRecordedOptionalVariable("AZURE_KEYVAULT_ATTESTATION_URL"), UriKind.Absolute, out Uri attestationUri)
79+
? attestationUri
80+
// BUGBUG: Make required when https://github.com/Azure/azure-sdk-for-net/issues/22750 is resolved.
81+
: throw new IgnoreException($"Required variable 'AZURE_KEYVAULT_ATTESTATION_URL' is not defined");
7982

8083
/// <summary>
8184
/// Throws an <see cref="IgnoreException"/> if <see cref="ManagedHsmUrl"/> is not defined.

sdk/keyvault/test-resources.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@
324324
},
325325
"AZURE_KEYVAULT_ATTESTATION_URL": {
326326
"type": "string",
327+
"condition": "[parameters('enableHsm')]",
327328
"value": "[format('https://{0}/', reference(variables('attestationSite')).defaultHostName)]"
328329
}
329330
}

0 commit comments

Comments
 (0)