From be365d4d7db64416a7356e5f053c06a2db2583c2 Mon Sep 17 00:00:00 2001 From: Keegan Carruthers-Smith Date: Mon, 2 Mar 2026 12:51:29 +0200 Subject: [PATCH] feat/dev: introduce integration smoke tests This is something lightweight you can run to ensure no major breakages to "src" when speaking to a sourcegraph instance. --- DEVELOPMENT.md | 10 ++++++++++ dev/smoke.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 dev/smoke.sh diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 825427c0f5..18daf7ba8e 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -52,6 +52,16 @@ Or just a single package with: go test ./internal/batches/workspace ``` +### Manual smoke test script + +For quick end-to-end CLI sanity checks against a live Sourcegraph instance, run: + +```sh +./dev/smoke.sh +``` + +This script intentionally uses your currently exported `SRC_*` environment variables, is not hooked up to CI, and is meant for manual regression checks (for example, to catch issues like `src users list` failing unexpectedly). + We adhere to the [general Sourcegraph principles for testing](https://docs.sourcegraph.com/dev/background-information/testing_principles), as well as [the Go specific directions](https://docs.sourcegraph.com/dev/background-information/languages/testing_go_code), at least to the extent they apply to a standalone tool like `src`. ## Releasing diff --git a/dev/smoke.sh b/dev/smoke.sh new file mode 100755 index 0000000000..0448fe9619 --- /dev/null +++ b/dev/smoke.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -euo pipefail + +unset CDPATH +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +SRC_CMD=(go run ./cmd/src) + +run() { + echo + echo "+ $*" + "$@" +} + +# This script intentionally relies on the currently exported SRC_* envvars. + +echo "Running src-cli smoke checks with current SRC_* environment" + +run "${SRC_CMD[@]}" version +run "${SRC_CMD[@]}" api -query 'query { site { buildVersion } }' +run "${SRC_CMD[@]}" api -query 'query { currentUser { username } }' +run "${SRC_CMD[@]}" users list -first=1 -f '{{.Username}}' +run "${SRC_CMD[@]}" orgs list -first=1 -f '{{.Name}}' +run "${SRC_CMD[@]}" repos list -first=1 -f '{{.Name}}' +run "${SRC_CMD[@]}" search -less=false -json 'type:repo count:1' + +echo +echo "Smoke checks completed successfully."