mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-23 09:19:06 +00:00
fix(ci): isolate Windows Tauri test harness
- keep Windows executable checks on targets that run on the hosted image - compile Tauri-backed queue and library tests without executing the broken harness - share root-scoped canonical cache logic with the Windows safety regression
This commit is contained in:
@@ -1,26 +1,22 @@
|
||||
use firelink_lib::torrent::{
|
||||
cache_torrent_info_hash, managed_torrent_info_hash_path, parse_torrent_bytes,
|
||||
read_cached_torrent_by_info_hash,
|
||||
cache_torrent_info_hash_at, parse_torrent_bytes, read_cached_torrent_by_info_hash_at,
|
||||
};
|
||||
use tauri::test::{mock_builder, mock_context, noop_assets};
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[tokio::test]
|
||||
async fn canonical_cache_round_trip_rejects_invalid_bytes_and_source_metadata() {
|
||||
let app = mock_builder()
|
||||
.build(mock_context(noop_assets()))
|
||||
.expect("mock app");
|
||||
let directory = tempdir().expect("temporary directory should be created");
|
||||
let root = directory.path().join("torrents");
|
||||
let bytes = b"d4:infod6:lengthi5e4:name4:testee";
|
||||
let parsed = parse_torrent_bytes(bytes).expect("test torrent should parse");
|
||||
let path = managed_torrent_info_hash_path(app.handle(), &parsed.info_hash)
|
||||
.expect("canonical cache path should resolve");
|
||||
let _ = tokio::fs::remove_file(&path).await;
|
||||
|
||||
assert!(cache_torrent_info_hash(app.handle(), bytes)
|
||||
let path = cache_torrent_info_hash_at(&root, bytes)
|
||||
.await
|
||||
.expect("canonical cache write should succeed")
|
||||
.is_some());
|
||||
.expect("canonical cache path should be returned");
|
||||
let path = std::path::PathBuf::from(path);
|
||||
assert_eq!(
|
||||
read_cached_torrent_by_info_hash(app.handle(), &parsed.info_hash)
|
||||
read_cached_torrent_by_info_hash_at(&root, &parsed.info_hash)
|
||||
.await
|
||||
.expect("canonical cache read should succeed"),
|
||||
Some(bytes.to_vec())
|
||||
@@ -30,7 +26,7 @@ async fn canonical_cache_round_trip_rejects_invalid_bytes_and_source_metadata()
|
||||
.await
|
||||
.expect("invalid cache fixture should be writable");
|
||||
assert!(
|
||||
read_cached_torrent_by_info_hash(app.handle(), &parsed.info_hash)
|
||||
read_cached_torrent_by_info_hash_at(&root, &parsed.info_hash)
|
||||
.await
|
||||
.expect("invalid cache should be handled")
|
||||
.is_none()
|
||||
@@ -42,21 +38,19 @@ async fn canonical_cache_round_trip_rejects_invalid_bytes_and_source_metadata()
|
||||
let tracker_hash = parse_torrent_bytes(tracker_bytes)
|
||||
.expect("tracker-bearing torrent should parse")
|
||||
.info_hash;
|
||||
let tracker_path = managed_torrent_info_hash_path(app.handle(), &tracker_hash)
|
||||
.expect("tracker cache path should resolve");
|
||||
let _ = tokio::fs::remove_file(&tracker_path).await;
|
||||
assert!(cache_torrent_info_hash(app.handle(), tracker_bytes)
|
||||
let tracker_path = cache_torrent_info_hash_at(&root, tracker_bytes)
|
||||
.await
|
||||
.expect("tracker metadata should be reusable")
|
||||
.is_some());
|
||||
.expect("tracker cache path should be returned");
|
||||
let tracker_path = std::path::PathBuf::from(tracker_path);
|
||||
assert_eq!(
|
||||
read_cached_torrent_by_info_hash(app.handle(), &tracker_hash)
|
||||
read_cached_torrent_by_info_hash_at(&root, &tracker_hash)
|
||||
.await
|
||||
.expect("tracker cache should be readable"),
|
||||
Some(tracker_bytes.to_vec())
|
||||
);
|
||||
assert!(cache_torrent_info_hash(
|
||||
app.handle(),
|
||||
assert!(cache_torrent_info_hash_at(
|
||||
&root,
|
||||
b"d4:infod6:lengthi5e4:name4:teste8:url-list22:https://example.test/ae"
|
||||
)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user