diff --git a/completions/_hurl b/completions/_hurl index 9053043b0..aeda9e986 100644 --- a/completions/_hurl +++ b/completions/_hurl @@ -47,7 +47,6 @@ _hurl() { '--json[Output each Hurl file result to JSON]' \ '--max-redirs[Maximum number of redirects allowed, -1 for unlimited redirects]: :' \ '(-m --max-time)'{-m,--max-time}'[Maximum time allowed for the transfer]: :' \ - '--max-workers[(Experimental) Maximum number of parallel execution]: :' \ '(-n --netrc)'{-n,--netrc}'[Must read .netrc for username and password]' \ '--netrc-file[Specify FILE for .netrc]: :_files' \ '--netrc-optional[Use either .netrc or the URL]' \ @@ -74,6 +73,7 @@ _hurl() { '*--variables-file[Define a properties file in which you define your variables]: :_files' \ '(-v --verbose)'{-v,--verbose}'[Turn on verbose]' \ '--very-verbose[Turn on verbose output, including HTTP response and libcurl logs]' \ + '--workers[(Experimental) Maximum number of parallel execution]: :' \ '--help[Print help]' \ '--version[Print version]' \ '*:file:_files' \ diff --git a/completions/_hurl.ps1 b/completions/_hurl.ps1 index 2bdad8c90..bed340a7d 100644 --- a/completions/_hurl.ps1 +++ b/completions/_hurl.ps1 @@ -52,7 +52,6 @@ Register-ArgumentCompleter -Native -CommandName 'hurl' -ScriptBlock { [CompletionResult]::new('--json', 'json', [CompletionResultType]::ParameterName, 'Output each Hurl file result to JSON') [CompletionResult]::new('--max-redirs', 'max-redirs', [CompletionResultType]::ParameterName, 'Maximum number of redirects allowed, -1 for unlimited redirects') [CompletionResult]::new('--max-time', 'max-time', [CompletionResultType]::ParameterName, 'Maximum time allowed for the transfer') - [CompletionResult]::new('--max-workers', 'max-workers', [CompletionResultType]::ParameterName, '(Experimental) Maximum number of parallel execution') [CompletionResult]::new('--netrc', 'netrc', [CompletionResultType]::ParameterName, 'Must read .netrc for username and password') [CompletionResult]::new('--netrc-file', 'netrc-file', [CompletionResultType]::ParameterName, 'Specify FILE for .netrc') [CompletionResult]::new('--netrc-optional', 'netrc-optional', [CompletionResultType]::ParameterName, 'Use either .netrc or the URL') @@ -79,6 +78,7 @@ Register-ArgumentCompleter -Native -CommandName 'hurl' -ScriptBlock { [CompletionResult]::new('--variables-file', 'variables-file', [CompletionResultType]::ParameterName, 'Define a properties file in which you define your variables') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Turn on verbose') [CompletionResult]::new('--very-verbose', 'very-verbose', [CompletionResultType]::ParameterName, 'Turn on verbose output, including HTTP response and libcurl logs') + [CompletionResult]::new('--workers', 'workers', [CompletionResultType]::ParameterName, '(Experimental) Maximum number of parallel execution') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version') break diff --git a/completions/hurl.bash b/completions/hurl.bash index 01344ae1d..688238a02 100644 --- a/completions/hurl.bash +++ b/completions/hurl.bash @@ -5,7 +5,7 @@ _hurl() _init_completion || return if [[ $cur == -* ]]; then - COMPREPLY=($(compgen -W '--aws-sigv4 --cacert --cert --key --color --compressed --connect-timeout --connect-to --continue-on-error --cookie --cookie-jar --delay --error-format --fail-at-end --file-root --location --location-trusted --from-entry --glob --http1.0 --http1.1 --http2 --http3 --ignore-asserts --include --insecure --interactive --ipv4 --ipv6 --json --max-redirs --max-time --max-workers --netrc --netrc-file --netrc-optional --no-color --no-output --noproxy --output --parallel --path-as-is --proxy --report-html --report-junit --report-tap --resolve --retry --retry-interval --ssl-no-revoke --test --to-entry --unix-socket --user --user-agent --variable --variables-file --verbose --very-verbose --help --version' -- "$cur")) + COMPREPLY=($(compgen -W '--aws-sigv4 --cacert --cert --key --color --compressed --connect-timeout --connect-to --continue-on-error --cookie --cookie-jar --delay --error-format --fail-at-end --file-root --location --location-trusted --from-entry --glob --http1.0 --http1.1 --http2 --http3 --ignore-asserts --include --insecure --interactive --ipv4 --ipv6 --json --max-redirs --max-time --netrc --netrc-file --netrc-optional --no-color --no-output --noproxy --output --parallel --path-as-is --proxy --report-html --report-junit --report-tap --resolve --retry --retry-interval --ssl-no-revoke --test --to-entry --unix-socket --user --user-agent --variable --variables-file --verbose --very-verbose --workers --help --version' -- "$cur")) return fi diff --git a/completions/hurl.fish b/completions/hurl.fish index 917d6169f..89e006872 100644 --- a/completions/hurl.fish +++ b/completions/hurl.fish @@ -30,7 +30,6 @@ complete -c hurl -l ipv6 -d 'Tell Hurl to use IPv6 addresses only when resolving complete -c hurl -l json -d 'Output each Hurl file result to JSON' complete -c hurl -l max-redirs -d 'Maximum number of redirects allowed, -1 for unlimited redirects' complete -c hurl -l max-time -d 'Maximum time allowed for the transfer' -complete -c hurl -l max-workers -d '(Experimental) Maximum number of parallel execution' complete -c hurl -l netrc -d 'Must read .netrc for username and password' complete -c hurl -l netrc-file -d 'Specify FILE for .netrc' complete -c hurl -l netrc-optional -d 'Use either .netrc or the URL' @@ -57,6 +56,7 @@ complete -c hurl -l variable -d 'Define a variable' complete -c hurl -l variables-file -d 'Define a properties file in which you define your variables' complete -c hurl -l verbose -d 'Turn on verbose' complete -c hurl -l very-verbose -d 'Turn on verbose output, including HTTP response and libcurl logs' +complete -c hurl -l workers -d '(Experimental) Maximum number of parallel execution' complete -c hurl -l help -d 'Print help' complete -c hurl -l version -d 'Print version' diff --git a/docs/spec/options/hurl/max_workers.option b/docs/spec/options/hurl/workers.option similarity index 70% rename from docs/spec/options/hurl/max_workers.option rename to docs/spec/options/hurl/workers.option index 39a093e1d..699254350 100644 --- a/docs/spec/options/hurl/max_workers.option +++ b/docs/spec/options/hurl/workers.option @@ -1,12 +1,12 @@ -name: max_workers -long: max-workers +name: workers +long: workers value: NUM -value_default: 6 value_parser: clap::value_parser!(u32).range(1..) help: (Experimental) Maximum number of parallel execution cli_only: true experimental: true --- -(Experimental) Maximum number of parallel execution in parallel mode. +(Experimental) Maximum number of parallel execution in parallel mode. Default value corresponds (in most cases) to the +current amount of CPUs. See also [`--parallel`](#parallel). diff --git a/integration/hurl/tests_ok/parallel_one_worker.ps1 b/integration/hurl/tests_ok/parallel_one_worker.ps1 index 9af965204..7d32f5d17 100644 --- a/integration/hurl/tests_ok/parallel_one_worker.ps1 +++ b/integration/hurl/tests_ok/parallel_one_worker.ps1 @@ -1,7 +1,7 @@ Set-StrictMode -Version latest $ErrorActionPreference = 'Stop' -hurl --parallel --max-workers 1 ` +hurl --parallel --workers 1 ` tests_ok/parallel_a.hurl ` tests_ok/parallel_b.hurl ` tests_ok/parallel_c.hurl ` diff --git a/integration/hurl/tests_ok/parallel_one_worker.sh b/integration/hurl/tests_ok/parallel_one_worker.sh index d230c1eb9..c36cab706 100755 --- a/integration/hurl/tests_ok/parallel_one_worker.sh +++ b/integration/hurl/tests_ok/parallel_one_worker.sh @@ -1,7 +1,7 @@ #!/bin/bash set -Eeuo pipefail -hurl --parallel --max-workers 1 \ +hurl --parallel --workers 1 \ tests_ok/parallel_a.hurl \ tests_ok/parallel_b.hurl \ tests_ok/parallel_c.hurl \ diff --git a/packages/hurl/src/cli/options/commands.rs b/packages/hurl/src/cli/options/commands.rs index e820c0b98..8a56222c0 100644 --- a/packages/hurl/src/cli/options/commands.rs +++ b/packages/hurl/src/cli/options/commands.rs @@ -294,17 +294,6 @@ pub fn max_time() -> clap::Arg { .num_args(1) } -pub fn max_workers() -> clap::Arg { - clap::Arg::new("max_workers") - .long("max-workers") - .value_name("NUM") - .default_value("6") - .value_parser(clap::value_parser!(u32).range(1..)) - .help("(Experimental) Maximum number of parallel execution") - .num_args(1) - .hide(true) -} - pub fn netrc() -> clap::Arg { clap::Arg::new("netrc") .long("netrc") @@ -525,3 +514,13 @@ pub fn very_verbose() -> clap::Arg { .help("Turn on verbose output, including HTTP response and libcurl logs") .action(clap::ArgAction::SetTrue) } + +pub fn workers() -> clap::Arg { + clap::Arg::new("workers") + .long("workers") + .value_name("NUM") + .value_parser(clap::value_parser!(u32).range(1..)) + .help("(Experimental) Maximum number of parallel execution") + .num_args(1) + .hide(true) +} diff --git a/packages/hurl/src/cli/options/matches.rs b/packages/hurl/src/cli/options/matches.rs index fa240e383..6a39bd90e 100644 --- a/packages/hurl/src/cli/options/matches.rs +++ b/packages/hurl/src/cli/options/matches.rs @@ -250,8 +250,8 @@ pub fn max_redirect(arg_matches: &ArgMatches) -> Option { } } -pub fn max_workers(arg_matches: &ArgMatches) -> Option { - get::(arg_matches, "max_workers").map(|m| m as usize) +pub fn workers(arg_matches: &ArgMatches) -> Option { + get::(arg_matches, "workers").map(|m| m as usize) } pub fn netrc(arg_matches: &ArgMatches) -> bool { diff --git a/packages/hurl/src/cli/options/mod.rs b/packages/hurl/src/cli/options/mod.rs index c925ca34a..ce18b4205 100644 --- a/packages/hurl/src/cli/options/mod.rs +++ b/packages/hurl/src/cli/options/mod.rs @@ -67,7 +67,6 @@ pub struct CliOptions { pub ip_resolve: Option, pub junit_file: Option, pub max_redirect: Option, - pub max_workers: Option, pub netrc: bool, pub netrc_file: Option, pub netrc_optional: bool, @@ -92,6 +91,7 @@ pub struct CliOptions { pub variables: HashMap, pub verbose: bool, pub very_verbose: bool, + pub workers: Option, } #[derive(Copy, Clone, Debug, PartialEq, Eq)] @@ -192,7 +192,6 @@ pub fn parse() -> Result { .arg(commands::json()) .arg(commands::max_redirects()) .arg(commands::max_time()) - .arg(commands::max_workers()) .arg(commands::netrc()) .arg(commands::netrc_file()) .arg(commands::netrc_optional()) @@ -218,7 +217,8 @@ pub fn parse() -> Result { .arg(commands::variable()) .arg(commands::variables_file()) .arg(commands::verbose()) - .arg(commands::very_verbose()); + .arg(commands::very_verbose()) + .arg(commands::workers()); let arg_matches = command.try_get_matches_from_mut(env::args_os())?; let opts = parse_matches(&arg_matches)?; @@ -265,7 +265,6 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result Result Result Result Result, CliError> { - let workers_count = min(files.len(), max_workers); + let workers_count = min(files.len(), workers); let variables = &options.variables; let output_type = options .output_type