diff options
Diffstat (limited to 'vespa-feed-client-cli')
3 files changed, 10 insertions, 2 deletions
diff --git a/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliArguments.java b/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliArguments.java index a3e33699a4d..18c1c6a22fa 100644 --- a/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliArguments.java +++ b/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliArguments.java @@ -38,6 +38,7 @@ class CliArguments { private static final String CERTIFICATE_OPTION = "certificate"; private static final String CONNECTIONS_OPTION = "connections"; private static final String DISABLE_SSL_HOSTNAME_VERIFICATION_OPTION = "disable-ssl-hostname-verification"; + private static final String DRYRUN_OPTION = "dryrun"; private static final String ENDPOINT_OPTION = "endpoint"; private static final String FILE_OPTION = "file"; private static final String HEADER_OPTION = "header"; @@ -150,6 +151,8 @@ class CliArguments { boolean readFeedFromStandardInput() { return has(STDIN_OPTION); } + boolean dryrunEnabled() { return has(DRYRUN_OPTION); } + private OptionalInt intValue(String option) throws CliArgumentsException { try { Number number = (Number) arguments.getParsedOptionValue(option); @@ -272,6 +275,10 @@ class CliArguments { .build()) .addOption(Option.builder() .longOpt(VERBOSE_OPTION) + .build()) + .addOption(Option.builder() + .longOpt(DRYRUN_OPTION) + .desc("Enable dryrun mode where each operation succeeds after " + DryrunCluster.DELAY.toMillis() + "ms") .build()); } diff --git a/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliClient.java b/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliClient.java index 83abe0bb872..1c20f6b5c1b 100644 --- a/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliClient.java +++ b/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliClient.java @@ -11,11 +11,9 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.nio.file.Files; -import java.time.Duration; import java.util.Map; import java.util.Optional; import java.util.Properties; -import java.util.concurrent.atomic.AtomicInteger; /** * Main method for CLI interface @@ -86,6 +84,7 @@ public class CliClient { cliArgs.certificateAndKey().ifPresent(c -> builder.setCertificate(c.certificateFile, c.privateKeyFile)); cliArgs.caCertificates().ifPresent(builder::setCaCertificatesFile); cliArgs.headers().forEach(builder::addRequestHeader); + builder.setDryrun(cliArgs.dryrunEnabled()); return builder.build(); } diff --git a/vespa-feed-client-cli/src/test/resources/help.txt b/vespa-feed-client-cli/src/test/resources/help.txt index 1c537defb01..b5d59e02f7e 100644 --- a/vespa-feed-client-cli/src/test/resources/help.txt +++ b/vespa-feed-client-cli/src/test/resources/help.txt @@ -9,6 +9,8 @@ Vespa feed client connections --disable-ssl-hostname-verification Disable SSL hostname verification + --dryrun Enable dryrun mode where each + operation succeeds after 1ms --endpoint <arg> URI to feed endpoint --file <arg> Path to feed file in JSON format --header <arg> HTTP header on the form 'Name: |