lordgamez commented on code in PR #2269:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2269#discussion_r4167186021
##########
libminifi/test/unit/EnvironmentUtilsTests.cpp:
##########
@@ -89,6 +90,16 @@ TEST_CASE("unsetenv existing", "[unsetenv]") {
REQUIRE(!utils::Environment::getEnvironmentVariable("UNSETENV2"));
}
+TEST_CASE("setenv and unsetenv are visible to getenv", "[setenv][unsetenv]") {
+ REQUIRE(true == utils::Environment::setEnvironmentVariable("GETENVSYNC",
"test"));
+ const char* const value = std::getenv("GETENVSYNC");
+ REQUIRE(value != nullptr);
+ CHECK(std::string{value} == "test");
+
+ REQUIRE(true == utils::Environment::unsetEnvironmentVariable("GETENVSYNC"));
+ CHECK(std::getenv("GETENVSYNC") == nullptr);
+}
+
Review Comment:
Catch2 doesn't run tests in parallel, so this test case runs independently
on a single thread. No multiple threads are present when `std::getenv` is
running, so this should not be a problem, or did you refer to something else?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]