Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom bisq.properties to API test harness #5718

Merged
merged 1 commit into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions apitest/src/main/java/bisq/apitest/Scaffold.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,25 +227,32 @@ public void installDaoSetupDirectories() {
throw new IllegalStateException("Could not install bitcoin regtest dir");

String aliceDataDir = daoSetupDir + "/" + alicedaemon.appName;
if (!config.callRateMeteringConfigPath.isEmpty()) {
installCallRateMeteringConfiguration(aliceDataDir);
}
installCallRateMeteringConfiguration(aliceDataDir);
BashCommand copyAliceDataDir = new BashCommand(
"cp -rf " + aliceDataDir + " " + config.rootAppDataDir);
if (copyAliceDataDir.run().getExitStatus() != 0)
throw new IllegalStateException("Could not install alice data dir");

String bobDataDir = daoSetupDir + "/" + bobdaemon.appName;
if (!config.callRateMeteringConfigPath.isEmpty()) {
installCallRateMeteringConfiguration(bobDataDir);
}
installCallRateMeteringConfiguration(bobDataDir);
BashCommand copyBobDataDir = new BashCommand(
"cp -rf " + bobDataDir + " " + config.rootAppDataDir);
if (copyBobDataDir.run().getExitStatus() != 0)
throw new IllegalStateException("Could not install bob data dir");

log.info("Copied all dao-setup files to {}", buildDataDir);

// Try to avoid confusion about which 'bisq.properties' file is or was loaded
// by a Bisq instance: delete the 'bisq.properties' file automatically copied
// to the 'apitest/build/resources/main' directory during IDE or Gradle build.
// Note: there is no way to prevent this deleted file from being re-copied
// from 'src/main/resources' to the buildDataDir each time you hit the build
// button in the IDE.
BashCommand rmRedundantBisqPropertiesFile =
new BashCommand("rm -rf " + buildDataDir + "/bisq.properties");
if (rmRedundantBisqPropertiesFile.run().getExitStatus() != 0)
throw new IllegalStateException("Could not delete redundant bisq.properties file");

// Copy the blocknotify script from the src resources dir to the build
// resources dir. Users may want to edit comment out some lines when all
// the default block notifcation ports being will not be used (to avoid
Expand Down Expand Up @@ -302,6 +309,9 @@ private void installBitcoinBlocknotify() {
}

private void installCallRateMeteringConfiguration(String dataDir) throws IOException, InterruptedException {
if (config.callRateMeteringConfigPath.isEmpty())
return;

File testRateMeteringFile = new File(config.callRateMeteringConfigPath);
if (!testRateMeteringFile.exists())
throw new FileNotFoundException(
Expand Down
7 changes: 7 additions & 0 deletions apitest/src/main/resources/bisq.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Bisq core properties file loaded by Bisq instances started by the test harness.
# Normally, it would be left empty, but it is useful for ad-hoc testing with
# Bisq Config options not configurable in test harness-specific apitest.properties
# file. This is where you might define Bisq options such as:
# dumpBlockchainData=true
# dumpDelayedPayoutTxs=true
# dumpStatistics=true