Ci store tests share their store and merge into tables
Browse files at this commit0fef3ae060b630e169179ce0c898a41c5e0c1341Parent: 5099461- test
- ci store tests share their store and merge into tables
1 changed file +74 -80
crates/forge-core/src/store/ci.rsmodified+74 -80
| @@ -2296,17 +2296,16 @@ mod tests { | |||
| 2296 | )); | 2296 | )); |
| 2297 | } | 2297 | } |
| 2298 | 2298 | ||
| 2299 | - #[tokio::test] | 2299 | + async fn numbering_is_per_repo(fx: &Fx) { |
| 2300 | - async fn create_run_numbers_per_repo() { | 2300 | + let repo = repo_named(fx, "numbers").await; |
| 2301 | - let fx = fixture().await; | ||
| 2302 | let other = fx | 2301 | let other = fx |
| 2303 | .store | 2302 | .store |
| 2304 | .create_repo(&fx.tahinli.id, "other", "", Visibility::Public, "main") | 2303 | .create_repo(&fx.tahinli.id, "other", "", Visibility::Public, "main") |
| 2305 | .await | 2304 | .await |
| 2306 | .unwrap(); | 2305 | .unwrap(); |
| 2307 | let jobs = [job("build", &[], &[]), job("test", &["build"], &[])]; | 2306 | let jobs = [job("build", &[], &[]), job("test", &["build"], &[])]; |
| 2308 | - let r1 = create(&fx.store, &fx.repo.id, &fx.tahinli.id, &jobs, false).await; | 2307 | + let r1 = create(&fx.store, &repo.id, &fx.tahinli.id, &jobs, false).await; |
| 2309 | - let r2 = create(&fx.store, &fx.repo.id, &fx.tahinli.id, &jobs, false).await; | 2308 | + let r2 = create(&fx.store, &repo.id, &fx.tahinli.id, &jobs, false).await; |
| 2310 | let o1 = create(&fx.store, &other.id, &fx.tahinli.id, &jobs, false).await; | 2309 | let o1 = create(&fx.store, &other.id, &fx.tahinli.id, &jobs, false).await; |
| 2311 | assert_eq!((r1.number, r2.number, o1.number), (1, 2, 1)); | 2310 | assert_eq!((r1.number, r2.number, o1.number), (1, 2, 1)); |
| 2312 | assert_eq!(r1.state, RunState::Queued); | 2311 | assert_eq!(r1.state, RunState::Queued); |
| @@ -2320,7 +2319,7 @@ mod tests { | |||
| 2320 | ); | 2319 | ); |
| 2321 | assert_eq!( | 2320 | assert_eq!( |
| 2322 | fx.store | 2321 | fx.store |
| 2323 | - .run_by_number(&fx.repo.id, 2) | 2322 | + .run_by_number(&repo.id, 2) |
| 2324 | .await | 2323 | .await |
| 2325 | .unwrap() | 2324 | .unwrap() |
| 2326 | .unwrap() | 2325 | .unwrap() |
| @@ -2331,7 +2330,7 @@ mod tests { | |||
| 2331 | let broken = fx | 2330 | let broken = fx |
| 2332 | .store | 2331 | .store |
| 2333 | .create_run( | 2332 | .create_run( |
| 2334 | - &fx.repo.id, | 2333 | + &repo.id, |
| 2335 | "push", | 2334 | "push", |
| 2336 | "refs/heads/main", | 2335 | "refs/heads/main", |
| 2337 | "abc123", | 2336 | "abc123", |
| @@ -2348,32 +2347,31 @@ mod tests { | |||
| 2348 | assert!(broken.finished_at.is_some()); | 2347 | assert!(broken.finished_at.is_some()); |
| 2349 | assert!(fx.store.jobs_for_run(&broken.id).await.unwrap().is_empty()); | 2348 | assert!(fx.store.jobs_for_run(&broken.id).await.unwrap().is_empty()); |
| 2350 | 2349 | ||
| 2351 | - let (page, total) = fx.store.list_runs(&fx.repo.id, 1, 2).await.unwrap(); | 2350 | + let (page, total) = fx.store.list_runs(&repo.id, 1, 2).await.unwrap(); |
| 2352 | assert_eq!(total, 3); | 2351 | assert_eq!(total, 3); |
| 2353 | assert_eq!( | 2352 | assert_eq!( |
| 2354 | page.iter().map(|r| r.number).collect::<Vec<_>>(), | 2353 | page.iter().map(|r| r.number).collect::<Vec<_>>(), |
| 2355 | vec![3, 2] | 2354 | vec![3, 2] |
| 2356 | ); | 2355 | ); |
| 2357 | - let (page2, _) = fx.store.list_runs(&fx.repo.id, 2, 2).await.unwrap(); | 2356 | + let (page2, _) = fx.store.list_runs(&repo.id, 2, 2).await.unwrap(); |
| 2358 | assert_eq!(page2.iter().map(|r| r.number).collect::<Vec<_>>(), vec![1]); | 2357 | assert_eq!(page2.iter().map(|r| r.number).collect::<Vec<_>>(), vec![1]); |
| 2359 | } | 2358 | } |
| 2360 | 2359 | ||
| 2361 | - #[tokio::test] | 2360 | + async fn newest_run_per_ref(fx: &Fx) { |
| 2362 | - async fn latest_run_on_ref_picks_newest_per_branch() { | 2361 | + let repo = repo_named(fx, "latest").await; |
| 2363 | - let fx = fixture().await; | ||
| 2364 | let jobs = [job("build", &[], &[])]; | 2362 | let jobs = [job("build", &[], &[])]; |
| 2365 | assert!( | 2363 | assert!( |
| 2366 | fx.store | 2364 | fx.store |
| 2367 | - .latest_run_on_ref(&fx.repo.id, "refs/heads/main") | 2365 | + .latest_run_on_ref(&repo.id, "refs/heads/main") |
| 2368 | .await | 2366 | .await |
| 2369 | .unwrap() | 2367 | .unwrap() |
| 2370 | .is_none() | 2368 | .is_none() |
| 2371 | ); | 2369 | ); |
| 2372 | - let main1 = create(&fx.store, &fx.repo.id, &fx.tahinli.id, &jobs, false).await; | 2370 | + let main1 = create(&fx.store, &repo.id, &fx.tahinli.id, &jobs, false).await; |
| 2373 | let dev = fx | 2371 | let dev = fx |
| 2374 | .store | 2372 | .store |
| 2375 | .create_run( | 2373 | .create_run( |
| 2376 | - &fx.repo.id, | 2374 | + &repo.id, |
| 2377 | "push", | 2375 | "push", |
| 2378 | "refs/heads/dev", | 2376 | "refs/heads/dev", |
| 2379 | "abc123", | 2377 | "abc123", |
| @@ -2385,10 +2383,10 @@ mod tests { | |||
| 2385 | ) | 2383 | ) |
| 2386 | .await | 2384 | .await |
| 2387 | .unwrap(); | 2385 | .unwrap(); |
| 2388 | - let main2 = create(&fx.store, &fx.repo.id, &fx.tahinli.id, &jobs, false).await; | 2386 | + let main2 = create(&fx.store, &repo.id, &fx.tahinli.id, &jobs, false).await; |
| 2389 | let latest = fx | 2387 | let latest = fx |
| 2390 | .store | 2388 | .store |
| 2391 | - .latest_run_on_ref(&fx.repo.id, "refs/heads/main") | 2389 | + .latest_run_on_ref(&repo.id, "refs/heads/main") |
| 2392 | .await | 2390 | .await |
| 2393 | .unwrap() | 2391 | .unwrap() |
| 2394 | .unwrap(); | 2392 | .unwrap(); |
| @@ -2396,25 +2394,24 @@ mod tests { | |||
| 2396 | assert_ne!(latest.id, main1.id); | 2394 | assert_ne!(latest.id, main1.id); |
| 2397 | let on_dev = fx | 2395 | let on_dev = fx |
| 2398 | .store | 2396 | .store |
| 2399 | - .latest_run_on_ref(&fx.repo.id, "refs/heads/dev") | 2397 | + .latest_run_on_ref(&repo.id, "refs/heads/dev") |
| 2400 | .await | 2398 | .await |
| 2401 | .unwrap() | 2399 | .unwrap() |
| 2402 | .unwrap(); | 2400 | .unwrap(); |
| 2403 | assert_eq!(on_dev.id, dev.id); | 2401 | assert_eq!(on_dev.id, dev.id); |
| 2404 | assert!( | 2402 | assert!( |
| 2405 | fx.store | 2403 | fx.store |
| 2406 | - .latest_run_on_ref(&fx.repo.id, "refs/heads/nope") | 2404 | + .latest_run_on_ref(&repo.id, "refs/heads/nope") |
| 2407 | .await | 2405 | .await |
| 2408 | .unwrap() | 2406 | .unwrap() |
| 2409 | .is_none() | 2407 | .is_none() |
| 2410 | ); | 2408 | ); |
| 2411 | } | 2409 | } |
| 2412 | 2410 | ||
| 2413 | - #[tokio::test] | 2411 | + async fn approval_holds_the_run(fx: &Fx) { |
| 2414 | - async fn approval_flow() { | 2412 | + let repo = repo_named(fx, "approval").await; |
| 2415 | - let fx = fixture().await; | ||
| 2416 | let jobs = [job("build", &[], &[]), job("test", &["build"], &[])]; | 2413 | let jobs = [job("build", &[], &[]), job("test", &["build"], &[])]; |
| 2417 | - let run = create(&fx.store, &fx.repo.id, &fx.tahinli.id, &jobs, true).await; | 2414 | + let run = create(&fx.store, &repo.id, &fx.tahinli.id, &jobs, true).await; |
| 2418 | assert_eq!(run.state, RunState::WaitingApproval); | 2415 | assert_eq!(run.state, RunState::WaitingApproval); |
| 2419 | assert_eq!( | 2416 | assert_eq!( |
| 2420 | job_named(&fx.store, &run.id, "build").await.state, | 2417 | job_named(&fx.store, &run.id, "build").await.state, |
| @@ -3011,11 +3008,10 @@ mod tests { | |||
| 3011 | )); | 3008 | )); |
| 3012 | } | 3009 | } |
| 3013 | 3010 | ||
| 3014 | - #[tokio::test] | 3011 | + async fn rerun_copies_commit_and_specs(fx: &Fx) { |
| 3015 | - async fn rerun_copies_commit_and_specs() { | 3012 | + let repo = repo_named(fx, "rerun").await; |
| 3016 | - let fx = fixture().await; | ||
| 3017 | let jobs = [job("build", &[], &["linux"]), job("test", &["build"], &[])]; | 3013 | let jobs = [job("build", &[], &["linux"]), job("test", &["build"], &[])]; |
| 3018 | - let first = create(&fx.store, &fx.repo.id, &fx.tahinli.id, &jobs, false).await; | 3014 | + let first = create(&fx.store, &repo.id, &fx.tahinli.id, &jobs, false).await; |
| 3019 | let again = fx.store.rerun(&first.id, &fx.tahinli.id).await.unwrap(); | 3015 | let again = fx.store.rerun(&first.id, &fx.tahinli.id).await.unwrap(); |
| 3020 | assert_eq!(again.number, 2); | 3016 | assert_eq!(again.number, 2); |
| 3021 | assert_eq!(again.commit_oid, first.commit_oid); | 3017 | assert_eq!(again.commit_oid, first.commit_oid); |
| @@ -3038,16 +3034,15 @@ mod tests { | |||
| 3038 | )); | 3034 | )); |
| 3039 | } | 3035 | } |
| 3040 | 3036 | ||
| 3041 | - #[tokio::test] | 3037 | + async fn partial_reruns_take_failed_jobs_and_their_dependants(fx: &Fx) { |
| 3042 | - async fn partial_reruns_take_failed_jobs_and_their_dependants() { | 3038 | + let repo = repo_named(fx, "partial").await; |
| 3043 | - let fx = fixture().await; | ||
| 3044 | let jobs = [ | 3039 | let jobs = [ |
| 3045 | job("a", &[], &[]), | 3040 | job("a", &[], &[]), |
| 3046 | job("b", &["a"], &[]), | 3041 | job("b", &["a"], &[]), |
| 3047 | job("c", &["b"], &[]), | 3042 | job("c", &["b"], &[]), |
| 3048 | job("d", &[], &[]), | 3043 | job("d", &[], &[]), |
| 3049 | ]; | 3044 | ]; |
| 3050 | - let first = create(&fx.store, &fx.repo.id, &fx.tahinli.id, &jobs, false).await; | 3045 | + let first = create(&fx.store, &repo.id, &fx.tahinli.id, &jobs, false).await; |
| 3051 | assert!(matches!( | 3046 | assert!(matches!( |
| 3052 | fx.store.rerun_failed(&first.id, &fx.tahinli.id).await, | 3047 | fx.store.rerun_failed(&first.id, &fx.tahinli.id).await, |
| 3053 | Err(Error::Conflict(_)) | 3048 | Err(Error::Conflict(_)) |
| @@ -3108,11 +3103,10 @@ mod tests { | |||
| 3108 | )); | 3103 | )); |
| 3109 | } | 3104 | } |
| 3110 | 3105 | ||
| 3111 | - #[tokio::test] | 3106 | + async fn warnings_are_stored_and_carried_into_reruns(fx: &Fx) { |
| 3112 | - async fn warnings_are_stored_and_carried_into_reruns() { | 3107 | + let repo = repo_named(fx, "warnings").await; |
| 3113 | - let fx = fixture().await; | ||
| 3114 | let jobs = [job("a", &[], &[])]; | 3108 | let jobs = [job("a", &[], &[])]; |
| 3115 | - let run = create(&fx.store, &fx.repo.id, &fx.tahinli.id, &jobs, false).await; | 3109 | + let run = create(&fx.store, &repo.id, &fx.tahinli.id, &jobs, false).await; |
| 3116 | assert!(fx.store.run_warnings(&run.id).await.unwrap().is_empty()); | 3110 | assert!(fx.store.run_warnings(&run.id).await.unwrap().is_empty()); |
| 3117 | let warnings = vec!["unknown key `on.schedule`".to_owned(), "second".to_owned()]; | 3111 | let warnings = vec!["unknown key `on.schedule`".to_owned(), "second".to_owned()]; |
| 3118 | fx.store.set_run_warnings(&run.id, &warnings).await.unwrap(); | 3112 | fx.store.set_run_warnings(&run.id, &warnings).await.unwrap(); |
| @@ -3121,27 +3115,26 @@ mod tests { | |||
| 3121 | assert_eq!(fx.store.run_warnings(&again.id).await.unwrap(), warnings); | 3115 | assert_eq!(fx.store.run_warnings(&again.id).await.unwrap(), warnings); |
| 3122 | } | 3116 | } |
| 3123 | 3117 | ||
| 3124 | - #[tokio::test] | 3118 | + async fn superseded_candidates_are_older_live_push_runs_on_the_ref(fx: &Fx) { |
| 3125 | - async fn superseded_candidates_are_older_live_push_runs_on_the_ref() { | 3119 | + let repo = repo_named(fx, "superseded").await; |
| 3126 | - let fx = fixture().await; | ||
| 3127 | let jobs = [job("a", &[], &[])]; | 3120 | let jobs = [job("a", &[], &[])]; |
| 3128 | - let first = create(&fx.store, &fx.repo.id, &fx.tahinli.id, &jobs, false).await; | 3121 | + let first = create(&fx.store, &repo.id, &fx.tahinli.id, &jobs, false).await; |
| 3129 | let found = fx | 3122 | let found = fx |
| 3130 | .store | 3123 | .store |
| 3131 | - .superseded_candidates(&fx.repo.id, "refs/heads/main", "def456") | 3124 | + .superseded_candidates(&repo.id, "refs/heads/main", "def456") |
| 3132 | .await | 3125 | .await |
| 3133 | .unwrap(); | 3126 | .unwrap(); |
| 3134 | assert_eq!(found.len(), 1); | 3127 | assert_eq!(found.len(), 1); |
| 3135 | assert_eq!(found[0].id, first.id); | 3128 | assert_eq!(found[0].id, first.id); |
| 3136 | let same = fx | 3129 | let same = fx |
| 3137 | .store | 3130 | .store |
| 3138 | - .superseded_candidates(&fx.repo.id, "refs/heads/main", "abc123") | 3131 | + .superseded_candidates(&repo.id, "refs/heads/main", "abc123") |
| 3139 | .await | 3132 | .await |
| 3140 | .unwrap(); | 3133 | .unwrap(); |
| 3141 | assert!(same.is_empty()); | 3134 | assert!(same.is_empty()); |
| 3142 | let elsewhere = fx | 3135 | let elsewhere = fx |
| 3143 | .store | 3136 | .store |
| 3144 | - .superseded_candidates(&fx.repo.id, "refs/heads/other", "def456") | 3137 | + .superseded_candidates(&repo.id, "refs/heads/other", "def456") |
| 3145 | .await | 3138 | .await |
| 3146 | .unwrap(); | 3139 | .unwrap(); |
| 3147 | assert!(elsewhere.is_empty()); | 3140 | assert!(elsewhere.is_empty()); |
| @@ -3228,12 +3221,11 @@ mod tests { | |||
| 3228 | assert!(logs2.is_empty() && artifacts2.is_empty()); | 3221 | assert!(logs2.is_empty() && artifacts2.is_empty()); |
| 3229 | } | 3222 | } |
| 3230 | 3223 | ||
| 3231 | - #[tokio::test] | 3224 | + async fn artifacts_are_unique_per_job_and_listed(fx: &Fx) { |
| 3232 | - async fn artifacts_are_unique_per_job_and_listed() { | 3225 | + let repo = repo_named(fx, "artifacts").await; |
| 3233 | - let fx = fixture().await; | ||
| 3234 | let run = create( | 3226 | let run = create( |
| 3235 | &fx.store, | 3227 | &fx.store, |
| 3236 | - &fx.repo.id, | 3228 | + &repo.id, |
| 3237 | &fx.tahinli.id, | 3229 | &fx.tahinli.id, |
| 3238 | &[job("a", &[], &[])], | 3230 | &[job("a", &[], &[])], |
| 3239 | false, | 3231 | false, |
| @@ -3260,16 +3252,15 @@ mod tests { | |||
| 3260 | ); | 3252 | ); |
| 3261 | } | 3253 | } |
| 3262 | 3254 | ||
| 3263 | - #[tokio::test] | 3255 | + async fn secrets_seal_round_trip_and_list_never_returns_values(fx: &Fx) { |
| 3264 | - async fn secrets_seal_round_trip_and_list_never_returns_values() { | 3256 | + let repo = repo_named(fx, "secrets").await; |
| 3265 | - let fx = fixture().await; | ||
| 3266 | let plain = "hunter2-very-secret-value"; | 3257 | let plain = "hunter2-very-secret-value"; |
| 3267 | fx.store | 3258 | fx.store |
| 3268 | - .set_ci_secret(&fx.repo.id, "DEPLOY_KEY", plain.as_bytes()) | 3259 | + .set_ci_secret(&repo.id, "DEPLOY_KEY", plain.as_bytes()) |
| 3269 | .await | 3260 | .await |
| 3270 | .unwrap(); | 3261 | .unwrap(); |
| 3271 | fx.store | 3262 | fx.store |
| 3272 | - .set_ci_secret(&fx.repo.id, "TOKEN", b"second") | 3263 | + .set_ci_secret(&repo.id, "TOKEN", b"second") |
| 3273 | .await | 3264 | .await |
| 3274 | .unwrap(); | 3265 | .unwrap(); |
| 3275 | 3266 | ||
| @@ -3279,7 +3270,7 @@ mod tests { | |||
| 3279 | let raw = fetch_opt( | 3270 | let raw = fetch_opt( |
| 3280 | &conn, | 3271 | &conn, |
| 3281 | "SELECT sealed FROM ci_secrets WHERE repo_id = ?1 AND name = 'DEPLOY_KEY'", | 3272 | "SELECT sealed FROM ci_secrets WHERE repo_id = ?1 AND name = 'DEPLOY_KEY'", |
| 3282 | - (fx.repo.id.clone(),), | 3273 | + (repo.id.clone(),), |
| 3283 | |row| col_blob(row, 0), | 3274 | |row| col_blob(row, 0), |
| 3284 | ) | 3275 | ) |
| 3285 | .await | 3276 | .await |
| @@ -3288,7 +3279,7 @@ mod tests { | |||
| 3288 | assert!(!raw.windows(plain.len()).any(|w| w == plain.as_bytes())); | 3279 | assert!(!raw.windows(plain.len()).any(|w| w == plain.as_bytes())); |
| 3289 | } | 3280 | } |
| 3290 | 3281 | ||
| 3291 | - let names = fx.store.list_ci_secret_names(&fx.repo.id).await.unwrap(); | 3282 | + let names = fx.store.list_ci_secret_names(&repo.id).await.unwrap(); |
| 3292 | assert_eq!( | 3283 | assert_eq!( |
| 3293 | names.iter().map(|(n, _)| n.as_str()).collect::<Vec<_>>(), | 3284 | names.iter().map(|(n, _)| n.as_str()).collect::<Vec<_>>(), |
| 3294 | vec!["DEPLOY_KEY", "TOKEN"] | 3285 | vec!["DEPLOY_KEY", "TOKEN"] |
| @@ -3299,10 +3290,7 @@ mod tests { | |||
| 3299 | 3290 | ||
| 3300 | let values = fx | 3291 | let values = fx |
| 3301 | .store | 3292 | .store |
| 3302 | - .ci_secret_values( | 3293 | + .ci_secret_values(&repo.id, &["DEPLOY_KEY".to_string(), "MISSING".to_string()]) |
| 3303 | - &fx.repo.id, | ||
| 3304 | - &["DEPLOY_KEY".to_string(), "MISSING".to_string()], | ||
| 3305 | - ) | ||
| 3306 | .await | 3294 | .await |
| 3307 | .unwrap(); | 3295 | .unwrap(); |
| 3308 | assert_eq!(values.len(), 1); | 3296 | assert_eq!(values.len(), 1); |
| @@ -3310,20 +3298,16 @@ mod tests { | |||
| 3310 | 3298 | ||
| 3311 | // Replacing keeps one row. | 3299 | // Replacing keeps one row. |
| 3312 | fx.store | 3300 | fx.store |
| 3313 | - .set_ci_secret(&fx.repo.id, "DEPLOY_KEY", b"rotated") | 3301 | + .set_ci_secret(&repo.id, "DEPLOY_KEY", b"rotated") |
| 3314 | .await | 3302 | .await |
| 3315 | .unwrap(); | 3303 | .unwrap(); |
| 3316 | assert_eq!( | 3304 | assert_eq!( |
| 3317 | - fx.store | 3305 | + fx.store.list_ci_secret_names(&repo.id).await.unwrap().len(), |
| 3318 | - .list_ci_secret_names(&fx.repo.id) | ||
| 3319 | - .await | ||
| 3320 | - .unwrap() | ||
| 3321 | - .len(), | ||
| 3322 | 2 | 3306 | 2 |
| 3323 | ); | 3307 | ); |
| 3324 | let rotated = fx | 3308 | let rotated = fx |
| 3325 | .store | 3309 | .store |
| 3326 | - .ci_secret_values(&fx.repo.id, &["DEPLOY_KEY".to_string()]) | 3310 | + .ci_secret_values(&repo.id, &["DEPLOY_KEY".to_string()]) |
| 3327 | .await | 3311 | .await |
| 3328 | .unwrap(); | 3312 | .unwrap(); |
| 3329 | assert_eq!( | 3313 | assert_eq!( |
| @@ -3331,30 +3315,40 @@ mod tests { | |||
| 3331 | Some("rotated") | 3315 | Some("rotated") |
| 3332 | ); | 3316 | ); |
| 3333 | 3317 | ||
| 3334 | - assert!( | 3318 | + assert!(fx.store.delete_ci_secret(&repo.id, "TOKEN").await.unwrap()); |
| 3335 | - fx.store | 3319 | + assert!(!fx.store.delete_ci_secret(&repo.id, "TOKEN").await.unwrap()); |
| 3336 | - .delete_ci_secret(&fx.repo.id, "TOKEN") | ||
| 3337 | - .await | ||
| 3338 | - .unwrap() | ||
| 3339 | - ); | ||
| 3340 | - assert!( | ||
| 3341 | - !fx.store | ||
| 3342 | - .delete_ci_secret(&fx.repo.id, "TOKEN") | ||
| 3343 | - .await | ||
| 3344 | - .unwrap() | ||
| 3345 | - ); | ||
| 3346 | assert!(matches!( | 3320 | assert!(matches!( |
| 3347 | - fx.store.set_ci_secret(&fx.repo.id, "lower", b"x").await, | 3321 | + fx.store.set_ci_secret(&repo.id, "lower", b"x").await, |
| 3348 | Err(Error::Invalid(_)) | 3322 | Err(Error::Invalid(_)) |
| 3349 | )); | 3323 | )); |
| 3350 | assert!(matches!( | 3324 | assert!(matches!( |
| 3351 | - fx.store | 3325 | + fx.store.set_ci_secret(&repo.id, "BAD", &[0xff, 0xfe]).await, |
| 3352 | - .set_ci_secret(&fx.repo.id, "BAD", &[0xff, 0xfe]) | ||
| 3353 | - .await, | ||
| 3354 | Err(Error::Invalid(_)) | 3326 | Err(Error::Invalid(_)) |
| 3355 | )); | 3327 | )); |
| 3356 | } | 3328 | } |
| 3357 | 3329 | ||
| 3330 | + async fn repo_named(fx: &Fx, name: &str) -> Repo { | ||
| 3331 | + fx.store | ||
| 3332 | + .create_repo(&fx.tahinli.id, name, "", Visibility::Public, "main") | ||
| 3333 | + .await | ||
| 3334 | + .unwrap() | ||
| 3335 | + } | ||
| 3336 | + | ||
| 3337 | + /// Each scenario works in its own repo and leaves its jobs unclaimed, so they share one store. | ||
| 3338 | + #[tokio::test] | ||
| 3339 | + async fn repo_scenarios_share_one_store() { | ||
| 3340 | + let fx = fixture().await; | ||
| 3341 | + numbering_is_per_repo(&fx).await; | ||
| 3342 | + newest_run_per_ref(&fx).await; | ||
| 3343 | + approval_holds_the_run(&fx).await; | ||
| 3344 | + rerun_copies_commit_and_specs(&fx).await; | ||
| 3345 | + partial_reruns_take_failed_jobs_and_their_dependants(&fx).await; | ||
| 3346 | + warnings_are_stored_and_carried_into_reruns(&fx).await; | ||
| 3347 | + superseded_candidates_are_older_live_push_runs_on_the_ref(&fx).await; | ||
| 3348 | + artifacts_are_unique_per_job_and_listed(&fx).await; | ||
| 3349 | + secrets_seal_round_trip_and_list_never_returns_values(&fx).await; | ||
| 3350 | + } | ||
| 3351 | + | ||
| 3358 | #[tokio::test] | 3352 | #[tokio::test] |
| 3359 | async fn secrets_need_the_key() { | 3353 | async fn secrets_need_the_key() { |
| 3360 | let dir = tempfile::tempdir().unwrap(); | 3354 | let dir = tempfile::tempdir().unwrap(); |