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
4 changes: 2 additions & 2 deletions odoo_devkit/local_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from typing import TextIO

from .artifact_inputs import (
ArtifactInputsError,
ArtifactInputsDefinition,
ArtifactInputsError,
effective_artifact_input_sources,
load_artifact_inputs_definition,
)
Expand Down Expand Up @@ -1119,7 +1119,7 @@ def load_environment_from_control_plane(
"--directory",
str(control_plane_root),
"run",
"control-plane",
"launchplane",
"environments",
"resolve",
"--context",
Expand Down
48 changes: 48 additions & 0 deletions tests/test_control_plane_cli_contract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from __future__ import annotations

import json
import unittest
from pathlib import Path
from unittest import mock

from odoo_devkit import local_runtime


class ControlPlaneCliContractTests(unittest.TestCase):
def test_environment_resolution_uses_launchplane_cli(self) -> None:
completed_process = mock.Mock(
returncode=0,
stdout=json.dumps(
{
"environment": {
"ODOO_MASTER_PASSWORD": "control-plane-master",
}
}
),
stderr="",
)

with mock.patch(
"odoo_devkit.local_runtime.subprocess.run",
return_value=completed_process,
) as run_mock:
loaded_environment = local_runtime.load_environment_from_control_plane(
control_plane_root=Path("/opt/launchplane"),
context_name="cm",
instance_name="testing",
)

command = run_mock.call_args.args[0]
self.assertEqual(
command[:5],
["uv", "--directory", "/opt/launchplane", "run", "launchplane"],
)
self.assertIn("environments", command)
self.assertEqual(
loaded_environment.merged_values["ODOO_MASTER_PASSWORD"],
"control-plane-master",
)


if __name__ == "__main__":
unittest.main()