From 06dc6ae29ba045fe7336658f37f5dec22b466974 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Tue, 5 Sep 2023 16:04:03 +0200 Subject: test: Add test environment running 'just serve' --- test/utils/test_env.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/utils/test_env.hpp') diff --git a/test/utils/test_env.hpp b/test/utils/test_env.hpp index 7013d2ff..47396db2 100644 --- a/test/utils/test_env.hpp +++ b/test/utils/test_env.hpp @@ -54,6 +54,14 @@ static inline void ReadCompatibilityFromEnv() { : std::make_optional(std::string{execution_address}); } +[[nodiscard]] static inline auto ReadRemoteServeAddressFromEnv() + -> std::optional { + auto* serve_address = std::getenv("REMOTE_SERVE_ADDRESS"); + return serve_address == nullptr + ? std::nullopt + : std::make_optional(std::string{serve_address}); +} + [[nodiscard]] static inline auto ReadTLSAuthArgsFromEnv() -> bool { auto* ca_cert = std::getenv("TLS_CA_CERT"); auto* client_cert = std::getenv("TLS_CLIENT_CERT"); @@ -81,4 +89,18 @@ static inline void ReadCompatibilityFromEnv() { return true; } +[[nodiscard]] static inline auto ReadRemoteServeReposFromEnv() + -> std::vector { + std::vector repos{}; + auto* serve_repos = std::getenv("SERVE_REPOSITORIES"); + if (serve_repos not_eq nullptr) { + std::istringstream pss(std::string{serve_repos}); + std::string path; + while (std::getline(pss, path, ';')) { + repos.emplace_back(path); + } + } + return repos; +} + #endif // INCLUDED_SRC_TEST_UTILS_TEST_ENV_HPP -- cgit v1.2.3