forge
Explore
Log in

Don't you dare go Hollow

🔥 remove: redundant core, ci and runner tests

Browse files at this commit

458e219424527dee24d8b8d314daeb7870dfe340Ahmet Kaan GümüşParent: 0ee9f97
crates/forge-ci/src/config.rsmodified+0 -6
@@ -458,10 +458,4 @@ artifacts = ["target/release/forge"]
458458 .unwrap();
459459 assert_eq!(flat.job_order(), vec!["a", "b", "c"]);
460460 }
461-
462- #[test]
463- fn example_order() {
464- let cfg = parse_config(EXAMPLE).unwrap();
465- assert_eq!(cfg.job_order(), vec!["test", "lint"]);
466- }
467461 }
crates/forge-ci/src/proto.rsmodified+0 -6
@@ -239,12 +239,6 @@ pub enum Outcome {
239239 mod tests {
240240 use super::*;
241241
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-
248242 #[test]
249243 fn old_and_new_claim_and_heartbeat_bodies_parse() {
250244 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 {
7979 assert_eq!(parse_size(bad), None, "{bad:?}");
8080 }
8181 }
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- }
9082 }
crates/forge-core/src/config.rsmodified+0 -38
@@ -825,44 +825,6 @@ mod tests {
825825 );
826826 }
827827
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-
866828 #[test]
867829 fn replication_target_requires_keys_and_positive_intervals() {
868830 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
6464 #[cfg(test)]
6565 mod tests {
6666 use super::*;
67- use crate::signed_token::MAC_LEN;
6867
6968 const KEY: [u8; 32] = [7; 32];
7069 const OTHER_KEY: [u8; 32] = [9; 32];
@@ -80,21 +79,6 @@ mod tests {
8079 assert!(verify(&KEY, &any, "repo-1", LfsOp::Any, NOW));
8180 }
8281
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-
9882 #[test]
9983 fn expired_is_rejected() {
10084 let token = issue(&KEY, "repo-1", LfsOp::Any, NOW);
crates/forge-core/src/names.rsmodified+0 -9
@@ -180,13 +180,4 @@ mod tests {
180180 );
181181 }
182182 }
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- }
192183 }
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) ->
3030 #[cfg(test)]
3131 mod tests {
3232 use super::*;
33- use crate::signed_token::MAC_LEN;
3433
3534 const KEY: [u8; 32] = [7; 32];
3635 const OTHER_KEY: [u8; 32] = [9; 32];
@@ -42,14 +41,6 @@ mod tests {
4241 assert!(verify_raw(&KEY, &token, "repo-1", NOW));
4342 }
4443
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-
5344 #[test]
5445 fn expired_is_rejected() {
5546 let token = sign_raw(&KEY, "repo-1", NOW);
crates/forge-core/src/store/health.rsmodified+0 -17
@@ -57,20 +57,3 @@ impl Store {
5757 })
5858 }
5959 }
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 {
17791779 assert_eq!(still.timezone, "Europe/Istanbul");
17801780 }
17811781
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-
18091782 #[tokio::test]
18101783 async fn display_name_round_trips_and_validates() {
18111784 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 {
6969 .strftime("%H:%M (UTC%:z)")
7070 .to_string()
7171 }
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() {
3838 assert_eq!(store.list_users().await.unwrap().len(), 1);
3939 }
4040
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-
7341 #[tokio::test]
7442 async fn duplicate_username_is_conflict_case_insensitive() {
7543 let dir = tempfile::tempdir().unwrap();
crates/forge-runner/src/sandbox/idmap.rsmodified+0 -32
@@ -530,31 +530,6 @@ mod tests {
530530 assert_eq!(pick_range(&[]), None);
531531 }
532532
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-
558533 fn os(args: &[&str]) -> Vec<OsString> {
559534 args.iter().map(OsString::from).collect()
560535 }
@@ -594,13 +569,6 @@ mod tests {
594569 }
595570 }
596571
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-
604572 #[test]
605573 fn auto_resolves_to_subuid_on_this_host() {
606574 if !map_auto_works() {