mirror of
https://github.com/langchain-ai/langsmith-go.git
synced 2026-08-24 12:13:40 -04:00
348f070184
* codegen metadata * chore(internal): remove mock server code * chore: update mock server docs * fix: allow canceling a request while it is waiting to retry * codegen metadata * codegen metadata * codegen metadata * fix(internal): skip tests that depend on mock server * codegen metadata * codegen metadata * codegen metadata * codegen metadata * chore(internal): move custom custom `json` tags to `api` * feat(api): manual updates * codegen metadata * feat(api): manual updates * codegen metadata * feat(api): manual updates * codegen metadata * codegen metadata * feat(api): api update * codegen metadata * codegen metadata * feat(api): api update * feat(api): api update * codegen metadata * codegen metadata * codegen metadata * codegen metadata * feat(api): api update * codegen metadata * codegen metadata * codegen metadata * codegen metadata * codegen metadata * codegen metadata * chore(internal): codegen related update * codegen metadata * codegen metadata * feat(api): api update * codegen metadata * feat(api): manual updates removed endpoints not in openAPI spec * codegen metadata * codegen metadata * codegen metadata * feat(api): api update * codegen metadata * codegen metadata * feat(api): api update * chore(internal): codegen related update * chore(ci): skip uploading artifacts on stainless-internal branches * chore: update placeholder string * codegen metadata * codegen metadata * codegen metadata * codegen metadata * feat(api): api update * codegen metadata * codegen metadata * chore(internal): minor cleanup * chore(internal): use explicit returns * codegen metadata * chore(internal): use explicit returns in more places * codegen metadata * feat(api): api update * feat(api): api update * codegen metadata * codegen metadata * feat(api): api update * codegen metadata * chore(internal): tweak CI branches * codegen metadata * codegen metadata * codegen metadata * codegen metadata * codegen metadata * codegen metadata * codegen metadata * feat(api): api update * chore: change user client (#38) * feat(api): api update * codegen metadata * fix: type mismatch (#39) * codegen metadata * release: 0.2.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: ericdong-langchain <ericdong@langchain.dev>
66 lines
1.9 KiB
Bash
Executable File
66 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
|
# In CI: build (library + examples), then run unit tests + integration tests.
|
|
# - go build ./... verifies the library and all example mains compile.
|
|
# - go test -tags=integration ./... runs unit tests (all packages), integration tests
|
|
# (integration/; they skip if LANGSMITH_API_KEY is unset), and example tests.
|
|
# Mock-dependent tests (e.g. pagination) skip when the Prism server is not reachable.
|
|
if [ -n "$GITHUB_ACTIONS" ]; then
|
|
echo "==> Building library and examples"
|
|
go build ./...
|
|
echo "==> Running tests (unit + integration)"
|
|
go test -tags=integration ./... -count=1 -timeout 300s -v "$@"
|
|
exit 0
|
|
fi
|
|
|
|
function prism_is_running() {
|
|
curl --silent "http://localhost:4010" >/dev/null 2>&1
|
|
}
|
|
|
|
kill_server_on_port() {
|
|
pids=$(lsof -t -i tcp:"$1" || echo "")
|
|
if [ "$pids" != "" ]; then
|
|
kill "$pids"
|
|
echo "Stopped $pids."
|
|
fi
|
|
}
|
|
|
|
function is_overriding_api_base_url() {
|
|
[ -n "$TEST_API_BASE_URL" ]
|
|
}
|
|
|
|
if ! is_overriding_api_base_url && ! prism_is_running ; then
|
|
# When we exit this script, make sure to kill the background mock server process
|
|
trap 'kill_server_on_port 4010' EXIT
|
|
|
|
# Start the dev server
|
|
./scripts/mock --daemon
|
|
fi
|
|
|
|
if is_overriding_api_base_url ; then
|
|
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
|
|
echo
|
|
elif ! prism_is_running ; then
|
|
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
|
|
echo -e "running against your OpenAPI spec."
|
|
echo
|
|
echo -e "To run the server, pass in the path or url of your OpenAPI"
|
|
echo -e "spec to the prism command:"
|
|
echo
|
|
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
|
|
echo
|
|
|
|
exit 1
|
|
else
|
|
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
|
|
echo
|
|
fi
|
|
|
|
echo "==> Running tests"
|
|
go test ./... "$@"
|