feat(cli): refuse listener flags where placement cannot apply

This commit is contained in:
Hugo Durand
2026-09-22 14:44:39 -04:00
parent 16bc576b1b
commit b809832ea3
3 changed files with 46 additions and 3 deletions
@@ -789,3 +789,24 @@ def test_updating_a_deployment_never_looks_up_listeners(
assert result.exit_code == 0, result.output
assert LIST_LISTENERS not in deploy_project.timeline
def test_listener_flags_are_refused_on_an_existing_deployment(
deploy_project: DeployProject,
) -> None:
deploy_project.control_plane.listeners = [LISTENER]
deploy_project.control_plane.existing_deployments = [
{"id": "dep-ext", "name": "my-app", "source": "external_docker"}
]
result = deploy_project.run(
"--push-to",
PUSH_REPOSITORY,
"--listener-id",
"listener-1",
host_url=CLOUD_CONTROL_PLANE_URL,
)
assert result.exit_code != 0
assert "fixed when the deployment is created" in result.output
assert deploy_project.docker.verbs() == []
@@ -740,6 +740,16 @@ class TestSelectSource:
"--image cannot be combined with --remote builds.",
id="image_with_remote",
),
pytest.param(
{"placement": RequestedPlacement(listener_id="listener-1")},
"only apply when creating a deployment with --push-to",
id="listener_without_push_to",
),
pytest.param(
{"placement": RequestedPlacement(k8s_namespace="agents")},
"only apply when creating a deployment with --push-to",
id="namespace_without_push_to",
),
],
)
def test_conflicting_flags_are_rejected(self, monkeypatch, flags, message):