Skip to content

Commit 29ce828

Browse files
committed
add check for --tail and --wait
1 parent 80b17f0 commit 29ce828

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

truss/cli/cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,11 @@ def push(
647647
style="green",
648648
)
649649

650+
if wait and tail:
651+
raise click.UsageError(
652+
"Cannot use --wait with --tail. Use --tail by itself to wait for deployment and tail logs."
653+
)
654+
650655
tr = _get_truss_from_directory(target_directory=target_directory, config=config)
651656

652657
if tr.spec.config.resources.instance_type:

truss/tests/cli/test_cli.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,3 +389,35 @@ def test_push_watch_with_publish_fails():
389389
result.exception
390390
and "Cannot use --watch with --publish" in str(result.exception.__context__)
391391
)
392+
393+
394+
def test_push_wait_with_tail_fails():
395+
"""Test that --wait with --tail fails."""
396+
mock_truss = Mock()
397+
mock_truss.spec.config.runtime.transport.kind = "http"
398+
mock_truss.spec.config.resources.instance_type = None
399+
mock_truss.spec.config.build = None
400+
mock_truss.spec.config.trt_llm = None
401+
402+
runner = CliRunner()
403+
404+
with patch("truss.cli.cli._get_truss_from_directory", return_value=mock_truss):
405+
result = runner.invoke(
406+
truss_cli,
407+
[
408+
"push",
409+
"test_truss",
410+
"--remote",
411+
"remote1",
412+
"--model-name",
413+
"name",
414+
"--wait",
415+
"--tail",
416+
],
417+
)
418+
419+
assert result.exit_code == 2
420+
assert "Cannot use --wait with --tail" in result.output or (
421+
result.exception
422+
and "Cannot use --wait with --tail" in str(result.exception.__context__)
423+
)

0 commit comments

Comments
 (0)