()
| 523 | |
| 524 | #[test] |
| 525 | fn test_dockerignore_negation() { |
| 526 | let dir = tempfile::tempdir().unwrap(); |
| 527 | let dir_path = dir.path(); |
| 528 | |
| 529 | fs::write(dir_path.join("Dockerfile"), "FROM ubuntu:24.04\n").unwrap(); |
| 530 | fs::write(dir_path.join("a.log"), "log\n").unwrap(); |
| 531 | fs::write(dir_path.join("important.log"), "keep\n").unwrap(); |
| 532 | fs::write(dir_path.join(".dockerignore"), "*.log\n!important.log\n").unwrap(); |
| 533 | |
| 534 | let tar_bytes = create_build_context_tar(dir_path).unwrap(); |
| 535 | let mut archive = tar::Archive::new(tar_bytes.as_slice()); |
| 536 | let entries: Vec<String> = archive |
| 537 | .entries() |
| 538 | .unwrap() |
| 539 | .filter_map(std::result::Result::ok) |
| 540 | .map(|e| e.path().unwrap().to_string_lossy().to_string()) |
| 541 | .collect(); |
| 542 | |
| 543 | assert!(!entries.iter().any(|e| e.contains("a.log"))); |
| 544 | assert!(entries.iter().any(|e| e.contains("important.log"))); |
| 545 | } |
| 546 | |
| 547 | #[test] |
| 548 | fn test_long_path_exceeding_100_bytes() { |
nothing calls this directly
no test coverage detected