Skip to content

Commit

Permalink
Merge pull request #5718 from ghubstan/pickup-core-bisq-properties
Browse files Browse the repository at this point in the history
Add custom bisq.properties to API test harness
  • Loading branch information
ripcurlx authored Sep 23, 2021
2 parents 1f75606 + 41f55b0 commit 4849988
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
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

0 comments on commit 4849988

Please sign in to comment.