Skip to content

Commit

Permalink
Use the working directory to search for the root of the repo from.
Browse files Browse the repository at this point in the history
  • Loading branch information
billwert committed Sep 29, 2023
1 parent 18fa938 commit d50b0b7
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@
import java.time.Duration;
import java.util.Map;

import static com.azure.core.test.utils.TestUtils.toURI;

/**
* Manages running the test recording proxy server
*/
public final class TestProxyManager {
private static final ClientLogger LOGGER = new ClientLogger(TestProxyManager.class);
private static Process proxy;
private static final Path TEST_CLASS_PATH = Paths.get(toURI(TestProxyManager.class.getResource(TestProxyManager.class.getSimpleName() + ".class")));
private static final Path WORKING_DIRECTORY = Paths.get(System.getProperty("user.dir"));

static {
Runtime.getRuntime().addShutdownHook(new Thread(TestProxyManager::stopProxy));
if (runningLocally()) {
TestProxyDownloader.installTestProxy(TEST_CLASS_PATH);
TestProxyDownloader.installTestProxy(WORKING_DIRECTORY);
}
}

Expand All @@ -51,7 +49,7 @@ public static synchronized void startProxy() {

ProcessBuilder builder = new ProcessBuilder(commandLine,
"--storage-location",
TestUtils.getRepoRootResolveUntil(TEST_CLASS_PATH, "eng").toString());
TestUtils.getRepoRootResolveUntil(WORKING_DIRECTORY, "eng").toString());
Map<String, String> environment = builder.environment();
environment.put("LOGGING__LOGLEVEL", "Information");
environment.put("LOGGING__LOGLEVEL__MICROSOFT", "Warning");
Expand Down

0 comments on commit d50b0b7

Please sign in to comment.