Add test for generating static delta to file

This commit is contained in:
Manuel Stühn 2022-06-30 09:06:30 +02:00 committed by Luca BRUNO
parent a335a780a9
commit 14f513cf02
No known key found for this signature in database
GPG Key ID: A9834A2252078E4E
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,42 @@
use crate::util::*;
use gio::NONE_CANCELLABLE;
use ostree::glib::prelude::*;
use ostree::glib::Variant;
use ostree::*;
use std::collections::HashMap;
#[test]
fn should_generate_static_delta_at() {
let mut options: HashMap<String, Variant> = HashMap::<String, Variant>::new();
let delta_dir = tempfile::tempdir().expect("static delta dir");
let delta_path = delta_dir.path().join("static_delta.file");
let path_var = delta_path
.to_str()
.expect("no valid path")
.as_bytes()
.to_variant();
let test_repo = TestRepo::new();
let from = test_repo.test_commit("commit1");
let to = test_repo.test_commit("commit2");
options.insert(String::from("filename"), path_var);
let varopts = &options.to_variant();
let _result = test_repo
.repo
.static_delta_generate(
ostree::StaticDeltaGenerateOpt::Major,
Some(&from),
&to,
None,
Some(varopts),
NONE_CANCELLABLE,
)
.expect("static delta generate");
assert!(std::fs::File::open(&delta_path).is_err());
}

View File

@ -5,6 +5,7 @@ use ostree::{ObjectName, ObjectType};
#[cfg(feature = "v2016_8")]
mod checkout_at;
mod generate_static;
#[test]
fn should_commit_content_to_repo_and_list_refs_again() {