aboutsummaryrefslogtreecommitdiff
path: root/cc/config
diff options
context:
space:
mode:
authorkste <kste@google.com>2021-06-16 07:06:38 -0700
committerCopybara-Service <copybara-worker@google.com>2021-06-16 07:07:24 -0700
commit51ae9cf72d1680abab8482ca33c636981994e8a1 (patch)
treeaceda5fe87b8f050b75df90c0284c28423485d2f /cc/config
parentec3d06a6e49d6190ec085ad632039829b57dc447 (diff)
downloadtink-51ae9cf72d1680abab8482ca33c636981994e8a1.tar.gz
Reset registry in FIPS tests for runtime tests.
This ensures the registry is empty for the runtime tests. Tests otherwise can fail depending on the order if they do not clean up the registry. PiperOrigin-RevId: 379712084
Diffstat (limited to 'cc/config')
-rw-r--r--cc/config/tink_fips_test.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/cc/config/tink_fips_test.cc b/cc/config/tink_fips_test.cc
index b611cb818..1780c26b4 100644
--- a/cc/config/tink_fips_test.cc
+++ b/cc/config/tink_fips_test.cc
@@ -68,6 +68,8 @@ TEST(TinkFipsTest, CompatibilityChecksWithBoringCrypto) {
GTEST_SKIP() << "Test only run if BoringCrypto module is available.";
}
+ Registry::Reset();
+
// Tink is not build in FIPS mode, but the FIPS mode is enabled at runtime.
EXPECT_THAT(crypto::tink::RestrictToFips(), IsOk());
@@ -80,6 +82,8 @@ TEST(TinkFipsTest, CompatibilityChecksWithBoringCrypto) {
EXPECT_THAT(
internal::CheckFipsCompatibility<FipsCompatibleWithBoringCrypto>(),
IsOk());
+
+ internal::UnSetFipsRestricted();
}
TEST(TinkFipsTest, CompatibilityChecksWithoutBoringCrypto) {
@@ -87,6 +91,8 @@ TEST(TinkFipsTest, CompatibilityChecksWithoutBoringCrypto) {
GTEST_SKIP() << "Test only run if BoringCrypto module is not available.";
}
+ Registry::Reset();
+
// Tink is not build in FIPS mode, but the FIPS mode is enabled at runtime.
EXPECT_THAT(crypto::tink::RestrictToFips(), IsOk());
@@ -100,6 +106,8 @@ TEST(TinkFipsTest, CompatibilityChecksWithoutBoringCrypto) {
EXPECT_THAT(
internal::CheckFipsCompatibility<FipsCompatibleWithBoringCrypto>(),
StatusIs(util::error::INTERNAL));
+
+ internal::UnSetFipsRestricted();
}
TEST(TinkFipsTest, FailIfRegistryNotEmpty) {