🔥 remove: redundant core, ci and runner tests
Browse files at this commit458e219424527dee24d8b8d314daeb7870dfe340Parent: 0ee9f9712 changed files +0 -230
- crates/forge-ci/src/config.rs +0 -6
- crates/forge-ci/src/proto.rs +0 -6
- crates/forge-ci/src/size.rs +0 -8
- crates/forge-core/src/config.rs +0 -38
- crates/forge-core/src/lfs_token.rs +0 -16
- crates/forge-core/src/names.rs +0 -9
- crates/forge-core/src/raw_token.rs +0 -9
- crates/forge-core/src/store/health.rs +0 -17
- crates/forge-core/src/store/mod.rs +0 -27
- crates/forge-core/src/tz.rs +0 -30
- crates/forge-core/tests/integration/store_basic.rs +0 -32
- crates/forge-runner/src/sandbox/idmap.rs +0 -32
crates/forge-ci/src/config.rsmodified+0 -6
| @@ -458,10 +458,4 @@ artifacts = ["target/release/forge"] | ||
| 458 | 458 | .unwrap(); |
| 459 | 459 | assert_eq!(flat.job_order(), vec!["a", "b", "c"]); |
| 460 | 460 | } |
| 461 | - | |
| 462 | - #[test] | |
| 463 | - fn example_order() { | |
| 464 | - let cfg = parse_config(EXAMPLE).unwrap(); | |
| 465 | - assert_eq!(cfg.job_order(), vec!["test", "lint"]); | |
| 466 | - } | |
| 467 | 461 | } |
crates/forge-ci/src/proto.rsmodified+0 -6
| @@ -239,12 +239,6 @@ pub enum Outcome { | ||
| 239 | 239 | mod tests { |
| 240 | 240 | use super::*; |
| 241 | 241 | |
| 242 | - #[test] | |
| 243 | - fn outcome_is_snake_case() { | |
| 244 | - let json = serde_json::to_string(&Outcome::Cancelled).unwrap(); | |
| 245 | - assert_eq!(json, "\"cancelled\""); | |
| 246 | - } | |
| 247 | - | |
| 248 | 242 | #[test] |
| 249 | 243 | fn old_and_new_claim_and_heartbeat_bodies_parse() { |
| 250 | 244 | let old: ClaimRequest = serde_json::from_str(r#"{"labels":["linux"]}"#).unwrap(); |
crates/forge-ci/src/size.rsmodified+0 -8
| @@ -79,12 +79,4 @@ mod tests { | ||
| 79 | 79 | assert_eq!(parse_size(bad), None, "{bad:?}"); |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | - | |
| 83 | - #[test] | |
| 84 | - fn formats_round_trip() { | |
| 85 | - assert_eq!(format_size(4 << 30), "4g"); | |
| 86 | - assert_eq!(format_size(1536 << 20), "1536m"); | |
| 87 | - assert_eq!(format_size(1000), "1000"); | |
| 88 | - assert_eq!(parse_size(&format_size(3 << 29)), Some(3 << 29)); | |
| 89 | - } | |
| 90 | 82 | } |
crates/forge-core/src/config.rsmodified+0 -38
| @@ -825,44 +825,6 @@ mod tests { | ||
| 825 | 825 | ); |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | - #[test] | |
| 829 | - fn optional_sections_default_to_disabled() { | |
| 830 | - let dir = tempfile::tempdir().unwrap(); | |
| 831 | - let path = dir.path().join("forge.toml"); | |
| 832 | - std::fs::write(&path, DEV_DEFAULTS).unwrap(); | |
| 833 | - let cfg = Config::load(&path).unwrap(); | |
| 834 | - assert!(!cfg.backup.enabled(), "backup enabled"); | |
| 835 | - assert_eq!(cfg.backup.interval_hours, 24, "backup interval"); | |
| 836 | - assert_eq!(cfg.backup.keep, 7, "backup keep"); | |
| 837 | - assert_eq!(cfg.backup.fsck_interval_days, 7, "backup fsck"); | |
| 838 | - assert!(cfg.backup.healthcheck_url.is_empty(), "backup healthcheck"); | |
| 839 | - assert!(!cfg.replication.enabled(), "replication enabled"); | |
| 840 | - assert_eq!(cfg.replication.ssh_port, 22, "replication ssh port"); | |
| 841 | - assert_eq!( | |
| 842 | - cfg.replication.db_snapshot_minutes, 15, | |
| 843 | - "replication snapshot" | |
| 844 | - ); | |
| 845 | - assert_eq!( | |
| 846 | - cfg.replication.reconcile_minutes, 60, | |
| 847 | - "replication reconcile" | |
| 848 | - ); | |
| 849 | - assert!( | |
| 850 | - cfg.replication.healthcheck_url.is_empty(), | |
| 851 | - "replication healthcheck" | |
| 852 | - ); | |
| 853 | - assert!(!cfg.self_update.enabled, "self_update enabled"); | |
| 854 | - assert_eq!(cfg.self_update.branch, "main", "self_update branch"); | |
| 855 | - assert_eq!(cfg.self_update.job, "build", "self_update job"); | |
| 856 | - assert_eq!( | |
| 857 | - cfg.self_update.artifact, "forge-{target}", | |
| 858 | - "self_update artifact" | |
| 859 | - ); | |
| 860 | - assert_eq!(cfg.storage.backend, StorageBackend::Fs, "storage backend"); | |
| 861 | - assert!(cfg.storage.s3.bucket.is_empty(), "s3 bucket"); | |
| 862 | - assert!(!cfg.storage.s3.allow_http, "s3 allow_http"); | |
| 863 | - assert!(!cfg.storage.s3.virtual_hosted_style, "s3 virtual hosted"); | |
| 864 | - } | |
| 865 | - | |
| 866 | 828 | #[test] |
| 867 | 829 | fn replication_target_requires_keys_and_positive_intervals() { |
| 868 | 830 | let dir = tempfile::tempdir().unwrap(); |
crates/forge-core/src/lfs_token.rsmodified+0 -16
| @@ -64,7 +64,6 @@ pub fn verify(key: &[u8; 32], token: &str, repo_id: &str, wanted: LfsOp, now_uni | ||
| 64 | 64 | #[cfg(test)] |
| 65 | 65 | mod tests { |
| 66 | 66 | use super::*; |
| 67 | - use crate::signed_token::MAC_LEN; | |
| 68 | 67 | |
| 69 | 68 | const KEY: [u8; 32] = [7; 32]; |
| 70 | 69 | const OTHER_KEY: [u8; 32] = [9; 32]; |
| @@ -80,21 +79,6 @@ mod tests { | ||
| 80 | 79 | assert!(verify(&KEY, &any, "repo-1", LfsOp::Any, NOW)); |
| 81 | 80 | } |
| 82 | 81 | |
| 83 | - #[test] | |
| 84 | - fn token_has_expected_shape() { | |
| 85 | - let token = issue(&KEY, "repo-1", LfsOp::Upload, NOW + 60); | |
| 86 | - let mut parts = token.splitn(3, '.'); | |
| 87 | - assert_eq!(parts.next().unwrap(), (NOW + 60).to_string()); | |
| 88 | - assert_eq!(parts.next().unwrap(), "upload"); | |
| 89 | - assert_eq!( | |
| 90 | - BASE64_URL_SAFE_NO_PAD | |
| 91 | - .decode(parts.next().unwrap()) | |
| 92 | - .unwrap() | |
| 93 | - .len(), | |
| 94 | - MAC_LEN | |
| 95 | - ); | |
| 96 | - } | |
| 97 | - | |
| 98 | 82 | #[test] |
| 99 | 83 | fn expired_is_rejected() { |
| 100 | 84 | let token = issue(&KEY, "repo-1", LfsOp::Any, NOW); |
crates/forge-core/src/names.rsmodified+0 -9
| @@ -180,13 +180,4 @@ mod tests { | ||
| 180 | 180 | ); |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | - | |
| 184 | - #[test] | |
| 185 | - fn reserved_list_contains_route_names() { | |
| 186 | - for r in [ | |
| 187 | - "api", "admin", "register", "explore", "orgs", "about", "git", | |
| 188 | - ] { | |
| 189 | - assert!(RESERVED.contains(&r)); | |
| 190 | - } | |
| 191 | - } | |
| 192 | 183 | } |
crates/forge-core/src/raw_token.rsmodified+0 -9
| @@ -30,7 +30,6 @@ pub fn verify_raw(key: &[u8; 32], token: &str, repo_id: &str, now_unix: i64) -> | ||
| 30 | 30 | #[cfg(test)] |
| 31 | 31 | mod tests { |
| 32 | 32 | use super::*; |
| 33 | - use crate::signed_token::MAC_LEN; | |
| 34 | 33 | |
| 35 | 34 | const KEY: [u8; 32] = [7; 32]; |
| 36 | 35 | const OTHER_KEY: [u8; 32] = [9; 32]; |
| @@ -42,14 +41,6 @@ mod tests { | ||
| 42 | 41 | assert!(verify_raw(&KEY, &token, "repo-1", NOW)); |
| 43 | 42 | } |
| 44 | 43 | |
| 45 | - #[test] | |
| 46 | - fn token_has_expected_shape() { | |
| 47 | - let token = sign_raw(&KEY, "repo-1", NOW + 60); | |
| 48 | - let (expires, mac) = token.split_once('.').unwrap(); | |
| 49 | - assert_eq!(expires, (NOW + 60).to_string()); | |
| 50 | - assert_eq!(BASE64_URL_SAFE_NO_PAD.decode(mac).unwrap().len(), MAC_LEN); | |
| 51 | - } | |
| 52 | - | |
| 53 | 44 | #[test] |
| 54 | 45 | fn expired_is_rejected() { |
| 55 | 46 | let token = sign_raw(&KEY, "repo-1", NOW); |
crates/forge-core/src/store/health.rsmodified+0 -17
| @@ -57,20 +57,3 @@ impl Store { | ||
| 57 | 57 | }) |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | - | |
| 61 | -#[cfg(test)] | |
| 62 | -mod tests { | |
| 63 | - use super::*; | |
| 64 | - | |
| 65 | - #[tokio::test] | |
| 66 | - async fn counts_a_fresh_store() { | |
| 67 | - let dir = tempfile::tempdir().unwrap(); | |
| 68 | - let store = Store::open(&dir.path().join("f.db")).await.unwrap(); | |
| 69 | - store.create_user("tahinli", None, "h", true).await.unwrap(); | |
| 70 | - let c = store.health_counts().await.unwrap(); | |
| 71 | - assert_eq!( | |
| 72 | - (c.repos, c.users, c.queued_jobs, c.runners_online), | |
| 73 | - (0, 1, 0, 0) | |
| 74 | - ); | |
| 75 | - } | |
| 76 | -} |
crates/forge-core/src/store/mod.rsmodified+0 -27
| @@ -1779,33 +1779,6 @@ mod tests { | ||
| 1779 | 1779 | assert_eq!(still.timezone, "Europe/Istanbul"); |
| 1780 | 1780 | } |
| 1781 | 1781 | |
| 1782 | - #[test] | |
| 1783 | - fn display_name_validation() { | |
| 1784 | - assert_eq!(validate_display_name(" ").unwrap(), None); | |
| 1785 | - assert_eq!(validate_display_name("").unwrap(), None); | |
| 1786 | - assert_eq!( | |
| 1787 | - validate_display_name(" Ahmet Kaan Gümüş ").unwrap(), | |
| 1788 | - Some("Ahmet Kaan Gümüş".to_string()) | |
| 1789 | - ); | |
| 1790 | - assert!(validate_display_name(&"ğ".repeat(MAX_DISPLAY_NAME_CHARS)).is_ok()); | |
| 1791 | - assert!(matches!( | |
| 1792 | - validate_display_name(&"ğ".repeat(MAX_DISPLAY_NAME_CHARS + 1)), | |
| 1793 | - Err(Error::Invalid(_)) | |
| 1794 | - )); | |
| 1795 | - assert!(matches!( | |
| 1796 | - validate_display_name("two\nlines"), | |
| 1797 | - Err(Error::Invalid(_)) | |
| 1798 | - )); | |
| 1799 | - assert!(matches!( | |
| 1800 | - validate_display_name("tab\there"), | |
| 1801 | - Err(Error::Invalid(_)) | |
| 1802 | - )); | |
| 1803 | - assert!(matches!( | |
| 1804 | - validate_display_name("nul\0byte"), | |
| 1805 | - Err(Error::Invalid(_)) | |
| 1806 | - )); | |
| 1807 | - } | |
| 1808 | - | |
| 1809 | 1782 | #[tokio::test] |
| 1810 | 1783 | async fn display_name_round_trips_and_validates() { |
| 1811 | 1784 | let dir = tempfile::tempdir().unwrap(); |
crates/forge-core/src/tz.rsmodified+0 -30
| @@ -69,33 +69,3 @@ pub fn local_time_now(tz: &str, now_unix: i64) -> String { | ||
| 69 | 69 | .strftime("%H:%M (UTC%:z)") |
| 70 | 70 | .to_string() |
| 71 | 71 | } |
| 72 | - | |
| 73 | -#[cfg(test)] | |
| 74 | -mod tests { | |
| 75 | - use super::*; | |
| 76 | - | |
| 77 | - #[test] | |
| 78 | - fn formats_absolute_time_in_zone() { | |
| 79 | - let unix = 1_792_062_300; | |
| 80 | - assert_eq!( | |
| 81 | - format_in_tz(unix, "Europe/Istanbul"), | |
| 82 | - "2026-10-15 14:05 +03" | |
| 83 | - ); | |
| 84 | - assert_eq!(format_in_tz(unix, "Mars/Base"), "2026-10-15 11:05 +00"); | |
| 85 | - } | |
| 86 | - | |
| 87 | - #[test] | |
| 88 | - fn local_time_shows_offset() { | |
| 89 | - let unix = 1_792_062_300; | |
| 90 | - assert_eq!(local_time_now("Europe/Istanbul", unix), "14:05 (UTC+03:00)"); | |
| 91 | - assert_eq!(local_time_now("UTC", unix), "11:05 (UTC+00:00)"); | |
| 92 | - } | |
| 93 | - | |
| 94 | - #[test] | |
| 95 | - fn lists_timezones_sorted() { | |
| 96 | - let zones = all_timezones(); | |
| 97 | - assert!(zones.iter().any(|z| z == "UTC")); | |
| 98 | - assert!(zones.iter().any(|z| z == "America/New_York")); | |
| 99 | - assert!(zones.windows(2).all(|w| w[0] < w[1])); | |
| 100 | - } | |
| 101 | -} |
crates/forge-core/tests/integration/store_basic.rsmodified+0 -32
| @@ -38,38 +38,6 @@ async fn create_user_and_lookup_case_insensitively() { | ||
| 38 | 38 | assert_eq!(store.list_users().await.unwrap().len(), 1); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -#[tokio::test] | |
| 42 | -async fn username_keeps_display_case_and_lookup_folds() { | |
| 43 | - let dir = tempfile::tempdir().unwrap(); | |
| 44 | - let store = open_store(&db_path(&dir)).await; | |
| 45 | - | |
| 46 | - let created = store | |
| 47 | - .create_user("Tahinli", None, "h", false) | |
| 48 | - .await | |
| 49 | - .unwrap(); | |
| 50 | - assert_eq!(created.username, "Tahinli"); | |
| 51 | - | |
| 52 | - for input in ["tahinli", "TAHINLI", "Tahinli"] { | |
| 53 | - let found = store | |
| 54 | - .user_by_username(input) | |
| 55 | - .await | |
| 56 | - .unwrap() | |
| 57 | - .unwrap_or_else(|| panic!("lookup {input:?} should find the user")); | |
| 58 | - assert_eq!(found.id, created.id); | |
| 59 | - assert_eq!(found.username, "Tahinli"); | |
| 60 | - } | |
| 61 | - | |
| 62 | - let err = store | |
| 63 | - .create_user("tahinli", None, "h", false) | |
| 64 | - .await | |
| 65 | - .unwrap_err(); | |
| 66 | - assert!( | |
| 67 | - matches!(err, Error::Conflict(_)), | |
| 68 | - "expected Conflict, got {err:?}" | |
| 69 | - ); | |
| 70 | - assert_eq!(store.user_count().await.unwrap(), 1); | |
| 71 | -} | |
| 72 | - | |
| 73 | 41 | #[tokio::test] |
| 74 | 42 | async fn duplicate_username_is_conflict_case_insensitive() { |
| 75 | 43 | let dir = tempfile::tempdir().unwrap(); |
crates/forge-runner/src/sandbox/idmap.rsmodified+0 -32
| @@ -530,31 +530,6 @@ mod tests { | ||
| 530 | 530 | assert_eq!(pick_range(&[]), None); |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - #[test] | |
| 534 | - fn size_and_describe() { | |
| 535 | - let single = IdMap { | |
| 536 | - uid: 1000, | |
| 537 | - gid: 1000, | |
| 538 | - sub: None, | |
| 539 | - }; | |
| 540 | - assert!(!single.is_subuid()); | |
| 541 | - assert_eq!(single.size(), 1); | |
| 542 | - assert_eq!(single.describe(), "single uid 1000"); | |
| 543 | - | |
| 544 | - let sub = IdMap { | |
| 545 | - uid: 1000, | |
| 546 | - gid: 1000, | |
| 547 | - sub: Some(SubRange { | |
| 548 | - uid_start: 524288, | |
| 549 | - gid_start: 524288, | |
| 550 | - count: 65536, | |
| 551 | - }), | |
| 552 | - }; | |
| 553 | - assert!(sub.is_subuid()); | |
| 554 | - assert_eq!(sub.size(), 65537); | |
| 555 | - assert_eq!(sub.describe(), "subuid 524288+65536"); | |
| 556 | - } | |
| 557 | - | |
| 558 | 533 | fn os(args: &[&str]) -> Vec<OsString> { |
| 559 | 534 | args.iter().map(OsString::from).collect() |
| 560 | 535 | } |
| @@ -594,13 +569,6 @@ mod tests { | ||
| 594 | 569 | } |
| 595 | 570 | } |
| 596 | 571 | |
| 597 | - #[test] | |
| 598 | - fn default_is_single() { | |
| 599 | - let map = IdMap::default(); | |
| 600 | - assert_eq!(map, IdMap::single()); | |
| 601 | - assert!(!map.is_subuid()); | |
| 602 | - } | |
| 603 | - | |
| 604 | 572 | #[test] |
| 605 | 573 | fn auto_resolves_to_subuid_on_this_host() { |
| 606 | 574 | if !map_auto_works() { |