Skip to content

Commit

Permalink
✅ added a test checking the env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
noyshabtay committed Dec 18, 2023
1 parent 0d5c568 commit 37329dc
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.Sets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.SystemUtils;
import org.jfrog.build.api.util.NullLog;
import org.jfrog.build.extractor.executor.CommandResults;
import org.testng.Assert;
Expand All @@ -13,6 +14,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -114,4 +116,22 @@ public void testGoGet() throws IOException {
FileUtils.deleteDirectory(projectDir);
}
}

private static String getPathEnv(Map<String, String> env) {
return env.get(SystemUtils.IS_OS_WINDOWS ? "Path" : "PATH");
}

@Test
public void testGoDriverInit() throws IOException {
File projectDir = Files.createTempDirectory("").toFile();
try {
if (SystemUtils.IS_OS_WINDOWS) {
Map<String, String> env = System.getenv();
new GoDriver("C:\\Program Files\\Go\\bin\\go", env, projectDir, new NullLog());
assertTrue(getPathEnv(env).contains("C:\\Program Files\\Go\\bin"));
}
} finally {
FileUtils.deleteDirectory(projectDir);
}
}
}

0 comments on commit 37329dc

Please sign in to comment.