Preserve Fresh e2e server logs in CI for post-mortem debugging. - #358
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves CI/post-mortem debugging for the “fresh” e2e server by making its stdout/stderr logs durable across test runs and uploading them as a GitHub Actions artifact.
Changes:
- Add configurable log export path (
KALAMDB_AUTO_TEST_SERVER_LOG) and preserve/copy logic for the fresh test server logs. - Print fresh-server log tails on key auth/setup failures to improve actionable CI output.
- Upload the fresh-server log from CI as an artifact (
fresh-server-log) and ignore the CI artifacts directory in git.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cli/kalam-cli-e2e/tests/common/mod.rs |
Adds durable log path support, log preservation/copying, and failure-time log tail dumping for fresh e2e servers. |
.gitignore |
Ignores the ci-artifacts/ directory to avoid committing CI outputs. |
.github/workflows/ci.yml |
Sets the durable log env var, ensures the artifacts directory exists, tails the log for visibility, and uploads it as an artifact. |
Comments suppressed due to low confidence (1)
cli/kalam-cli-e2e/tests/common/mod.rs:1588
preserve_auto_test_server_log(&log_path)copies the whole log file while the server is still running. This can become expensive as logs grow and can also produce incomplete preserved copies due to concurrent writes; the log is already preserved on failure and on Drop/shutdown.
preserve_auto_test_server_log(&log_path);
Comment on lines
+905
to
+921
| fn dump_auto_test_server_log_tail(context: &str) { | ||
| let Some(log_path) = resolve_auto_test_server_log_for_dump() else { | ||
| eprintln!("[TEST] No fresh-server log available ({context})"); | ||
| return; | ||
| }; | ||
|
|
||
| let contents = fs::read_to_string(&log_path).unwrap_or_default(); | ||
| let tail: Vec<&str> = contents.lines().rev().take(80).collect::<Vec<_>>().into_iter().rev().collect(); | ||
| eprintln!( | ||
| "[TEST] Fresh server log tail ({context}) from {} ({} lines):", | ||
| log_path.display(), | ||
| tail.len() | ||
| ); | ||
| for line in tail { | ||
| eprintln!(" {line}"); | ||
| } | ||
| } |
Cluster tests no longer call test_context() under KALAMDB_SERVER_TYPE=fresh, and schema gen uses unbound isolated credentials so profile URLs match the project. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
cli/kalam-cli-e2e/tests/common/mod.rs:810
- The comment says this is an "Absolute path", but
auto_test_server_log_export_path()can return a relative path (it accepts any non-empty string). Either enforce absoluteness or update the comment to avoid being misleading.
/// Absolute path to the fresh-server stdout/stderr log.
#[serde(default)]
log_path: Option<PathBuf>,
cli/kalam-cli-e2e/tests/common/mod.rs:913
dump_auto_test_server_log_tailreads the entire log file into memory just to print the last ~80 lines. Since the log is opened in append mode and can grow large in CI, this can be slow and memory-heavy on failure paths.
let contents = fs::read_to_string(&log_path).unwrap_or_default();
let tail: Vec<&str> = contents.lines().rev().take(80).collect::<Vec<_>>().into_iter().rev().collect();
eprintln!(
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
cli/kalam-cli-e2e/tests/common/mod.rs:912
dump_auto_test_server_log_tail()reads the entire log file into memory (read_to_string) just to print the last ~80 lines. Since this log is now explicitly preserved in CI, it can become large and risk OOM / slowdowns in failing runs. Stream the file and keep a bounded tail buffer instead.
let contents = fs::read_to_string(&log_path).unwrap_or_default();
let tail: Vec<&str> = contents.lines().rev().take(80).collect::<Vec<_>>().into_iter().rev().collect();
Comment on lines
+885
to
+895
| if let Ok(Some(state)) = read_auto_test_server_state_locked() { | ||
| if let Some(log_path) = state.log_path { | ||
| if log_path.exists() { | ||
| return Some(log_path); | ||
| } | ||
| } | ||
| let in_data = state.storage_dir.join("server.log"); | ||
| if in_data.exists() { | ||
| return Some(in_data); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.