MCPcopy Create free account
hub / github.com/Qovery/engine / test_checkout_files_for_commit

Function test_checkout_files_for_commit

lib-engine/src/cmd/git_lfs.rs:235–307  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

233 #[ignore]
234 #[test]
235 fn test_checkout_files_for_commit() {
236 // Repo that does not support lfs, should not return an error
237 {
238 let repo_dir = DirectoryForTests::new_with_random_suffix("/tmp/tmp_git".to_string());
239 let repo_path = repo_dir.path();
240
241 git::clone_at_commit(
242 &"https://github.com/Qovery/engine-testing.git".parse().unwrap(),
243 "9df822462e3e7215548e492bc2c15a50a92fed39",
244 &repo_path,
245 &|_| Vec::new(),
246 false,
247 )
248 .unwrap();
249
250 let cmd = GitLfs::default();
251 let ret = cmd.checkout_files_for_commit(
252 &repo_path,
253 "9df822462e3e7215548e492bc2c15a50a92fed39",
254 &CommandKiller::never(),
255 );
256 assert!(ret.is_ok());
257 }
258
259 // Repo that support lfs, should properly get the files
260 {
261 let repo_dir = DirectoryForTests::new_with_random_suffix("/tmp/tmp_git".to_string());
262 let repo_path = repo_dir.path();
263
264 git::clone_at_commit(
265 &"https://github.com/Qovery/engine-testing-lfs.git".parse().unwrap(),
266 VALID_COMMIT,
267 &repo_path,
268 &|_| Vec::new(),
269 false,
270 )
271 .unwrap();
272
273 let file = std::fs::read(format!("{repo_path}/31eovo.mp4")).unwrap();
274 assert_ne!(file.len(), 4048871);
275
276 let cmd = GitLfs::default();
277 let ret = cmd.checkout_files_for_commit(&repo_path, VALID_COMMIT, &CommandKiller::never());
278 assert!(ret.is_ok());
279 let file = std::fs::read(format!("{repo_path}/31eovo.mp4")).unwrap();
280 assert_eq!(file.len(), 4048871);
281 }
282
283 // Invalid commit
284 {
285 let repo_dir = DirectoryForTests::new_with_random_suffix("/tmp/tmp_git".to_string());
286 let repo_path = repo_dir.path();
287
288 git::clone_at_commit(
289 &"https://github.com/Qovery/engine-testing-lfs.git".parse().unwrap(),
290 VALID_COMMIT,
291 &repo_path,
292 &|_| Vec::new(),

Callers

nothing calls this directly

Calls 4

clone_at_commitFunction · 0.85
pathMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected