diff options
| author | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
| commit | 0232b991cd7d8e3a2114ea30e4591dd3e7b65c36 (patch) | |
| tree | 94730e7594fd09ae1fa820391ce311f6daf13905 /src/zen-test/artifactprovider-tests.cpp | |
| parent | Fix forward declaration order for s_GotSigWinch and SigWinchHandler (diff) | |
| parent | trace: declare Region event name fields as AnsiString (#1012) (diff) | |
| download | archived-zen-sb/zen-help.tar.xz archived-zen-sb/zen-help.zip | |
Merge branch 'main' into sb/zen-helpsb/zen-help
- Combine HelpCommand (this branch) with HistoryCommand (main) in zen CLI dispatcher
- Keep filter-aware TuiPickOne rewrite; adopt main's ASCII arrow glyphs in doc comment
Diffstat (limited to 'src/zen-test/artifactprovider-tests.cpp')
| -rw-r--r-- | src/zen-test/artifactprovider-tests.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/zen-test/artifactprovider-tests.cpp b/src/zen-test/artifactprovider-tests.cpp new file mode 100644 index 000000000..48bbf8222 --- /dev/null +++ b/src/zen-test/artifactprovider-tests.cpp @@ -0,0 +1,66 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#include <zencore/zencore.h> + +#if ZEN_WITH_TESTS + +# include "zen-test.h" + +# include <zencore/filesystem.h> +# include <zencore/testing.h> +# include <zencore/testutils.h> +# include <zenutil/testartifactprovider.h> + +namespace zen::tests { + +namespace { + + // Returns "<unset>" when the variable is unset, the literal value otherwise. + std::string DescribeEnvVar(std::string_view Name) + { + const std::string Value = GetEnvVariable(Name); + return Value.empty() ? std::string("<unset>") : Value; + } + + // Same as DescribeEnvVar but redacts the value, since the variable may be a credential. + // Reports presence and length without revealing contents. + std::string DescribeSecretEnvVar(std::string_view Name) + { + const std::string Value = GetEnvVariable(Name); + return Value.empty() ? std::string("<unset>") : fmt::format("<set, {} chars>", Value.size()); + } + +} // namespace + +TEST_SUITE_BEGIN("zen.artifactprovider"); + +TEST_CASE("probe.s3_readme" * doctest::skip(!S3TestArtifactsAvailable())) +{ + // Use a fresh cache so Exists() is forced through to S3 rather than being satisfied + // by a README cached from a prior run. + ScopedTemporaryDirectory CacheDir; + TestArtifactProviderOptions Opts; + Opts.CacheDir = CacheDir.Path(); + Ref<TestArtifactProvider> Provider = CreateTestArtifactProvider(std::move(Opts)); + REQUIRE_MESSAGE(Provider, "no test artifact provider could be created on this platform"); + + constexpr std::string_view kArtifactPath = "README.md"; + const std::string Description = Provider->Describe(); + + ZEN_INFO("Provider: {}", Description); + ZEN_INFO("ZEN_TEST_ARTIFACTS_S3={}", DescribeEnvVar(kTestArtifactsS3EnvVar)); + ZEN_INFO("AWS_DEFAULT_REGION={}", DescribeEnvVar("AWS_DEFAULT_REGION")); + ZEN_INFO("AWS_REGION={}", DescribeEnvVar("AWS_REGION")); + ZEN_INFO("AWS_ENDPOINT_URL={}", DescribeEnvVar("AWS_ENDPOINT_URL")); + ZEN_INFO("AWS_ACCESS_KEY_ID={}", DescribeSecretEnvVar("AWS_ACCESS_KEY_ID")); + ZEN_INFO("AWS_SECRET_ACCESS_KEY={}", DescribeSecretEnvVar("AWS_SECRET_ACCESS_KEY")); + ZEN_INFO("AWS_SESSION_TOKEN={}", DescribeSecretEnvVar("AWS_SESSION_TOKEN")); + + CHECK_MESSAGE(Provider->Exists(kArtifactPath), "'" << kArtifactPath << "' not available via " << Description); +} + +TEST_SUITE_END(); + +} // namespace zen::tests + +#endif |