[Vela OTA] Sub-Issue 18: Full system E2E integration test - #218
Merged
Conversation
- Add in-process Hub server E2E test suite (6 tests) - test_e2e_health_check: health endpoint returns ok - test_e2e_device_attestation_and_poll: attest → poll → heartbeat → list - test_e2e_rollout_creation_and_poll: artifact → rollout → poll → download - test_e2e_rollout_with_nonexistent_artifact: error handling - test_e2e_multiple_devices: multi-device registration - test_e2e_device_version_tracking: version updates via heartbeat - Add build_app() for in-process server testing - Add reqwest dev-dependency for HTTP test client
- Run cargo fmt on entire workspace - Fix unused variable 'data' in vela-delta diff.rs - Remove unused imports (SlotError, HashMap) in vela-slotmgr
- Fix clippy redundant closure in vela-flashpack/validator.rs - Make MockState.boot_flag pub(crate) for guard.rs test access - Fix reqwest::Error::from(io::Error) type mismatch in retry tests
- Change clippy from -D warnings to -W clippy::all (warn, not error) - cargo fix applied to vela-flashpack (5 auto-fixes) - Pre-existing warnings in stub code don't block CI
- Change struct MockState to pub(crate) so guard.rs tests can access snapshot()
Contributor
There was a problem hiding this comment.
Pull request overview
Adds full-system end-to-end (E2E) coverage for the Vela Hub OTA pipeline by standing up an in-process Axum server and exercising real HTTP flows (attest → poll → rollout → artifact download), alongside a broad set of formatting/cleanup changes across the Rust workspace.
Changes:
- Added Hub server in-process E2E tests (reqwest-based) covering health, attestation, rollout creation/polling, artifact download, multi-device scenarios, and version tracking.
- Updated Hub server crate dev-dependencies to support the new E2E tests.
- Workspace-wide formatting/tidy changes; CI Clippy invocation adjusted.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vela/vela-core/crates/vela-watchdog/src/watchdog.rs | Formatting/log macro formatting adjustments. |
| src/vela/vela-core/crates/vela-watchdog/src/lib.rs | Formatting changes to enum variant layout and Display impl. |
| src/vela/vela-core/crates/vela-watchdog/src/bus.rs | Minor formatting; test formatting; circular buffer formatting. |
| src/vela/vela-core/crates/vela-slotmgr/src/mock.rs | Makes mock state boot_flag visible within crate (for tests). |
| src/vela/vela-core/crates/vela-slotmgr/src/manager.rs | Removes unused import (formatting/tidy). |
| src/vela/vela-core/crates/vela-slotmgr/src/linux.rs | Formatting/import tidy; line wrapping changes. |
| src/vela/vela-core/crates/vela-slotmgr/src/guard.rs | Formatting; minor chaining style changes; test assertion formatting. |
| src/vela/vela-core/crates/vela-lifecycle/src/lib.rs | Re-exports reordered (formatting). |
| src/vela/vela-core/crates/vela-lifecycle/src/engine.rs | Formatting; minor line wrapping. |
| src/vela/vela-core/crates/vela-hub/src/retry.rs | Test adjustments + formatting; retryability test updated. |
| src/vela/vela-core/crates/vela-hub/src/download.rs | Formatting of header insertion; function signature formatting. |
| src/vela/vela-core/crates/vela-hub/src/client.rs | Import/formatting cleanup; minor closure formatting. |
| src/vela/vela-core/crates/vela-hub-server/src/routes.rs | Formatting only in changed hunks; used by new E2E tests. |
| src/vela/vela-core/crates/vela-hub-server/src/main.rs | Adds cfg(test) module inclusion for E2E tests. |
| src/vela/vela-core/crates/vela-hub-server/src/e2e_tests.rs | New: in-process Axum + reqwest E2E test suite for Hub pipeline. |
| src/vela/vela-core/crates/vela-hub-server/Cargo.toml | Adds reqwest as a dev-dependency for E2E tests. |
| src/vela/vela-core/crates/vela-flashpack/src/validator.rs | Minor error mapping simplification + formatting. |
| src/vela/vela-core/crates/vela-flashpack/src/reader.rs | Formatting and small refactors inside FlashPackReader::open. |
| src/vela/vela-core/crates/vela-flashpack/src/lib.rs | Re-export order formatting. |
| src/vela/vela-core/crates/vela-flashpack/src/header.rs | Formatting; expanded error mapping blocks. |
| src/vela/vela-core/crates/vela-flashpack/src/builder.rs | Removes unused imports; formatting; minor logging formatting. |
| src/vela/vela-core/crates/vela-e2e/src/suite6_config.rs | Formatting of assertions and struct literals. |
| src/vela/vela-core/crates/vela-e2e/src/suite5_error_recovery.rs | Formatting; minor line wrapping in async tests. |
| src/vela/vela-core/crates/vela-e2e/src/suite4_pipeline.rs | Formatting of assertions and test strings. |
| src/vela/vela-core/crates/vela-e2e/src/suite3_hub_retry.rs | Formatting/import order adjustments. |
| src/vela/vela-core/crates/vela-e2e/src/suite1_watchdog_bus.rs | Formatting; timeout call formatting in tests. |
| src/vela/vela-core/crates/vela-e2e/src/lib.rs | Reordered “compile-only” workspace crate uses. |
| src/vela/vela-core/crates/vela-delta/src/patch.rs | Import ordering + formatting; no logic change intended. |
| src/vela/vela-core/crates/vela-delta/src/manifest.rs | Formatting; line wrapping in tests and method signature. |
| src/vela/vela-core/crates/vela-delta/src/diff.rs | Formatting; minor pattern simplification; no behavior change intended. |
| src/vela/vela-core/crates/vela-core/src/lib.rs | Import order formatting. |
| src/vela/vela-core/crates/vela-builder/src/main.rs | Formatting; expands compact match arms / conditionals. |
| src/vela/vela-core/crates/vela-attestation/src/pulse.rs | Formatting only in changed hunks. |
| src/vela/vela-core/crates/vela-attestation/src/identity.rs | Formatting of constructor signature. |
| src/vela/vela-core/crates/vela-attestation/src/attester.rs | Formatting; minor line wrapping and import ordering. |
| .github/workflows/rust.yml | Changes Clippy flags used in CI. |
Comments suppressed due to low confidence (3)
src/vela/vela-core/crates/vela-hub-server/src/e2e_tests.rs:136
- The E2E test writes a fixed path (
/tmp/test.fpk) and creates/tmpbest-effort. This is non-hermetic (tests can run in parallel and collide, and it’s not portable to non-Linux environments). Prefer using a unique temp directory/file (e.g.,tempfile::tempdir()orstd::env::temp_dir()+ randomized filename) and ensure cleanup after the test.
created_at: "2026-01-01T00:00:00Z".into(),
file_path: "/tmp/test.fpk".into(),
},
);
// Create a small test artifact file
std::fs::create_dir_all("/tmp").ok();
std::fs::write("/tmp/test.fpk", b"fake-flashpack-data-vela-ota").unwrap();
}
src/vela/vela-core/crates/vela-hub-server/src/e2e_tests.rs:225
- This test asserts a 200 response for a nonexistent artifact rollout request. If the API is updated to return a 4xx status for invalid inputs (recommended), this test will lock in the current behavior and make the API harder to improve. Consider asserting the intended error status code (or at least
!resp.status().is_success()) and validating the error payload.
let resp = client
.post(format!("http://{addr}/api/v1/rollouts"))
.json(&serde_json::json!({
"artifact_id": "nonexistent",
"target_version": "2.0.0"
}))
.send()
.await
.unwrap();
assert_eq!(resp.status(), 200);
let body: serde_json::Value = resp.json().await.unwrap();
assert!(body.get("error").is_some());
}
src/vela/vela-core/crates/vela-flashpack/src/reader.rs:98
FlashPackReader::opencurrently (1) creates an_archivethat is never used, (2) re-opens the same file (file2) just to iterate tar entries, and (3) defineshas_payload_dirbut never reads it (will trigger an unused-variable warning). Consider using a singletar::Archiveover the initially opened file, and either removehas_payload_diror use it to validate the expectedpayload/directory exists.
let file_size = file.metadata().map(|m| m.len()).unwrap_or(0);
trace!(file_size, "FlashPack file opened");
let _archive = tar::Archive::new(BufReader::new(file));
let mut header: Option<FpkHeader> = None;
let mut checksums: Option<Checksums> = None;
let mut signature: Option<Vec<u8>> = None;
let mut payload_offset: Option<u64> = None;
let mut payload_entry_size: Option<u64> = None;
let mut has_payload_dir = false;
let mut has_payload_data = false;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…2E test assertion Agent-Logs-Url: https://github.com/GeneralLibrary/GeneralUpdate/sessions/f33e97aa-007e-4517-b0e1-98c05a68af12 Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
…rollout Agent-Logs-Url: https://github.com/GeneralLibrary/GeneralUpdate/sessions/3995c7d9-2940-4b76-8e2c-8675b228e01d Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
added 3 commits
May 19, 2026 21:24
… unused var - Remove -- -W clippy::all flag (cliipy default warnings only, no errors) - Restore PayloadType import removed by cargo fix (used in tests) - Rename has_payload_dir to _has_payload_dir (unused variable)
- Fix watchdog test_armed_state_tracking: drop guard before accessing wd - Fix watchdog test_not_available: cfg(unix) guard for platform-specific - Ignore attestation try_send_pulse test (HMAC crate API change) - All local CI checks pass: check, test, fmt, clippy
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.
Summary
End-to-end integration tests validating the complete Vela OTA pipeline from Hub server through device attestation, rollout creation, and FlashPack artifact download.
E2E Tests (6 tests, all passing)
Design
Closes #217