Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ Before touching a subsystem, read the relevant notes in `contributing/`: `ARCHIT

## Testing Guidelines
- Default to `uv run pytest`. Use markers from `tests/conftest.py` like `--runpostgres` if need to include specific tests.
- Scope the run to the change: for trivial or localized edits, run only the affected test modules, `Test*` classes, or `-k` selection instead of the whole suite. Reserve the full suite for broad or cross-cutting changes.
- Speed up large runs with `-n auto` (pytest-xdist), e.g. `uv run pytest -n auto`.
- Group tests for the same unit (function/class) using `Test*` classes that mirror unit's name.
- Keep tests hermetic (network disabled except localhost per `pytest.ini`); stub cloud calls with mocks.

## Commit & Pull Request Guidelines
- Name branches `issue_{issue_num}_{title}` when the work tracks an issue (e.g. `issue_3959_replicated_alb_gateways`), and `pr_{title}` otherwise.
- Commit messages follow the existing style: short, imperative summaries (e.g., “Fix exclude_not_available ignored”); include rationale in the body if needed.
- For PRs, describe behavior changes and link related issues.
- Include screenshots or terminal output when touching UX/CLI messages or frontend flows.
Expand Down
4 changes: 3 additions & 1 deletion src/dstack/api/server/_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ def delete(self, project_name: str, backends_names: List[BackendType]):
def config_info(
self, project_name: str, backend_name: BackendType
) -> AnyBackendConfigWithCreds:
resp = self._request(f"/api/project/{project_name}/backends/{backend_name}/config_info")
resp = self._request(
f"/api/project/{project_name}/backends/{backend_name.value}/config_info"
)
return validate_extra_ignore(AnyBackendConfigWithCredsTagged, resp.json())
22 changes: 22 additions & 0 deletions src/tests/api/test_backends.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import logging

from dstack._internal.core.models.backends.base import BackendType
from dstack.api.server._backends import BackendsAPIClient
from tests.api.common import RequestRecorder

AWS_CONFIG_PAYLOAD = {
"type": "aws",
"regions": ["eu-west-1"],
"creds": {"type": "access_key", "access_key": "key", "secret_key": "secret"},
}


class TestBackendsAPIClientConfigInfo:
def test_renders_backend_type_value_in_path(self):
recorder = RequestRecorder(AWS_CONFIG_PAYLOAD)
client = BackendsAPIClient(_request=recorder, _logger=logging.getLogger("test"))

result = client.config_info("main", BackendType.AWS)

assert recorder.last_path == "/api/project/main/backends/aws/config_info"
assert result.type == "aws"
Loading