diff options
author | prettyboy <prettyboy@yandex-team.com> | 2023-04-06 18:10:10 +0300 |
---|---|---|
committer | prettyboy <prettyboy@yandex-team.com> | 2023-04-06 18:10:10 +0300 |
commit | cf01db4c44585761db33d3f41fd3fe41a9acd70b (patch) | |
tree | e6cff885a2539e5918d897703a57b5b0bd87f9b8 /library/cpp/testing/common/env.cpp | |
parent | 208c5b52d89a6f0103b8b447cf2c9b6120cb772d (diff) | |
download | ydb-cf01db4c44585761db33d3f41fd3fe41a9acd70b.tar.gz |
[library/cpp/testing/common/ut/env] Added GetGlobalResource function to obtain global resources from context file
Diffstat (limited to 'library/cpp/testing/common/env.cpp')
-rw-r--r-- | library/cpp/testing/common/env.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/library/cpp/testing/common/env.cpp b/library/cpp/testing/common/env.cpp index fa3a47fe16b..77c6b0d90bc 100644 --- a/library/cpp/testing/common/env.cpp +++ b/library/cpp/testing/common/env.cpp @@ -107,6 +107,13 @@ const TString& GetTestParam(TStringBuf name, const TString& def) { return def; } +const TString& GetGlobalResource(TStringBuf name) { + auto& resources = NPrivate::GetTestEnv().GlobalResources; + auto it = resources.find(name.data()); + Y_VERIFY(it != resources.end()); + return it->second; +} + void AddEntryToCoreSearchFile(const TString& filename, TStringBuf cmd, int pid, const TFsPath& binaryPath = TFsPath(), const TFsPath& cwd = TFsPath()) { auto lock = TFileLock(filename); TGuard<TFileLock> guard(lock); @@ -164,6 +171,7 @@ namespace NPrivate { GdbPath = ""; CoreSearchFile = ""; TestParameters.clear(); + GlobalResources.clear(); const TString contextFilename = GetEnv("YA_TEST_CONTEXT_FILE"); if (contextFilename) { @@ -219,6 +227,13 @@ namespace NPrivate { } } + value = context.GetValueByPath("resources.global"); + if (value) { + for (const auto& entry : value->GetMap()) { + GlobalResources[entry.first] = entry.second.GetStringSafe(""); + } + } + value = context.GetValueByPath("internal.core_search_file"); if (value) { CoreSearchFile = value->GetStringSafe(""); |