lordgamez commented on code in PR #2269:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2269#discussion_r4167087974


##########
libminifi/test/libtest/unit/TestUtils.h:
##########
@@ -69,6 +71,41 @@ std::string getFileContent(const std::filesystem::path& 
file_name);
 void makeFileOrDirectoryNotWritable(const std::filesystem::path& file_name);
 void makeFileOrDirectoryWritable(const std::filesystem::path& file_name);
 
+/**
+ * Sets an environment variable for the lifetime of the object, and restores 
its previous value (or unsets it, if it was
+ * not set before) on destruction. Pass std::nullopt as the value to make sure 
the variable is not set in the scope.
+ * Environment variables are process-global, so tests that rely on them need 
to clean up after themselves.

Review Comment:
   As multiple tests use different environment variables in a single test suite 
we need to clear them after each test case to cleanup between test cases not 
just at the end of the process.



-- 
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]

Reply via email to