diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-09-05 16:04:03 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-09-13 16:14:43 +0200 |
commit | 06dc6ae29ba045fe7336658f37f5dec22b466974 (patch) | |
tree | be5d4728c3766c66983f69552d3f83c37169b497 /test/utils/test_env.hpp | |
parent | c2f8ea128f162e6fcfeff5987287234a405968b8 (diff) | |
download | justbuild-06dc6ae29ba045fe7336658f37f5dec22b466974.tar.gz |
test: Add test environment running 'just serve'
Diffstat (limited to 'test/utils/test_env.hpp')
-rw-r--r-- | test/utils/test_env.hpp | 22 |
1 files changed, 22 insertions, 0 deletions
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<std::string> { + 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::filesystem::path> { + std::vector<std::filesystem::path> 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 |