Skip to content

Conversation

@nprizal
Copy link
Contributor

@nprizal nprizal commented Dec 9, 2025

Description

bktec requires a command (run or plan) from version 2.0.0. Currently, running bktec without a command prints help text and exits with 0.

$ bktec
NAME:
   bktec - Buildkite Test Engine Client

USAGE:
   bktec [global options] [command [command options]]

COMMANDS:
   run      Run tests
   plan     Generate test plan without running tests
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --version   print version information and exit
   --debug     Enable debug output [$BUILDKITE_TEST_ENGINE_DEBUG_ENABLED]
   --help, -h  show help
$ echo $?
0

Users upgrading from 1.x.x to 2.x.x without specifying the command will see their build pass even though no tests are being run. Therefore, we should return a non-zero exit code when no command is provided to let users know they need to set the command.

Testing

I've tested locally without subcommand and an invalid command.

$ bktec
NAME:
   bktec - Buildkite Test Engine Client

USAGE:
   bktec [global options] [command [command options]]

COMMANDS:
   run      Run tests
   plan     Generate test plan without running tests
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --version   print version information and exit
   --debug     Enable debug output [$BUILDKITE_TEST_ENGINE_DEBUG_ENABLED]
   --help, -h  show help

command is required
$ echo $?
16
$ bktec foo
NAME:
   bktec - Buildkite Test Engine Client

USAGE:
   bktec [global options] [command [command options]]

COMMANDS:
   run      Run tests
   plan     Generate test plan without running tests
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --version   print version information and exit
   --debug     Enable debug output [$BUILDKITE_TEST_ENGINE_DEBUG_ENABLED]
   --help, -h  show help

invalid command: "foo"
$ echo $?
16

@nprizal nprizal requested a review from a team as a code owner December 9, 2025 21:57
@nprizal nprizal self-assigned this Dec 9, 2025
@nprizal nprizal requested review from gchan and malclocke December 9, 2025 21:59
@nprizal nprizal force-pushed the te-5036-exit-bktec-with-non-zero-code-when-no-subcommand-is-provided branch from 4c5ec37 to 32991fd Compare December 9, 2025 22:35
@nprizal nprizal changed the base branch from main to v2.0.x December 9, 2025 22:36
@nprizal nprizal force-pushed the te-5036-exit-bktec-with-non-zero-code-when-no-subcommand-is-provided branch from bbb4582 to 5f26f01 Compare December 10, 2025 00:53
@nprizal nprizal merged commit 55509a1 into v2.0.x Dec 10, 2025
1 check passed
@nprizal nprizal deleted the te-5036-exit-bktec-with-non-zero-code-when-no-subcommand-is-provided branch December 10, 2025 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants