add Ubuntu/Fedora/Arch + custom images, streaming hash, and real E2E tests#18
add Ubuntu/Fedora/Arch + custom images, streaming hash, and real E2E tests#18userhaptop wants to merge 21 commits intobuck2hub:mainfrom
Conversation
Signed-off-by: userhaptop <1307305157@qq.com>
Signed-off-by: userhaptop <1307305157@qq.com>
Signed-off-by: userhaptop <1307305157@qq.com>
… streaming hash computation Signed-off-by: userhaptop <1307305157@qq.com>
Signed-off-by: userhaptop <1307305157@qq.com>
…d real E2E tests Signed-off-by: userhaptop <1307305157@qq.com>
Signed-off-by: userhaptop <1307305157@qq.com>
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR expands Qlean’s image and E2E validation capabilities by adding Fedora/Arch support with “latest stable” resolution, improving download robustness (streaming hash + mirror fallback), and replacing placeholder tests with gated real end-to-end VM startup flow tests.
Changes:
- Add gated (env-controlled) E2E VM startup-flow integration tests for Ubuntu/Fedora/Arch with actionable skip reasons.
- Add vsock → TCP SSH fallback and QEMU user-networking fallback (hostfwd) to improve reliability on constrained hosts (e.g., WSL2).
- Add “latest stable” Fedora/Arch image resolution plus multi-mirror download with streaming SHA verification and stall detection.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ubuntu_image.rs | Ubuntu E2E test now runs full boot + SSH whoami flow, gated by env + host capability checks. |
| tests/fedora_image.rs | New Fedora E2E startup-flow test gated by env + libguestfs availability. |
| tests/arch_image.rs | New Arch E2E startup-flow test gated by env + libguestfs availability. |
| tests/common.rs | Centralized E2E gating helpers (KVM/libvirt/vsock/WSL checks) and safer tracing subscriber init. |
| tests/guestfish.rs | Adds runtime/heuristic detection and skip messaging for libguestfs tooling (guestfish/virt-copy-out). |
| src/ssh.rs | Adds TCP SSH fallback and refines vsock error handling/logging for fallbacks. |
| src/qemu.rs | Adds bridged-network preference with fallback to slirp + hostfwd; supports TCP SSH fallback port. |
| src/machine.rs | Reserves an ephemeral local port for SSH hostfwd and passes it through to QEMU + SSH connect. |
| src/image.rs | Adds Fedora/Arch “latest stable” resolvers, streaming hash download w/ idle timeout, and multi-mirror retry with verification. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: userhaptop <1307305157@qq.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e13917bcf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…E2E no longer requires libguestfs tools. - Retry Fedora CHECKSUM fetch across mirrors (match qcow2 mirror resilience). - Fix ShaType ownership in cache/download paths. Signed-off-by: userhaptop <1307305157@qq.com>
|
Claude finished @genedna's task in 4m 12s —— View job PR ReviewThis PR substantially improves Qlean's image module. The overall direction is sound — the review feedback from prior comments has been addressed, and the new abstractions (streaming hash, multi-mirror download, TCP SSH fallback) are well-structured. Below are findings ranging from bugs to style nits. Critical / Correctness1. TCP port reservation is racy (TOCTOU) — let ssh_tcp_port = std::net::TcpListener::bind(("127.0.0.1", 0))
.map(|l| l.local_addr().map(|a| a.port()))
...??;The listener is dropped immediately after reading the port, creating a window where another process can claim it before QEMU binds the 2. Duplicate save logic with unguarded
let image_filename = image.path.file_name().unwrap().to_string_lossy();
let kernel_filename = image.kernel.file_name().unwrap().to_string_lossy();
let initrd_filename = image.initrd.file_name().unwrap().to_string_lossy();
3. Ubuntu download has no hash verification — The Design / Maintainability4. The old 5. let url = "https://endoflife.date/api/v1/products/fedora/";This introduces an undocumented external dependency on 6. Dual NIC when bridging is available — When 7. if !has_vhost_vsock() {
eprintln!("SKIP: vhost-vsock not available...");
return false;
}The PR's stated goal is to support environments without vsock (via TCP fallback). The test gating still unconditionally skips when vsock is absent, even though the new TCP path should allow those environments to run E2E tests. This effectively makes the TCP fallback untestable in automated gating. 8. let vsock_timeout = if tcp_port.is_some() {
std::cmp::min(timeout, Duration::from_secs(15))On a cold-boot first-init (KVM with cloud-init), 15 seconds can be too short for the vsock device to be ready. This causes a spurious TCP fallback every time on slower hosts and loses vsock's lower latency. Consider making this configurable or at least 30s. Minor / Style9. The doc comment says "used as a fallback when vsock is unavailable" but the field is typed 10. Three nearly-identical implementations exist. Moving 11. When 12. The PR removes Summary
The core implementations are solid. The most important things to fix before merge are: Ubuntu hash verification (#3), the |
…irror download integrity, E2E testing gating, and maintainability. Signed-off-by: userhaptop <1307305157@qq.com>
…SL/restricted environments: enhanced download verification and skip logic in Fedora/Arch, and fixed the potential unwrap() risk in save() mentioned in the review. Signed-off-by: userhaptop <1307305157@qq.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jjl9807
left a comment
There was a problem hiding this comment.
Here are two points to address first:
-
Please paste the complete output logs from running these tests locally:
QLEAN_RUN_E2E=1 cargo test --test ubuntu_image -- --nocapture QLEAN_RUN_E2E=1 cargo test --test fedora_image -- --nocapture QLEAN_RUN_E2E=1 cargo test --test arch_image -- --nocapture
-
Please do not spend further effort on WSL. This is simply not a core scenario for Qlean.
|
Based on the logs you uploaded, it appears the Fedora and Arch code hasn't undergone any actual verification; both Additionally, |
… VM boot/ssh Signed-off-by: userhaptop <1307305157@qq.com>
Signed-off-by: userhaptop <1307305157@qq.com>
Signed-off-by: userhaptop <1307305157@qq.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b05d4bd06
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
jjl9807
left a comment
There was a problem hiding this comment.
2026-02-24T22:10:20.076056856+08:00 WARN qlean::qemu: Kernel/initrd extraction is unavailable. Booting from qcow2 disk image directly.
Please fix the libguestfs-tools issue properly and remove the fallback mechanism. This PR will not be considered for merging until this is resolved.
Furthermore, understand that the reason previous reviews only highlighted one or two issues was not because those were the only problems. It was because listing every single flaw would have been futile, given that my feedback is consistently ignored.
There are fundamental issues with at least the tests and network implementations in this PR. Do not attempt to mark this PR as "Ready" again. It is misleading and deceives no one.
Finally, address the problems raised in the review directly. Stop adding arbitrary fallback mechanisms that undermine the project architecture.
|
Got it. I’ll remove the qcow2 direct-boot fallback, make Fedora/Arch fail explicitly when kernel/initrd extraction cannot complete through the libguestfs/guestfish path, and remove the TCP/user-mode fallback if the intended networking path for Qlean here is bridge + vsock only. Please confirm that, for this PR, Fedora/Arch E2E is expected to require successful local extraction and that the expected network path is bridge + vsock only. |
…e full E2E flow (build image → boot VM → SSH → run checks → shutdown) with no skips, no WSL special-casing, and no “KVM missing → skip” (falls back to QEMU TCG). Signed-off-by: userhaptop <1307305157@qq.com>
Signed-off-by: userhaptop <1307305157@qq.com>
Signed-off-by: userhaptop <1307305157@qq.com>
|
This commit removes the runtime libguestfs fallback paths (no more automatic fixed-appliance, supermin, or kernel-package provisioning) and eliminates the network-layer TCP / user-mode fallback, so Qlean now depends on a correctly prepared host libguestfs-tools, bridge, and vsock setup while running the Ubuntu / Fedora / Arch E2E flows end-to-end under QLEAN_RUN_E2E=1, failing explicitly when prerequisites are not met. The only remaining fallback behavior is limited to the download layer (mirror retry / mirror fallback) and SSH readiness retry when vsock is not yet ready; these do not change the project architecture and do not mask failures as passing tests. Thank you for pointing out the issues in the previous revisions. I appreciate the detailed review, and please continue to point out anything that is still incorrect or inconsistent with the project’s architecture or expectations. |
|
my_user@LAPTOP-30HORNHG:~/qlean$ sudo bash scripts/setup-host-prereqs.sh my_user@LAPTOP-30HORNHG:~/qlean$ QLEAN_RUN_E2E=1 cargo test --test ubuntu_image -- --nocapture running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 34.98s running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 27.83s running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 24.41s |
Signed-off-by: userhaptop <1307305157@qq.com>
|
I have unified hash verification, default end-to-end encryption, and the official mirror source based on TOML. The download process is also basically unified to a single path, and I no longer use multiple mirrors for fallback and have removed most of the probing logic. |
No description provided.