4b6817381b
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
"""Tests for per-developer stack namespace via OPENSRE_STACK_SUFFIX."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from platform.deployment.ecr_deploy.stack import (
|
|
ECR_REPO_NAME,
|
|
GATEWAY_CONTAINER_NAME,
|
|
STACK_NAME,
|
|
WEB_CONTAINER_NAME,
|
|
get_stack,
|
|
)
|
|
|
|
|
|
def test_get_stack_returns_defaults_when_no_suffix(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
monkeypatch.delenv("OPENSRE_STACK_SUFFIX", raising=False)
|
|
|
|
stack = get_stack()
|
|
|
|
assert stack.stack_name == STACK_NAME
|
|
assert stack.ecr_repo_name == ECR_REPO_NAME
|
|
assert stack.web_container_name == WEB_CONTAINER_NAME
|
|
assert stack.gateway_container_name == GATEWAY_CONTAINER_NAME
|
|
|
|
|
|
def test_get_stack_applies_suffix_to_all_names(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
monkeypatch.setenv("OPENSRE_STACK_SUFFIX", "joe")
|
|
|
|
stack = get_stack()
|
|
|
|
assert stack.stack_name == f"{STACK_NAME}-joe"
|
|
assert stack.ecr_repo_name == f"{ECR_REPO_NAME}-joe"
|
|
assert stack.web_container_name == f"{WEB_CONTAINER_NAME}-joe"
|
|
assert stack.gateway_container_name == f"{GATEWAY_CONTAINER_NAME}-joe"
|
|
|
|
|
|
def test_get_stack_strips_whitespace_from_suffix(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
monkeypatch.setenv("OPENSRE_STACK_SUFFIX", " alice ")
|
|
|
|
stack = get_stack()
|
|
|
|
assert stack.stack_name == f"{STACK_NAME}-alice"
|
|
assert stack.ecr_repo_name == f"{ECR_REPO_NAME}-alice"
|
|
|
|
|
|
def test_get_stack_treats_blank_suffix_as_default(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
monkeypatch.setenv("OPENSRE_STACK_SUFFIX", " ")
|
|
|
|
stack = get_stack()
|
|
|
|
assert stack.stack_name == STACK_NAME
|
|
assert stack.ecr_repo_name == ECR_REPO_NAME
|
|
|
|
|
|
def test_get_stack_preserves_log_path_with_suffix(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
monkeypatch.setenv("OPENSRE_STACK_SUFFIX", "dev")
|
|
|
|
stack = get_stack()
|
|
|
|
assert stack.log_path == "/var/log/opensre-deploy.log"
|