martinzink commented on code in PR #1572:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1572#discussion_r1211837353


##########
extensions/gcp/tests/GCPCredentialsControllerServiceTests.cpp:
##########
@@ -79,7 +95,7 @@ class GCPCredentialsTests : public ::testing::Test {
 };
 
 TEST_F(GCPCredentialsTests, DefaultGCPCredentialsWithoutEnv) {
-  google::cloud::internal::UnsetEnv("GOOGLE_APPLICATION_CREDENTIALS");
+  unsetGoogleEnvironmentCredentials();

Review Comment:
   ```suggestion
     
org::apache::nifi::minifi::utils::Environment::unsetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS");
   ```



##########
extensions/gcp/tests/GCPCredentialsControllerServiceTests.cpp:
##########
@@ -89,7 +105,7 @@ TEST_F(GCPCredentialsTests, DefaultGCPCredentialsWithEnv) {
   auto temp_directory = test_controller_.createTempDirectory();
   auto path = create_mock_json_file(temp_directory);
   ASSERT_TRUE(path.has_value());
-  google::cloud::internal::SetEnv("GOOGLE_APPLICATION_CREDENTIALS", 
path->string());
+  setGoogleEnvironmentCredentials(path->string().c_str());

Review Comment:
   ```suggestion
     
org::apache::nifi::minifi::utils::Environment::setEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS",
 path->c_str());
   ```



##########
extensions/gcp/tests/GCPCredentialsControllerServiceTests.cpp:
##########
@@ -63,6 +63,22 @@ std::optional<std::filesystem::path> 
create_mock_json_file(const std::filesystem
   p.close();
   return path;
 }
+
+void setGoogleEnvironmentCredentials(char const* value) {
+#ifdef WIN32
+    _putenv_s("GOOGLE_APPLICATION_CREDENTIALS", value);
+#else
+  setenv("GOOGLE_APPLICATION_CREDENTIALS", value, 1);
+#endif
+}
+
+void unsetGoogleEnvironmentCredentials() {
+#ifdef _WIN32
+  (void)_putenv_s("GOOGLE_APPLICATION_CREDENTIALS", "");
+#else
+  unsetenv("GOOGLE_APPLICATION_CREDENTIALS");
+#endif
+}

Review Comment:
   ```suggestion
   ```



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