| 483 | |
| 484 | #[test] |
| 485 | fn test_git_checkout() { |
| 486 | let clone_dir = DirectoryForTests::new_with_random_suffix("/tmp/engine_test_checkout".to_string()); |
| 487 | let valid_commit = "9a9c1f4373c8128151a9def9ea3d838fa2ed33e8"; |
| 488 | let repo = fetch( |
| 489 | &Url::parse("https://github.com/Qovery/engine-testing.git").unwrap(), |
| 490 | clone_dir.path(), |
| 491 | &|_| vec![], |
| 492 | valid_commit, |
| 493 | ) |
| 494 | .unwrap(); |
| 495 | |
| 496 | // Invalid commit for this repository |
| 497 | let check = checkout(&repo, "c2c2101f8e4c4ffadb326dc440ba8afb4aeb1310"); |
| 498 | assert!(matches!(check, Err(_err))); |
| 499 | |
| 500 | // Valid commit |
| 501 | let check = checkout(&repo, valid_commit); |
| 502 | assert!(check.is_ok()); |
| 503 | assert_eq!(repo.head().unwrap().target().unwrap().to_string(), valid_commit); |
| 504 | } |
| 505 | |
| 506 | #[test] |
| 507 | fn test_git_file_content_at_commit() { |