From 5fb67de531fead44123ff30ee5cf37340fc63a0b Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 12 Sep 2024 14:28:13 +0200 Subject: Use TestHashType in tests ...instead of calling ProtocolTraits::IsCompatible --- test/buildtool/execution_api/common/api_test.hpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'test/buildtool/execution_api/common/api_test.hpp') diff --git a/test/buildtool/execution_api/common/api_test.hpp b/test/buildtool/execution_api/common/api_test.hpp index 3c4052b3..4b84d66a 100644 --- a/test/buildtool/execution_api/common/api_test.hpp +++ b/test/buildtool/execution_api/common/api_test.hpp @@ -25,7 +25,6 @@ #include "catch2/catch_test_macros.hpp" #include "src/buildtool/common/artifact_description.hpp" #include "src/buildtool/common/artifact_digest_factory.hpp" -#include "src/buildtool/common/protocol_traits.hpp" #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/common/execution_action.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" @@ -34,6 +33,7 @@ #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" +#include "test/utils/hermeticity/test_hash_function_type.hpp" using ApiFactory = std::function; using ExecProps = std::map; @@ -140,9 +140,7 @@ using ExecProps = std::map; bool is_hermetic = false) { std::string test_content("test"); - HashFunction const hash_function{ProtocolTraits::Instance().IsCompatible() - ? HashFunction::Type::PlainSHA256 - : HashFunction::Type::GitSHA1}; + HashFunction const hash_function{TestHashType::ReadFromEnvironment()}; auto test_digest = ArtifactDigestFactory::HashDataAs( hash_function, test_content); @@ -224,9 +222,7 @@ using ExecProps = std::map; bool is_hermetic = false) { std::string test_content("test"); - HashFunction const hash_function{ProtocolTraits::Instance().IsCompatible() - ? HashFunction::Type::PlainSHA256 - : HashFunction::Type::GitSHA1}; + HashFunction const hash_function{TestHashType::ReadFromEnvironment()}; auto test_digest = ArtifactDigestFactory::HashDataAs( hash_function, test_content); @@ -315,9 +311,7 @@ using ExecProps = std::map; ExecProps const& props) { std::string test_content("test"); - HashFunction const hash_function{ProtocolTraits::Instance().IsCompatible() - ? HashFunction::Type::PlainSHA256 - : HashFunction::Type::GitSHA1}; + HashFunction const hash_function{TestHashType::ReadFromEnvironment()}; auto test_digest = ArtifactDigestFactory::HashDataAs( hash_function, test_content); -- cgit v1.2.3