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

Suspend instances in Apitest by CSV list in apitest.properties #6727

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
11 changes: 11 additions & 0 deletions apitest/src/main/java/bisq/apitest/config/ApiTestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public class ApiTestConfig {
static final String ENABLE_BISQ_DEBUGGING = "enableBisqDebugging";
static final String REGISTER_DISPUTE_AGENTS = "registerDisputeAgents";

static final String SUSPEND_INSTANCE = "suspendInstance";

// Default values for certain options
static final String DEFAULT_CONFIG_FILE_NAME = "apitest.properties";

Expand Down Expand Up @@ -126,6 +128,8 @@ public class ApiTestConfig {
public final String baseBuildResourcesDir;
public final String baseSrcResourcesDir;

public final String suspendedInstances;

// The parser that will be used to parse both cmd line and config file options
private final OptionParser parser = new OptionParser();

Expand Down Expand Up @@ -261,6 +265,12 @@ public ApiTestConfig(String... args) {
.withRequiredArg()
.ofType(Boolean.class)
.defaultsTo(true);

ArgumentAcceptingOptionSpec<String> suspendInstancesOpt =
parser.accepts(SUSPEND_INSTANCE, "Suspended the given instances when debugging")
.withRequiredArg()
.ofType(String.class)
.defaultsTo(EMPTY);
try {
CompositeOptionSet options = new CompositeOptionSet();

Expand Down Expand Up @@ -319,6 +329,7 @@ public ApiTestConfig(String... args) {
this.callRateMeteringConfigPath = options.valueOf(callRateMeteringConfigPathOpt);
this.enableBisqDebugging = options.valueOf(enableBisqDebuggingOpt);
this.registerDisputeAgents = options.valueOf(registerDisputeAgentsOpt);
this.suspendedInstances = options.valueOf(suspendInstancesOpt);

// Assign values to special-case static fields.
BASH_PATH_VALUE = bashPath;
Expand Down
6 changes: 4 additions & 2 deletions apitest/src/main/java/bisq/apitest/linux/BisqProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.IOException;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -66,8 +67,9 @@ public BisqProcess(BisqAppConfig bisqAppConfig, ApiTestConfig config) {
this.useDevPrivilegeKeys = true;
this.findBisqPidScript = (config.isRunningTest ? "." : "./apitest")
+ "/scripts/get-bisq-pid.sh";
this.debugOpts = config.enableBisqDebugging
? " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:" + bisqAppConfig.remoteDebugPort
this.debugOpts = config.enableBisqDebugging ? " -agentlib:jdwp=transport=dt_socket,server=y,"
+ "suspend=" + (Arrays.asList(config.suspendedInstances.split(",")).contains(bisqAppConfig.name()) ? "y" : "n")
+ ",address=*:" + bisqAppConfig.remoteDebugPort
: "";
}

Expand Down