release: bump version to 0.74.6
This commit is contained in:
@@ -43,6 +43,74 @@ def run_shell(functions: list[str], setup: str, action: str) -> subprocess.Compl
|
||||
)
|
||||
|
||||
|
||||
class ComposeSelectionTests(unittest.TestCase):
|
||||
def test_operations_use_v1_only_when_v2_is_unavailable(self) -> None:
|
||||
operations = (
|
||||
("compose_up", "up -d postgres"),
|
||||
("compose_supports_build", "build --help"),
|
||||
("build_ai_provider_image", "build aiprovider"),
|
||||
)
|
||||
for function, arguments in operations:
|
||||
for v2_available, v1_available in (
|
||||
(True, True),
|
||||
(True, False),
|
||||
(False, True),
|
||||
(False, False),
|
||||
):
|
||||
for command_status in (0, 1):
|
||||
with self.subTest(
|
||||
function=function,
|
||||
v2=v2_available,
|
||||
v1=v1_available,
|
||||
command_status=command_status,
|
||||
):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
calls_file = Path(directory) / "calls"
|
||||
action = function
|
||||
if function == "compose_up":
|
||||
action += " " + arguments
|
||||
result = run_shell(
|
||||
[function],
|
||||
f"""
|
||||
compose_available() {{ return {int(not v2_available)}; }}
|
||||
compose_v1_available() {{ return {int(not v1_available)}; }}
|
||||
docker() {{
|
||||
echo "docker $*" >> '{calls_file}'
|
||||
echo ORIGINAL_ERROR >&2
|
||||
return {command_status}
|
||||
}}
|
||||
docker-compose() {{
|
||||
echo "docker-compose $*" >> '{calls_file}'
|
||||
return {command_status}
|
||||
}}
|
||||
run_ai_provider_build_command() {{
|
||||
echo "$1 build aiprovider" >> '{calls_file}'
|
||||
echo ORIGINAL_ERROR >&2
|
||||
return {command_status}
|
||||
}}
|
||||
set_wait_detail() {{ :; }}
|
||||
clear_wait_spinner() {{ :; }}
|
||||
log_error() {{ echo "$*"; }}
|
||||
log_note() {{ echo "$*"; }}
|
||||
log_warn() {{ echo "$*"; }}
|
||||
report_missing_compose() {{ echo MISSING_COMPOSE; return 1; }}
|
||||
""",
|
||||
f"if {action}; then exit 0; else exit $?; fi",
|
||||
)
|
||||
calls = (
|
||||
calls_file.read_text().splitlines() if calls_file.exists() else []
|
||||
)
|
||||
command = "docker compose" if v2_available else "docker-compose"
|
||||
available = v2_available or v1_available
|
||||
self.assertEqual(calls, [f"{command} {arguments}"] if available else [])
|
||||
self.assertEqual(result.returncode, command_status if available else 1)
|
||||
self.assertNotIn("回退", result.stdout)
|
||||
if available:
|
||||
self.assertNotIn("MISSING_COMPOSE", result.stdout)
|
||||
if v2_available and function != "compose_supports_build":
|
||||
self.assertIn("ORIGINAL_ERROR", result.stderr)
|
||||
|
||||
|
||||
class DatabaseLifecycleTests(unittest.TestCase):
|
||||
def test_ai_start_uses_host_readiness_without_waiting_for_docker_probe_schedule(self) -> None:
|
||||
for recreate in (0, 1):
|
||||
|
||||
Reference in New Issue
Block a user