Skip to content

Commit c03c079

Browse files
Alenardlachaume
andcommitted
test(aggregator): add FileArchive::dummy to simplify tests were its value is irrelevant
Co-authored-by: Damien Lachaume <[email protected]>
1 parent 11307af commit c03c079

File tree

3 files changed

+15
-36
lines changed

3 files changed

+15
-36
lines changed

mithril-aggregator/src/artifact_builder/cardano_database_artifacts/ancillary.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,7 @@ mod tests {
325325
)
326326
.unwrap();
327327

328-
let _ = builder
329-
.upload_ancillary_archive(FileArchive::new(
330-
PathBuf::from("archive_path"),
331-
0,
332-
CompressionAlgorithm::default(),
333-
))
334-
.await;
328+
let _ = builder.upload_ancillary_archive(FileArchive::dummy()).await;
335329
}
336330

337331
let logs = std::fs::read_to_string(&log_path).unwrap();
@@ -350,13 +344,7 @@ mod tests {
350344
)
351345
.unwrap();
352346

353-
let result = builder
354-
.upload_ancillary_archive(FileArchive::new(
355-
PathBuf::from("archive_path"),
356-
0,
357-
CompressionAlgorithm::default(),
358-
))
359-
.await;
347+
let result = builder.upload_ancillary_archive(FileArchive::dummy()).await;
360348

361349
assert!(
362350
result.is_err(),

mithril-aggregator/src/artifact_builder/cardano_database_artifacts/digest.rs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,7 @@ mod tests {
479479
)
480480
.unwrap();
481481

482-
let _ = builder
483-
.upload_digest_file(&FileArchive::new(
484-
PathBuf::from("digest_file"),
485-
0,
486-
CompressionAlgorithm::Gzip,
487-
))
488-
.await;
482+
let _ = builder.upload_digest_file(&FileArchive::dummy()).await;
489483
}
490484

491485
let logs = std::fs::read_to_string(&log_path).unwrap();
@@ -513,11 +507,7 @@ mod tests {
513507
.unwrap();
514508

515509
let locations = builder
516-
.upload_digest_file(&FileArchive::new(
517-
PathBuf::from("digest_file"),
518-
0,
519-
CompressionAlgorithm::Gzip,
520-
))
510+
.upload_digest_file(&FileArchive::dummy())
521511
.await
522512
.unwrap();
523513

@@ -553,11 +543,7 @@ mod tests {
553543
.unwrap();
554544

555545
let locations = builder
556-
.upload_digest_file(&FileArchive::new(
557-
PathBuf::from("digest_file"),
558-
0,
559-
CompressionAlgorithm::Gzip,
560-
))
546+
.upload_digest_file(&FileArchive::dummy())
561547
.await
562548
.unwrap();
563549

@@ -600,11 +586,7 @@ mod tests {
600586
.unwrap();
601587

602588
let locations = builder
603-
.upload_digest_file(&FileArchive::new(
604-
PathBuf::from("digest_file"),
605-
0,
606-
CompressionAlgorithm::Gzip,
607-
))
589+
.upload_digest_file(&FileArchive::dummy())
608590
.await
609591
.unwrap();
610592

mithril-aggregator/src/tools/file_archiver/entities.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ impl FileArchive {
4848
}
4949
}
5050

51+
#[cfg(test)]
52+
pub fn dummy() -> Self {
53+
Self {
54+
filepath: PathBuf::from("archive.tar.gz"),
55+
archive_filesize: 10,
56+
compression_algorithm: CompressionAlgorithm::Gzip,
57+
}
58+
}
59+
5160
/// Get the path of the archive.
5261
pub fn get_file_path(&self) -> &Path {
5362
&self.filepath

0 commit comments

Comments
 (0)