diff --git a/.github/distro/benchmark.sh b/.github/distro/benchmark.sh index f2d32ce9..0d56dbac 100755 --- a/.github/distro/benchmark.sh +++ b/.github/distro/benchmark.sh @@ -29,7 +29,7 @@ if [[ $# != 2 ]]; then fi ITERATIONS=$1 -TEST_WILD=$2 +TEST_WILD="$2" BENCH_MAIN="io.deephaven.benchmark.run.BenchmarkMain" TEST_PACKAGE="io.deephaven.benchmark.tests.standard" @@ -43,19 +43,12 @@ sudo docker compose up -d sleep 5 set -f -TEST_REGEX="^.*[.](" -for r in $(echo "${TEST_WILD}" | sed 's/\s*,\s*/ /g'); do - TEST_REGEX="${TEST_REGEX}"$(echo "(${r}Test)|" | sed 's/\*/.*/g') -done -TEST_REGEX=$(echo ${TEST_REGEX} | sed -E 's/\|+$//g') -TEST_REGEX="${TEST_REGEX})$" - for i in `seq 1 ${ITERATIONS}` do echo "*** Starting Iteration: $i ***" -java -Dbenchmark.profile=benchmark.properties -cp "libs/*" ${BENCH_MAIN} -p ${TEST_PACKAGE} -n "${TEST_REGEX}" +java -Dbenchmark.profile=benchmark.properties -cp "libs/*" ${BENCH_MAIN} -p ${TEST_PACKAGE} -n "${TEST_WILD}" done diff --git a/.github/resources/adhoc-benchmark-docker-compose.yml b/.github/resources/adhoc-benchmark-docker-compose.yml index df0fccca..c02c30e3 100644 --- a/.github/resources/adhoc-benchmark-docker-compose.yml +++ b/.github/resources/adhoc-benchmark-docker-compose.yml @@ -25,7 +25,7 @@ services: - PLAINTEXT://redpanda:29092,OUTSIDE://localhost:9092 - --pandaproxy-addr 0.0.0.0:8082 - --advertise-pandaproxy-addr redpanda:8082 - image: redpandadata/redpanda:v25.1.2 + image: redpandadata/redpanda:v25.2.5 ports: - 8081:8081 - 8082:8082 @@ -33,7 +33,7 @@ services: - 29092:29092 minio-server: - image: minio/minio:RELEASE.2025-04-22T22-12-26Z + image: minio/minio:RELEASE.2025-09-07T16-13-09Z command: server /minio --console-address ":9001" hostname: minio environment: @@ -59,7 +59,7 @@ services: - ./minio:/minio minio-bucket: - image: minio/mc:RELEASE.2025-04-16T18-13-26Z + image: minio/mc:RELEASE.2025-08-13T08-35-41Z depends_on: - minio-server entrypoint: > diff --git a/.github/resources/compare-benchmark-docker-compose.yml b/.github/resources/compare-benchmark-docker-compose.yml index 5563fa6c..78b0e3ef 100644 --- a/.github/resources/compare-benchmark-docker-compose.yml +++ b/.github/resources/compare-benchmark-docker-compose.yml @@ -24,7 +24,7 @@ services: - PLAINTEXT://redpanda:29092,OUTSIDE://localhost:9092 - --pandaproxy-addr 0.0.0.0:8082 - --advertise-pandaproxy-addr redpanda:8082 - image: redpandadata/redpanda:v25.1.2 + image: redpandadata/redpanda:v25.2.5 ports: - 8081:8081 - 8082:8082 diff --git a/.github/resources/integration-docker-compose.yml b/.github/resources/integration-docker-compose.yml index 617224be..3ac20e76 100644 --- a/.github/resources/integration-docker-compose.yml +++ b/.github/resources/integration-docker-compose.yml @@ -24,7 +24,7 @@ services: - PLAINTEXT://redpanda:29092,OUTSIDE://localhost:9092 - --pandaproxy-addr 0.0.0.0:8082 - --advertise-pandaproxy-addr redpanda:8082 - image: redpandadata/redpanda:v25.1.2 + image: redpandadata/redpanda:v25.2.5 ports: - 8081:8081 - 8082:8082 diff --git a/.github/resources/nightly-benchmark-docker-compose.yml b/.github/resources/nightly-benchmark-docker-compose.yml index 9e6addf7..0e16bbfa 100644 --- a/.github/resources/nightly-benchmark-docker-compose.yml +++ b/.github/resources/nightly-benchmark-docker-compose.yml @@ -25,7 +25,7 @@ services: - PLAINTEXT://redpanda:29092,OUTSIDE://localhost:9092 - --pandaproxy-addr 0.0.0.0:8082 - --advertise-pandaproxy-addr redpanda:8082 - image: redpandadata/redpanda:v25.1.2 + image: redpandadata/redpanda:v25.2.5 ports: - 8081:8081 - 8082:8082 @@ -33,7 +33,7 @@ services: - 29092:29092 minio-server: - image: minio/minio:RELEASE.2025-04-22T22-12-26Z + image: minio/minio:RELEASE.2025-09-07T16-13-09Z command: server /minio --console-address ":9001" hostname: minio environment: @@ -59,7 +59,7 @@ services: - ./minio:/minio minio-bucket: - image: minio/mc:RELEASE.2025-04-16T18-13-26Z + image: minio/mc:RELEASE.2025-08-13T08-35-41Z depends_on: - minio-server entrypoint: > diff --git a/.github/resources/release-benchmark-docker-compose.yml b/.github/resources/release-benchmark-docker-compose.yml index 75f61567..ada9e5cd 100644 --- a/.github/resources/release-benchmark-docker-compose.yml +++ b/.github/resources/release-benchmark-docker-compose.yml @@ -25,7 +25,7 @@ services: - PLAINTEXT://redpanda:29092,OUTSIDE://localhost:9092 - --pandaproxy-addr 0.0.0.0:8082 - --advertise-pandaproxy-addr redpanda:8082 - image: redpandadata/redpanda:v25.1.2 + image: redpandadata/redpanda:v25.2.5 ports: - 8081:8081 - 8082:8082 @@ -33,7 +33,7 @@ services: - 29092:29092 minio-server: - image: minio/minio:RELEASE.2025-04-22T22-12-26Z + image: minio/minio:RELEASE.2025-09-07T16-13-09Z command: server /minio --console-address ":9001" hostname: minio environment: @@ -59,7 +59,7 @@ services: - ./minio:/minio minio-bucket: - image: minio/mc:RELEASE.2025-04-16T18-13-26Z + image: minio/mc:RELEASE.2025-08-13T08-35-41Z depends_on: - minio-server entrypoint: > diff --git a/.github/scripts/adhoc.sh b/.github/scripts/adhoc.sh index ba70960a..b9346cf1 100755 --- a/.github/scripts/adhoc.sh +++ b/.github/scripts/adhoc.sh @@ -57,22 +57,6 @@ if [[ ${ACTION} == "make-labels" ]]; then echo "SET_LABEL_2=${LABEL2}" | tee -a ${OUTPUT_NAME} fi -# Make a regex from a list of wilcarded test class names -if [[ ${ACTION} == "make-test-regex" ]]; then - WILDCARDS=$2 - echo "Making Test Regex: ${WILDCARDS}" - - TEST_REGEX="^.*[.](" - for r in $(echo ${WILDCARDS} | sed 's/\s*,\s*/ /g'); do - TEST_REGEX="${TEST_REGEX}"$(echo "(${r}Test)|" | sed 's/\*/.*/g') - done - TEST_REGEX=$(echo ${TEST_REGEX} | sed -E 's/\|+$//g') - TEST_REGEX="${TEST_REGEX})$" - - echo "WILDCARDS=${WILDCARDS}" | tee -a ${OUTPUT_NAME} - echo "TEST_CLASS_REGEX=${TEST_REGEX}" | tee -a ${OUTPUT_NAME} -fi - # Format some number used for scaling the tests if [[ ${ACTION} == "scale-nums" ]]; then INPUT_ROW_COUNT=$2 diff --git a/.github/scripts/run-benchmarks-remote.sh b/.github/scripts/run-benchmarks-remote.sh index 01527ed8..cf8ec37f 100755 --- a/.github/scripts/run-benchmarks-remote.sh +++ b/.github/scripts/run-benchmarks-remote.sh @@ -3,6 +3,7 @@ set -o errexit set -o pipefail set -o nounset +set -f # Copyright (c) 2023-2024 Deephaven Data Labs and Patent Pending @@ -13,7 +14,7 @@ set -o nounset # Note: Assumes the deephaven-benchmark-*.jar artifact has been built and placed if [[ $# != 6 ]]; then - echo "$0: Missing run type, test package, test regex, row count, distribution, or tag name" + echo "$0: Missing run type, test package, test classes, row count, distribution, or tag name" exit 1 fi @@ -39,9 +40,11 @@ title "- Running Remote Benchmark Artifact on ${HOST} -" cd ${DEEPHAVEN_DIR}; title "-- Running Benchmarks --" +set +f cd ${RUN_DIR} cat ${RUN_TYPE}-scale-benchmark.properties | sed 's|${baseRowCount}|'"${ROW_COUNT}|g" | sed 's|${baseDistrib}|'"${DISTRIB}|g" > scale-benchmark.properties -JAVA_OPTS="-Dbenchmark.profile=scale-benchmark.properties -jar deephaven-benchmark-*-standalone.jar -cp standard-tests.jar" +JAVA_OPTS=$(echo -Dbenchmark.profile=scale-benchmark.properties -jar deephaven-benchmark-*-standalone.jar -cp standard-tests.jar) +set -f if [ "${TAG_NAME}" = "Any" ]; then java ${JAVA_OPTS} -p ${TEST_PACKAGE} -n "${TEST_PATTERN}" diff --git a/.github/scripts/run-ssh-local.sh b/.github/scripts/run-ssh-local.sh index e82fe24d..2e3577ba 100755 --- a/.github/scripts/run-ssh-local.sh +++ b/.github/scripts/run-ssh-local.sh @@ -3,6 +3,7 @@ set -o errexit set -o pipefail set -o nounset +set -f # Copyright (c) 2023-2024 Deephaven Data Labs and Patent Pending @@ -11,8 +12,8 @@ set -o nounset # remote scripts in single-quotes to avoid syntax errors. if [[ $# -lt 4 ]]; then - echo "$0: Missing host, user, script dir, or script name argument" - exit 1 + echo "$0: Missing host, user, script dir, or script name argument" + exit 1 fi HOST=$1 @@ -25,4 +26,4 @@ for i in ${@:5}; do args+=("'"$i"'") done -ssh -o 'ServerAliveInterval 60' ${USER}@${HOST} 'bash -s' "${args[*]}" < ${SCRIPT_DIR}/${SCRIPT_NAME}.sh |& tee logs/${SCRIPT_NAME}.log +ssh -o 'ServerAliveInterval 60' ${USER}@${HOST} 'bash -s' -- "${args[@]}" < ${SCRIPT_DIR}/${SCRIPT_NAME}.sh |& tee logs/${SCRIPT_NAME}.log diff --git a/.github/workflows/adhoc-auto-remote-benchmarks.yml b/.github/workflows/adhoc-auto-remote-benchmarks.yml index b9a46a5c..2115786b 100644 --- a/.github/workflows/adhoc-auto-remote-benchmarks.yml +++ b/.github/workflows/adhoc-auto-remote-benchmarks.yml @@ -58,7 +58,6 @@ jobs: outputs: set_label_1: ${{ steps.make-labels.outputs.SET_LABEL_1 }} set_label_2: ${{ steps.make-labels.outputs.SET_LABEL_2 }} - test_class_regex: "${{ steps.make-test-regex.outputs.TEST_CLASS_REGEX }}" metal_device_id: ${{ steps.deploy-metal.outputs.DEVICE_ID }} metal_device_name: ${{ steps.deploy-metal.outputs.DEVICE_NAME }} metal_ip_addr: ${{ steps.deploy-metal.outputs.DEVICE_ADDR }} @@ -80,12 +79,6 @@ jobs: ${SD}/adhoc.sh make-labels ${{ inputs.set_label_prefix }} ${{ inputs.docker_image_1 }} ${{ inputs.docker_image_2 }} cat adhoc-make-labels.out >> "$GITHUB_OUTPUT" - - name: Make Wildcard Regex - id: make-test-regex - run: | - ${SD}/adhoc.sh make-test-regex "${{ inputs.test_class_list }}" - cat adhoc-make-test-regex.out >> "$GITHUB_OUTPUT" - - name: Scale Input Numbers id: scale-nums run: | @@ -114,7 +107,7 @@ jobs: docker_image: ${{ inputs.docker_image_1 }} run_label: ${{ needs.setup-benchmark-system.outputs.set_label_1 }} test_package: "io.deephaven.benchmark.tests.standard" - test_class_regex: "${{ needs.setup-benchmark-system.outputs.test_class_regex }}" + test_class_list: "${{ inputs.test_class_list }}" test_iterations: ${{ needs.setup-benchmark-system.outputs.test_iterations }} scale_row_count: ${{ needs.setup-benchmark-system.outputs.test_row_count }} distribution: ${{ inputs.distribution }} @@ -130,7 +123,7 @@ jobs: docker_image: ${{ inputs.docker_image_2 }} run_label: ${{ needs.setup-benchmark-system.outputs.set_label_2 }} test_package: "io.deephaven.benchmark.tests.standard" - test_class_regex: "${{ needs.setup-benchmark-system.outputs.test_class_regex }}" + test_class_list: "${{ inputs.test_class_list }}" test_iterations: ${{ needs.setup-benchmark-system.outputs.test_iterations }} scale_row_count: ${{ needs.setup-benchmark-system.outputs.test_row_count }} distribution: ${{ inputs.distribution }} diff --git a/.github/workflows/adhoc-exist-remote-benchmarks.yml b/.github/workflows/adhoc-exist-remote-benchmarks.yml index 168e1b2e..a6d3f495 100644 --- a/.github/workflows/adhoc-exist-remote-benchmarks.yml +++ b/.github/workflows/adhoc-exist-remote-benchmarks.yml @@ -58,7 +58,6 @@ jobs: setup-benchmark-system: runs-on: ubuntu-22.04 outputs: - test_class_regex: "${{ steps.make-test-regex.outputs.TEST_CLASS_REGEX }}" test_row_count: ${{ steps.scale-nums.outputs.TEST_ROW_COUNT }} test_iterations: ${{ steps.scale-nums.outputs.TEST_ITERATIONS }} env: @@ -66,12 +65,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Make Wildcard Regex - id: make-test-regex - run: | - ${SD}/adhoc.sh make-test-regex "${{ inputs.test_class_list }}" - cat adhoc-make-test-regex.out >> "$GITHUB_OUTPUT" - - name: Scale Input Numbers id: scale-nums run: | @@ -86,7 +79,7 @@ jobs: docker_image: ${{ inputs.docker_image }} run_label: ${{ inputs.run_label }} test_package: ${{ inputs.test_package }} - test_class_regex: "${{ needs.setup-benchmark-system.outputs.test_class_regex }}" + test_class_list: "${{ inputs.test_class_list }}" test_iterations: ${{ needs.setup-benchmark-system.outputs.test_iterations }} scale_row_count: ${{ needs.setup-benchmark-system.outputs.test_row_count }} distribution: ${{ inputs.distribution }} diff --git a/.github/workflows/compare-remote-benchmarks.yml b/.github/workflows/compare-remote-benchmarks.yml index 7b8306d3..0bd95d6d 100644 --- a/.github/workflows/compare-remote-benchmarks.yml +++ b/.github/workflows/compare-remote-benchmarks.yml @@ -24,7 +24,7 @@ jobs: docker_image: ${{ inputs.docker_image }} run_label: "" test_package: "io.deephaven.benchmark.tests.compare" - test_class_regex: "^(Test.*|.+[.$]Test.*|.*Tests?)$" + test_class_list: "*" test_iterations: 5 scale_row_count: 70000000 distribution: random diff --git a/.github/workflows/nightly-remote-benchmarks.yml b/.github/workflows/nightly-remote-benchmarks.yml index 2178418b..74c6f906 100644 --- a/.github/workflows/nightly-remote-benchmarks.yml +++ b/.github/workflows/nightly-remote-benchmarks.yml @@ -18,7 +18,7 @@ jobs: docker_image: edge run_label: "" test_package: "io.deephaven.benchmark.tests.standard" - test_class_regex: "^(Test.*|.+[.$]Test.*|.*Tests?)$" + test_class_list: "*" test_iterations: 5 scale_row_count: 10000000 distribution: random diff --git a/.github/workflows/release-remote-benchmarks.yml b/.github/workflows/release-remote-benchmarks.yml index 72f04502..f6a76f54 100644 --- a/.github/workflows/release-remote-benchmarks.yml +++ b/.github/workflows/release-remote-benchmarks.yml @@ -23,7 +23,7 @@ jobs: docker_image: ${{ inputs.docker_image }} run_label: "" test_package: "io.deephaven.benchmark.tests.standard" - test_class_regex: "^(Test.*|.+[.$]Test.*|.*Tests?)$" + test_class_list: "*" test_iterations: 5 scale_row_count: 10000000 distribution: random diff --git a/.github/workflows/remote-benchmarks.yml b/.github/workflows/remote-benchmarks.yml index 564aa8e4..e50b02db 100644 --- a/.github/workflows/remote-benchmarks.yml +++ b/.github/workflows/remote-benchmarks.yml @@ -22,7 +22,7 @@ on: test_package: required: true type: string - test_class_regex: + test_class_list: required: true type: string test_iterations: @@ -115,7 +115,7 @@ jobs: USER: ${{secrets.BENCHMARK_USER}} RUN_TYPE: ${{inputs.run_type}} TEST_PKG: ${{inputs.test_package}} - TEST_RGX: "${{inputs.test_class_regex}}" + TEST_CLS: "${{inputs.test_class_list}}" ROW_CNT: ${{inputs.scale_row_count}} DISTRIB: ${{inputs.distribution}} @@ -129,7 +129,7 @@ jobs: - name: Run Remote Benchmarks run: | - ${SD}/run-ssh-local.sh ${HOST} ${USER} ${SD} run-benchmarks-remote ${RUN_TYPE} "${TEST_PKG}" "${TEST_RGX}" ${ROW_CNT} ${DISTRIB} ${{ matrix.tag }} + ${SD}/run-ssh-local.sh ${HOST} ${USER} ${SD} run-benchmarks-remote ${RUN_TYPE} "${TEST_PKG}" "'"${TEST_CLS}"'" ${ROW_CNT} ${DISTRIB} ${{ matrix.tag }} report-benchmarks: needs: run-benchmarks diff --git a/pom.xml b/pom.xml index 3065a99e..b7bfe967 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.6.0 + 3.6.1 add-test-source @@ -85,7 +85,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.6.0 + 3.6.1 package @@ -146,7 +146,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.11.2 + 3.12.0 *.connect,*.controller,*.generator,*.jfr,*.metric,*.run,*.util public @@ -167,7 +167,7 @@ 'core.autocrlf' to true --> com.diffplug.spotless spotless-maven-plugin - 2.44.3 + 2.46.1 @@ -203,7 +203,7 @@ org.junit.jupiter junit-jupiter-engine - 5.9.3 + 5.10.5 @@ -221,7 +221,7 @@ org.junit.jupiter junit-jupiter-engine - 5.9.3 + 5.10.5 @@ -264,27 +264,27 @@ io.confluent kafka-avro-serializer - 7.9.0 + 7.9.2 io.confluent kafka-protobuf-serializer - 7.9.0 + 7.9.2 io.deephaven deephaven-java-client-barrage-dagger - 0.38.0 + 0.40.1 io.deephaven deephaven-log-to-slf4j - 0.38.0 + 0.40.1 org.junit.platform junit-platform-console-standalone - 1.9.2 + 1.9.3 diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/StandardTestRunner.java b/src/it/java/io/deephaven/benchmark/tests/standard/StandardTestRunner.java index b50c292a..cb7c03ea 100644 --- a/src/it/java/io/deephaven/benchmark/tests/standard/StandardTestRunner.java +++ b/src/it/java/io/deephaven/benchmark/tests/standard/StandardTestRunner.java @@ -369,7 +369,7 @@ void initialize(Object testInst) { var query = """ import time, jpy from deephaven import new_table, empty_table, garbage_collect, merge - from deephaven.column import long_col, double_col + from deephaven.column import long_col, double_col, int_col from deephaven.parquet import read from numpy import typing as npt import numpy as np diff --git a/src/main/java/io/deephaven/benchmark/run/BenchmarkMain.java b/src/main/java/io/deephaven/benchmark/run/BenchmarkMain.java index 1c79b22d..75360924 100644 --- a/src/main/java/io/deephaven/benchmark/run/BenchmarkMain.java +++ b/src/main/java/io/deephaven/benchmark/run/BenchmarkMain.java @@ -33,6 +33,7 @@ static int main1(String[] args) { if (args.length > 0 && args[0].equals("publish")) return publish(Bench.rootOutputDir); + args = ConsoleLauncherUtil.formatConsoleWildcards(args); int exitCode = ConsoleLauncher.execute(System.out, System.err, args).getExitCode(); if (exitCode == 0) { Path d = Bench.rootOutputDir; diff --git a/src/main/java/io/deephaven/benchmark/run/ConsoleLauncherUtil.java b/src/main/java/io/deephaven/benchmark/run/ConsoleLauncherUtil.java new file mode 100644 index 00000000..d4dbbc19 --- /dev/null +++ b/src/main/java/io/deephaven/benchmark/run/ConsoleLauncherUtil.java @@ -0,0 +1,38 @@ +/* Copyright (c) 2022-2025 Deephaven Data Labs and Patent Pending */ +package io.deephaven.benchmark.run; + +import java.util.Arrays; +import java.util.stream.Collectors; + +/** + * Utility methods for working with the JUnit Console Launcher + */ +public class ConsoleLauncherUtil { + + /** + * Format console launcher args to expand wildcard test patterns to regular expressions. This is not intended to + * cover every wildcard that can be passed to the Console Launcher, just the ones used by the Benchmark scripts. + * + * @param args console launcher args + * @return formatted console launcher args + */ + public static String[] formatConsoleWildcards(String[] args) { + if (args.length == 0) + return args; + var newArgs = Arrays.copyOf(args, args.length); + for (int i = 0, n = newArgs.length - 1; i < n; i++) { + if (!newArgs[i].equals("-n")) + continue; + int p = i + 1; + newArgs[p] = "^.*[.]" + formatRegex(newArgs[p]) + "Test.*$"; + } + return newArgs; + } + + static String formatRegex(String wildcardList) { + var r = Arrays.stream(wildcardList.split("\\s*[,]\\s*")).map(w -> w.replace("*", ".*")) + .collect(Collectors.joining("|")); + return "(" + r + ")"; + } + +} diff --git a/src/test/java/io/deephaven/benchmark/run/ConsoleLauncherUtilTest.java b/src/test/java/io/deephaven/benchmark/run/ConsoleLauncherUtilTest.java new file mode 100644 index 00000000..a889c584 --- /dev/null +++ b/src/test/java/io/deephaven/benchmark/run/ConsoleLauncherUtilTest.java @@ -0,0 +1,59 @@ +/* Copyright (c) 2022-2025 Deephaven Data Labs and Patent Pending */ +package io.deephaven.benchmark.run; + +import static org.junit.jupiter.api.Assertions.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Test; + +class ConsoleLauncherUtilTest { + + /** + * Test formatting console launcher args with wildcards for test names and with tag. If there is no test name, + * nothing should change. + */ + @Test + void formatConsoleWildcards() { + var expected = new String[] {"-Db.p=my.pr", "-jar", "d-b-*-s.jar", "-cp", "s-t.jar", "-p", "my.test.package", + "-n", "^.*[.](A.*)Test.*$"}; + var args = getArgs("my.test.package", "A*", ""); + var formatted = ConsoleLauncherUtil.formatConsoleWildcards(args); + assertArrayEquals(expected, formatted, "Wrong formatted args"); + + expected = new String[] {"-Db.p=my.pr", "-jar", "d-b-*-s.jar", "-cp", "s-t.jar", "-p", "my.test.package", + "-n", "^.*[.](A.*|.*B|.*C.*)Test.*$"}; + args = getArgs("my.test.package", "A*, *B ,*C*", ""); + formatted = ConsoleLauncherUtil.formatConsoleWildcards(args); + assertArrayEquals(expected, formatted, "Wrong formatted args"); + + expected = new String[] {"-Db.p=my.pr", "-jar", "d-b-*-s.jar", "-cp", "s-t.jar", "-p", "my.test.package", + "-t", "TAG"}; + args = getArgs("my.test.package", "", "TAG"); + formatted = ConsoleLauncherUtil.formatConsoleWildcards(args); + assertArrayEquals(expected, formatted, "Wrong formatted args"); + + expected = new String[] {"-Db.p=my.pr", "-jar", "d-b-*-s.jar", "-cp", "s-t.jar", "-p", "my.test.package", + "-n", "^.*[.](.*)Test.*$"}; + args = getArgs("my.test.package", "*", ""); + formatted = ConsoleLauncherUtil.formatConsoleWildcards(args); + assertArrayEquals(expected, formatted, "Wrong formatted args"); + } + + private String[] getArgs(String testPackage, String testPattern, String tagName) { + var args = new ArrayList(Arrays.asList()); + append(args, "-Db.p=my.pr", "-jar", "d-b-*-s.jar", "-cp", "s-t.jar"); + append(args, "-p", testPackage); + if (!testPattern.isBlank()) + append(args, "-n", testPattern); + if (!tagName.isBlank()) + append(args, "-t", tagName); + System.out.println("Args: " + args); + return args.toArray(new String[0]); + } + + private void append(List list, String... s) { + list.addAll(Arrays.asList(s)); + } + +}