Skip to content

Allow test server to be provided externally#1847

Merged
yarikoptic merged 2 commits intodandi:masterfrom
brianhelba:external-test-url
Apr 30, 2026
Merged

Allow test server to be provided externally#1847
yarikoptic merged 2 commits intodandi:masterfrom
brianhelba:external-test-url

Conversation

@brianhelba
Copy link
Copy Markdown
Contributor

This adds support for an optional DANDI_TESTS_API_URL environment variable, which if set, will cause the integration test suite to connect to that external server and not boot up a Docker Compose stack. If DANDI_TESTS_API_URL is set, then DANDI_TESTS_DJANGO_API_KEY must also be set.

This makes it possible to run the CLI integration tests more without having to build a Docker image of the API server, allowing simpler validation of any existing running server against the CLI.

This adds support for an optional `DANDI_TESTS_API_URL` environment variable,
which if set, will cause the integration test suite to connect to that external
server and not boot up a Docker Compose stack. If `DANDI_TESTS_API_URL` is set,
then `DANDI_TESTS_DJANGO_API_KEY` must also be set.

This makes it possible to run the CLI integration tests more without having to
build a Docker image of the API server, allowing simpler validation of any
existing running server against the CLI.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 12.50000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.24%. Comparing base (0fe03cf) to head (c9b06c4).
⚠️ Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
dandi/tests/fixtures.py 12.50% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1847      +/-   ##
==========================================
- Coverage   76.26%   76.24%   -0.03%     
==========================================
  Files          87       87              
  Lines       12486    12493       +7     
==========================================
+ Hits         9523     9525       +2     
- Misses       2963     2968       +5     
Flag Coverage Δ
unittests 76.24% <12.50%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yarikoptic yarikoptic added the tests Add or improve existing tests label Apr 30, 2026
Comment thread dandi/tests/fixtures.py
Comment on lines +378 to +379
api_key = os.environ.get("DANDI_TESTS_DJANGO_API_KEY")
if not api_key:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are in the bright future already ;) could be

Suggested change
api_key = os.environ.get("DANDI_TESTS_DJANGO_API_KEY")
if not api_key:
if not (api_key := os.environ.get("DANDI_TESTS_DJANGO_API_KEY")):

but just to expedite -- let's proceed

Copy link
Copy Markdown
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually -- we would need to list them in https://github.com/dandi/dandi-cli/blob/master/DEVELOPMENT.md#environment-variables so human and silicon beasts could discover this feature more easily

@yarikoptic
Copy link
Copy Markdown
Member

@claude if you are enabled here -- add minimalistic description of added here env vars into DEVELOPMENT.md

@claude
Copy link
Copy Markdown

claude Bot commented Apr 30, 2026

Claude encountered an error —— View job

Failed with exit code 128

I'll analyze this and get back to you.

…vars

Briefly describe the two env vars introduced in e84b8ba alongside the
other DANDI_TESTS_* entries in DEVELOPMENT.md.

Co-Authored-By: Claude Code 2.1.123 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added docs, we should be all set now if no surprises from CI

@yarikoptic yarikoptic added the release Create a release when this pr is merged label Apr 30, 2026
@yarikoptic yarikoptic merged commit 43f02a3 into dandi:master Apr 30, 2026
36 of 38 checks passed
@github-actions
Copy link
Copy Markdown

🚀 PR was released in 0.75.1 🚀

@brianhelba
Copy link
Copy Markdown
Contributor Author

Thanks for the quick review and for fixing the deficiencies yourself! I appreciate it.

@brianhelba brianhelba deleted the external-test-url branch April 30, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Create a release when this pr is merged released tests Add or improve existing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants