-
Notifications
You must be signed in to change notification settings - Fork 2
fix: add logs to devboxes, smoke tests & examples #755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e | ||
|
|
||
| cd "$(dirname "$0")/.." | ||
|
|
||
| echo "==> Installing git hooks..." | ||
|
|
||
| mkdir -p .git/hooks | ||
|
|
||
| cat > .git/hooks/pre-push << 'EOF' | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| cd "$(git rev-parse --show-toplevel)" | ||
|
|
||
| echo "==> Running lint checks..." | ||
| ./scripts/lint | ||
|
|
||
| echo "==> Checking EXAMPLES.md is up to date..." | ||
| uv run python scripts/generate_examples_md.py --check | ||
|
|
||
| echo "==> All checks passed!" | ||
| EOF | ||
|
|
||
| chmod +x .git/hooks/pre-push | ||
|
|
||
| echo "==> Git hooks installed successfully!" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1050,3 +1050,47 @@ def test_shell_exec_async_with_both_streams(self, devbox: Devbox) -> None: | |
| # Verify streaming captured same data as result | ||
| assert stdout_combined == result.stdout() | ||
| assert stderr_combined == result.stderr() | ||
|
|
||
|
|
||
| class TestDevboxLogs: | ||
| """Test devbox logs retrieval functionality.""" | ||
|
|
||
| @pytest.mark.timeout(THIRTY_SECOND_TIMEOUT) | ||
| def test_logs_basic(self, shared_devbox: Devbox) -> None: | ||
| """Test retrieving devbox logs returns valid response structure.""" | ||
| # Fetch logs - the API may return empty logs depending on timing | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we do a basic echo command to ensure that the logs aren't empty? |
||
| logs = shared_devbox.logs() | ||
|
|
||
| assert logs is not None | ||
| assert hasattr(logs, "logs") | ||
| assert isinstance(logs.logs, list) | ||
|
|
||
| @pytest.mark.timeout(THIRTY_SECOND_TIMEOUT) | ||
| def test_logs_with_execution_filter(self, shared_devbox: Devbox) -> None: | ||
| """Test retrieving devbox logs filtered by execution ID.""" | ||
| # Run a command and get its execution ID | ||
| execution = shared_devbox.cmd.exec_async('echo "filtered log test"') | ||
| result = execution.result() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why don't we just
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a great catch -- this is almost certainly caused by an issue with our agent guidance. I'm going to update this in a few places |
||
| assert result.exit_code == 0 | ||
|
|
||
| # Fetch logs filtered by execution ID - verifies API accepts the filter | ||
| logs = shared_devbox.logs(execution_id=execution.execution_id) | ||
|
|
||
| assert logs is not None | ||
| assert isinstance(logs.logs, list) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to add |
||
|
|
||
| @pytest.mark.timeout(THIRTY_SECOND_TIMEOUT) | ||
| def test_logs_with_shell_name_filter(self, shared_devbox: Devbox) -> None: | ||
| """Test retrieving devbox logs filtered by shell name.""" | ||
| shell_name = "test-logs-shell" | ||
| shell = shared_devbox.shell(shell_name) | ||
|
|
||
| # Run a command in the named shell | ||
| result = shell.exec('echo "shell log test"') | ||
| assert result.exit_code == 0 | ||
|
|
||
| # Fetch logs filtered by shell name - verifies API accepts the filter | ||
| logs = shared_devbox.logs(shell_name=shell_name) | ||
|
|
||
| assert logs is not None | ||
| assert isinstance(logs.logs, list) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above comment |
||
Uh oh!
There was an error while loading. Please reload this page.