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


##########
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:
   If they use different envvars, then the different tests are not stepping on 
each other's toes. Am I missing something?



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