Disable playback for several attestation tests that use JWTs (#5665)

* Disable playback tests on test that receive a JWT

* Reduced code coverage numbers due to disabled tests.
This commit is contained in:
Larry Osterman 2024-05-28 10:15:07 -07:00 committed by GitHub
parent ffbf094b89
commit 5b9ea47d6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 29 additions and 23 deletions

View File

@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "cpp",
"TagPrefix": "cpp/attestation",
"Tag": "cpp/attestation_6398169251"
"Tag": "cpp/attestation_f34b6b4684"
}

View File

@ -131,7 +131,7 @@ namespace Azure { namespace Security { namespace Attestation { namespace Test {
}
};
TEST_P(AttestationTests, SimpleAttest)
TEST_P(AttestationTests, SimpleAttest_LIVEONLY_)
{
auto client(CreateClient());
@ -150,7 +150,7 @@ namespace Azure { namespace Security { namespace Attestation { namespace Test {
}
}
TEST_P(AttestationTests, AttestWithRuntimeData)
TEST_P(AttestationTests, AttestWithRuntimeData_LIVEONLY_)
{
// Attestation clients don't need to be authenticated, but they can be.
auto client(CreateAuthenticatedClient());
@ -176,7 +176,7 @@ namespace Azure { namespace Security { namespace Attestation { namespace Test {
}
}
TEST_P(AttestationTests, AttestWithDraftPolicy)
TEST_P(AttestationTests, AttestWithDraftPolicy_LIVEONLY_)
{
// Attestation clients don't need to be authenticated, but they can be.
auto client(CreateAuthenticatedClient());
@ -254,7 +254,7 @@ issuancerules {
}
}
TEST_P(AttestationTests, AttestWithRuntimeDataJson)
TEST_P(AttestationTests, AttestWithRuntimeDataJson_LIVEONLY_)
{
auto client(CreateClient());
auto runtimeData = AttestationCollateral::RunTimeData();

View File

@ -157,15 +157,15 @@ namespace Azure { namespace Security { namespace Attestation { namespace Test {
// The GetIsolatedModeManagementCertificates API can be run against all instance types, but it
// only returns values on isolated instances (an isolated instance is defined to be an attestation
// service instance with policy management certificates).
TEST_F(CertificateTests, GetPolicyManagementCertificatesAad)
TEST_F(CertificateTests, GetPolicyManagementCertificatesAad_LIVEONLY_)
{
GetIsolatedModeCertificatesTest(ServiceInstanceType::AAD);
}
TEST_F(CertificateTests, GetPolicyManagementCertificatesIsolated)
TEST_F(CertificateTests, GetPolicyManagementCertificatesIsolated_LIVEONLY_)
{
GetIsolatedModeCertificatesTest(ServiceInstanceType::Isolated);
}
TEST_F(CertificateTests, GetPolicyManagementCertificatesShared)
TEST_F(CertificateTests, GetPolicyManagementCertificatesShared_LIVEONLY_)
{
GetIsolatedModeCertificatesTest(ServiceInstanceType::Shared);
}

View File

@ -353,7 +353,7 @@ namespace Azure { namespace Security { namespace Attestation { namespace Test {
}
}; // namespace Test
TEST_P(PolicyTests, PolicyTests)
TEST_P(PolicyTests, PolicyTests_LIVEONLY_)
{
switch (GetParam().TestType)
{

View File

@ -41,24 +41,30 @@ namespace Azure { namespace Security { namespace Attestation { namespace Test {
{
Azure::Core::Test::TestBase::SetUpTestBase(AZURE_TEST_RECORDING_DIR);
{
// TPM attestation requires a policy document be set. For simplicity, we only run the
// test against an AAD attestation service instance.
m_adminClient = std::make_unique<AttestationAdministrationClient>(
CreateAdminClient(InstanceType::AAD));
if (m_testContext.GetTestMode() != Azure::Core::Test::TestMode::PLAYBACK)
{
// TPM attestation requires a policy document be set. For simplicity, we only run the
// test against an AAD attestation service instance.
m_adminClient = std::make_unique<AttestationAdministrationClient>(
CreateAdminClient(InstanceType::AAD));
// Set a minimal policy, which will make the TPM attestation code happy.
m_adminClient->SetAttestationPolicy(
AttestationType::Tpm,
"version=1.0; authorizationrules{=> permit();}; issuancerules{};");
// Set a minimal policy, which will make the TPM attestation code happy.
m_adminClient->SetAttestationPolicy(
AttestationType::Tpm,
"version=1.0; authorizationrules{=> permit();}; issuancerules{};");
}
}
}
virtual void TearDown() override
{
// Reset the attestation policy for this instance back to the default.
if (m_adminClient)
if (m_testContext.GetTestMode() != Azure::Core::Test::TestMode::PLAYBACK)
{
m_adminClient->ResetAttestationPolicy(AttestationType::Tpm);
// Reset the attestation policy for this instance back to the default.
if (m_adminClient)
{
m_adminClient->ResetAttestationPolicy(AttestationType::Tpm);
}
}
// Make sure you call the base classes TearDown method to ensure recordings are made.
@ -120,7 +126,7 @@ namespace Azure { namespace Security { namespace Attestation { namespace Test {
}
};
TEST_F(TpmAttestationTests, AttestTpm)
TEST_F(TpmAttestationTests, AttestTpm_LIVEONLY_)
{
auto client(CreateClient(InstanceType::AAD));

View File

@ -30,8 +30,8 @@ extends:
Location: WestUS
CtestRegex: azure-security-attestation.*
LiveTestCtestRegex: azure-security-attestation.*
LineCoverageTarget: 89
BranchCoverageTarget: 42
LineCoverageTarget: 70
BranchCoverageTarget: 34
Artifacts:
- Name: azure-security-attestation
Path: azure-security-attestation