Fixed initial sync

This commit is contained in:
daladim 2021-04-04 00:35:59 +02:00
parent 842e34fb85
commit f2dd528d33
9 changed files with 233 additions and 62 deletions

View file

@ -17,6 +17,7 @@ use crate::traits::BaseCalendar;
use crate::traits::CompleteCalendar; use crate::traits::CompleteCalendar;
use crate::calendar::cached_calendar::CachedCalendar; use crate::calendar::cached_calendar::CachedCalendar;
use crate::calendar::CalendarId; use crate::calendar::CalendarId;
use crate::calendar::SupportedComponents;
const MAIN_FILE: &str = "data.json"; const MAIN_FILE: &str = "data.json";
@ -25,6 +26,9 @@ const MAIN_FILE: &str = "data.json";
pub struct Cache { pub struct Cache {
backing_folder: PathBuf, backing_folder: PathBuf,
data: CachedData, data: CachedData,
#[cfg(feature = "local_calendar_mocks_remote_calendars")]
is_mocking_remote_source: bool,
} }
#[derive(Default, Debug, Serialize, Deserialize)] #[derive(Default, Debug, Serialize, Deserialize)]
@ -34,6 +38,13 @@ struct CachedData {
} }
impl Cache { impl Cache {
/// Activate the "mocking remote source" features (i.e. tell its children calendars that they are mocked remote calendars)
#[cfg(feature = "local_calendar_mocks_remote_calendars")]
pub fn set_is_mocking_remote_source(&mut self) {
self.is_mocking_remote_source = true;
}
/// Get the path to the cache folder /// Get the path to the cache folder
pub fn cache_folder() -> PathBuf { pub fn cache_folder() -> PathBuf {
return PathBuf::from(String::from("~/.config/my-tasks/cache/")) return PathBuf::from(String::from("~/.config/my-tasks/cache/"))
@ -78,6 +89,9 @@ impl Cache {
Ok(Self{ Ok(Self{
backing_folder: PathBuf::from(folder), backing_folder: PathBuf::from(folder),
data, data,
#[cfg(feature = "local_calendar_mocks_remote_calendars")]
is_mocking_remote_source: false,
}) })
} }
@ -91,6 +105,9 @@ impl Cache {
Self{ Self{
backing_folder: PathBuf::from(folder_path), backing_folder: PathBuf::from(folder_path),
data: CachedData::default(), data: CachedData::default(),
#[cfg(feature = "local_calendar_mocks_remote_calendars")]
is_mocking_remote_source: false,
} }
} }
@ -198,13 +215,19 @@ impl CalDavSource<CachedCalendar> for Cache {
self.data.calendars.get(id).map(|arc| arc.clone()) self.data.calendars.get(id).map(|arc| arc.clone())
} }
async fn insert_calendar(&mut self, new_calendar: CachedCalendar) -> Result<Arc<Mutex<CachedCalendar>>, Box<dyn Error>> { async fn create_calendar(&mut self, id: CalendarId, name: String, supported_components: SupportedComponents) -> Result<Arc<Mutex<CachedCalendar>>, Box<dyn Error>> {
let id = new_calendar.id().clone();
log::debug!("Inserting local calendar {}", id); log::debug!("Inserting local calendar {}", id);
let new_calendar = CachedCalendar::new(name, id.clone(), supported_components);
let arc = Arc::new(Mutex::new(new_calendar)); let arc = Arc::new(Mutex::new(new_calendar));
#[cfg(feature = "local_calendar_mocks_remote_calendars")]
if self.is_mocking_remote_source {
arc.lock().unwrap().set_is_mocking_remote_calendar();
}
match self.data.calendars.insert(id, arc.clone()) { match self.data.calendars.insert(id, arc.clone()) {
Some(_) => Err("Attempt to insert calendar failed: there is alredy such a calendar.".into()), Some(_) => Err("Attempt to insert calendar failed: there is alredy such a calendar.".into()),
None => Ok(arc) , None => Ok(arc),
} }
} }
} }
@ -224,10 +247,11 @@ mod tests {
let mut cache = Cache::new(&cache_path); let mut cache = Cache::new(&cache_path);
let cal1 = CachedCalendar::new("shopping list".to_string(), let _ = cache.create_calendar(
Url::parse("https://caldav.com/shopping").unwrap(), Url::parse("https://caldav.com/shopping").unwrap(),
SupportedComponents::TODO); "shopping list".to_string(),
cache.insert_calendar(cal1).await.unwrap(); SupportedComponents::TODO,
).await.unwrap();
cache.save_to_folder().unwrap(); cache.save_to_folder().unwrap();

View file

@ -156,11 +156,16 @@ impl CompleteCalendar for CachedCalendar {
#[cfg(feature = "local_calendar_mocks_remote_calendars")] #[cfg(feature = "local_calendar_mocks_remote_calendars")]
use crate::{item::VersionTag, use crate::{item::VersionTag,
traits::DavCalendar}; traits::DavCalendar,
resource::Resource};
#[cfg(feature = "local_calendar_mocks_remote_calendars")] #[cfg(feature = "local_calendar_mocks_remote_calendars")]
#[async_trait] #[async_trait]
impl DavCalendar for CachedCalendar { impl DavCalendar for CachedCalendar {
fn new(name: String, resource: Resource, supported_components: SupportedComponents) -> Self {
crate::traits::CompleteCalendar::new(name, resource.url().clone(), supported_components)
}
async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>> { async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>> {
use crate::item::SyncStatus; use crate::item::SyncStatus;

View file

@ -40,15 +40,6 @@ pub struct RemoteCalendar {
cached_version_tags: Mutex<Option<HashMap<ItemId, VersionTag>>>, cached_version_tags: Mutex<Option<HashMap<ItemId, VersionTag>>>,
} }
impl RemoteCalendar {
pub fn new(name: String, resource: Resource, supported_components: SupportedComponents) -> Self {
Self {
name, resource, supported_components,
cached_version_tags: Mutex::new(None),
}
}
}
#[async_trait] #[async_trait]
impl BaseCalendar for RemoteCalendar { impl BaseCalendar for RemoteCalendar {
fn name(&self) -> &str { &self.name } fn name(&self) -> &str { &self.name }
@ -65,6 +56,14 @@ impl BaseCalendar for RemoteCalendar {
#[async_trait] #[async_trait]
impl DavCalendar for RemoteCalendar { impl DavCalendar for RemoteCalendar {
fn new(name: String, resource: Resource, supported_components: SupportedComponents) -> Self {
Self {
name, resource, supported_components,
cached_version_tags: Mutex::new(None),
}
}
async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>> { async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>> {
if let Some(map) = &*self.cached_version_tags.lock().unwrap() { if let Some(map) = &*self.cached_version_tags.lock().unwrap() {
log::debug!("Version tags are already cached."); log::debug!("Version tags are already cached.");

View file

@ -14,8 +14,10 @@ use crate::resource::Resource;
use crate::utils::{find_elem, find_elems}; use crate::utils::{find_elem, find_elems};
use crate::calendar::remote_calendar::RemoteCalendar; use crate::calendar::remote_calendar::RemoteCalendar;
use crate::calendar::CalendarId; use crate::calendar::CalendarId;
use crate::calendar::SupportedComponents;
use crate::traits::CalDavSource; use crate::traits::CalDavSource;
use crate::traits::BaseCalendar; use crate::traits::BaseCalendar;
use crate::traits::DavCalendar;
static DAVCLIENT_BODY: &str = r#" static DAVCLIENT_BODY: &str = r#"
@ -222,17 +224,17 @@ impl CalDavSource<RemoteCalendar> for Client {
}; };
} }
async fn get_calendar(&self, id: &CalendarId) -> Option<Arc<Mutex<RemoteCalendar>>> { async fn get_calendar(&self, id: &CalendarId) -> Option<Arc<Mutex<RemoteCalendar>>> {
self.cached_replies.lock().unwrap() self.cached_replies.lock().unwrap()
.calendars .calendars
.as_ref() .as_ref()
.and_then(|cals| cals.get(id)) .and_then(|cals| cals.get(id))
.map(|cal| cal.clone()) .map(|cal| cal.clone())
} }
async fn insert_calendar(&mut self, _new_calendar: RemoteCalendar) -> Result<Arc<Mutex<RemoteCalendar>>, Box<dyn Error>> { async fn create_calendar(&mut self, id: CalendarId, name: String, supported_components: SupportedComponents) -> Result<Arc<Mutex<RemoteCalendar>>, Box<dyn Error>> {
todo!(); todo!();
} }
} }

View file

@ -9,6 +9,7 @@ use crate::traits::{CalDavSource, DavCalendar};
use crate::traits::CompleteCalendar; use crate::traits::CompleteCalendar;
use crate::item::SyncStatus; use crate::item::SyncStatus;
use crate::calendar::SupportedComponents; use crate::calendar::SupportedComponents;
use crate::calendar::CalendarId;
/// A data source that combines two `CalDavSource`s (usually a server and a local cache), which is able to sync both sources. /// A data source that combines two `CalDavSource`s (usually a server and a local cache), which is able to sync both sources.
/// This can be used for integration tests, where the remote source is mocked by a `Cache`. /// This can be used for integration tests, where the remote source is mocked by a `Cache`.
@ -57,22 +58,27 @@ where
pub async fn sync(&mut self) -> Result<(), Box<dyn Error>> { pub async fn sync(&mut self) -> Result<(), Box<dyn Error>> {
log::info!("Starting a sync."); log::info!("Starting a sync.");
let mut handled_calendars = HashSet::new();
// Sync every remote calendar
let cals_remote = self.remote.get_calendars().await?; let cals_remote = self.remote.get_calendars().await?;
for (cal_id, cal_remote) in cals_remote { for (cal_id, cal_remote) in cals_remote {
let cal_local = loop { let cal_local = self.get_or_insert_local_counterpart_calendar(&cal_id).await;
if let Some(cal) = self.local.get_calendar(&cal_id).await {
break cal;
}
// This calendar does not exist locally yet, let's add it if let Err(err) = Self::sync_calendar_pair(cal_local, cal_remote).await {
log::error!("TODO: what name/SP should we choose?"); log::warn!("Unable to sync calendar {}: {}, skipping this time.", cal_id, err);
let new_calendar = T::new(String::from("new calendar"), cal_id.clone(), SupportedComponents::TODO); }
handled_calendars.insert(cal_id);
}
if let Err(err) = self.local.insert_calendar(new_calendar).await { // Sync every local calendar that would not be in the remote yet
log::warn!("Unable to create local calendar {}: {}. Skipping it.", cal_id, err); let cals_local = self.local.get_calendars().await?;
continue; for (cal_id, cal_local) in cals_local {
} if handled_calendars.contains(&cal_id) {
}; continue;
}
let cal_remote = self.get_or_insert_remote_counterpart_calendar(&cal_id).await;
if let Err(err) = Self::sync_calendar_pair(cal_local, cal_remote).await { if let Err(err) = Self::sync_calendar_pair(cal_local, cal_remote).await {
log::warn!("Unable to sync calendar {}: {}, skipping this time.", cal_id, err); log::warn!("Unable to sync calendar {}: {}, skipping this time.", cal_id, err);
@ -83,6 +89,46 @@ where
} }
async fn get_or_insert_local_counterpart_calendar(&mut self, cal_id: &CalendarId) -> Arc<Mutex<T>> {
loop {
if let Some(cal) = self.local.get_calendar(&cal_id).await {
break cal;
}
// This calendar does not exist locally yet, let's add it
log::debug!("Adding a local calendar {}", cal_id);
if let Err(err) = self.local.create_calendar(
cal_id.clone(),
String::from("new calendar"),
SupportedComponents::TODO,
).await {
log::warn!("Unable to create local calendar {}: {}. Skipping it.", cal_id, err);
continue;
}
}
}
async fn get_or_insert_remote_counterpart_calendar(&mut self, cal_id: &CalendarId) -> Arc<Mutex<U>> {
loop {
if let Some(cal) = self.remote.get_calendar(&cal_id).await {
break cal;
}
// This calendar does not exist in the remote yet, let's add it
log::debug!("Adding a remote calendar {}", cal_id);
if let Err(err) = self.remote.create_calendar(
cal_id.clone(),
String::from("new calendar"),
SupportedComponents::TODO,
).await {
log::warn!("Unable to create remote calendar {}: {}. Skipping it.", cal_id, err);
continue;
}
}
}
async fn sync_calendar_pair(cal_local: Arc<Mutex<T>>, cal_remote: Arc<Mutex<U>>) -> Result<(), Box<dyn Error>> { async fn sync_calendar_pair(cal_local: Arc<Mutex<T>>, cal_remote: Arc<Mutex<U>>) -> Result<(), Box<dyn Error>> {
let mut cal_remote = cal_remote.lock().unwrap(); let mut cal_remote = cal_remote.lock().unwrap();
let mut cal_local = cal_local.lock().unwrap(); let mut cal_local = cal_local.lock().unwrap();

View file

@ -10,6 +10,7 @@ use crate::item::ItemId;
use crate::item::VersionTag; use crate::item::VersionTag;
use crate::calendar::CalendarId; use crate::calendar::CalendarId;
use crate::calendar::SupportedComponents; use crate::calendar::SupportedComponents;
use crate::resource::Resource;
/// This trait must be implemented by data sources (either local caches or remote CalDAV clients) /// This trait must be implemented by data sources (either local caches or remote CalDAV clients)
#[async_trait] #[async_trait]
@ -19,8 +20,9 @@ pub trait CalDavSource<T: BaseCalendar> {
async fn get_calendars(&self) -> Result<HashMap<CalendarId, Arc<Mutex<T>>>, Box<dyn Error>>; async fn get_calendars(&self) -> Result<HashMap<CalendarId, Arc<Mutex<T>>>, Box<dyn Error>>;
/// Returns the calendar matching the ID /// Returns the calendar matching the ID
async fn get_calendar(&self, id: &CalendarId) -> Option<Arc<Mutex<T>>>; async fn get_calendar(&self, id: &CalendarId) -> Option<Arc<Mutex<T>>>;
/// Insert a calendar if it did not exist, and return it /// Create a calendar if it did not exist, and return it
async fn insert_calendar(&mut self, new_calendar: T) -> Result<Arc<Mutex<T>>, Box<dyn Error>>; async fn create_calendar(&mut self, id: CalendarId, name: String, supported_components: SupportedComponents)
-> Result<Arc<Mutex<T>>, Box<dyn Error>>;
} }
/// This trait contains functions that are common to all calendars /// This trait contains functions that are common to all calendars
@ -55,6 +57,9 @@ pub trait BaseCalendar {
/// Functions availabe for calendars that are backed by a CalDAV server /// Functions availabe for calendars that are backed by a CalDAV server
#[async_trait] #[async_trait]
pub trait DavCalendar : BaseCalendar { pub trait DavCalendar : BaseCalendar {
/// Create a new calendar
fn new(name: String, resource: Resource, supported_components: SupportedComponents) -> Self;
/// Get the IDs and the version tags of every item in this calendar /// Get the IDs and the version tags of every item in this calendar
async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>>; async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>>;

View file

@ -99,19 +99,14 @@ where
pub fn print_task(item: &Item) { pub fn print_task(item: &Item) {
match item { match item {
Item::Task(task) => { Item::Task(task) => {
let mut status = String::new(); let completion = if task.completed() { "" } else { " " };
if task.completed() { let sync = match task.sync_status() {
status += ""; SyncStatus::NotSynced => ".",
} else { SyncStatus::Synced(_) => "=",
status += " "; SyncStatus::LocallyModified(_) => "~",
} SyncStatus::LocallyDeleted(_) => "x",
match task.sync_status() { };
SyncStatus::NotSynced => { status += " "; }, println!(" {}{} {}\t{}", completion, sync, task.name(), task.id());
SyncStatus::Synced(_) => { status += "="; },
SyncStatus::LocallyModified(_) => { status += "~"; },
SyncStatus::LocallyDeleted(_) => { status += "x"; },
}
println!(" {} {}\t{}", status, task.name(), task.id());
}, },
_ => return, _ => return,
} }

View file

@ -83,6 +83,13 @@ pub fn scenarii_basic() -> Vec<ItemScenario> {
let main_cal = CalendarId::from("https://some.calend.ar/main/".parse().unwrap()); let main_cal = CalendarId::from("https://some.calend.ar/main/".parse().unwrap());
//
//
//
//
// TODO: add new calendars, with or without taks in them
//
tasks.push( tasks.push(
ItemScenario { ItemScenario {
id: ItemId::random(), id: ItemId::random(),
@ -440,6 +447,71 @@ pub fn scenarii_first_sync_to_local() -> Vec<ItemScenario> {
tasks tasks
} }
/// This scenario basically checks a first sync to an empty server
pub fn scenarii_first_sync_to_server() -> Vec<ItemScenario> {
let mut tasks = Vec::new();
let cal3 = CalendarId::from("https://some.calend.ar/third/".parse().unwrap());
let cal4 = CalendarId::from("https://some.calend.ar/fourth/".parse().unwrap());
tasks.push(
ItemScenario {
id: ItemId::random(),
initial_state: LocatedState::Local( ItemState{
calendar: cal3.clone(),
name: String::from("Task A3"),
completed: false,
}),
local_changes_to_apply: Vec::new(),
remote_changes_to_apply: Vec::new(),
after_sync: LocatedState::BothSynced( ItemState{
calendar: cal3.clone(),
name: String::from("Task A3"),
completed: false,
}),
}
);
tasks.push(
ItemScenario {
id: ItemId::random(),
initial_state: LocatedState::Local( ItemState{
calendar: cal4.clone(),
name: String::from("Task A4"),
completed: false,
}),
local_changes_to_apply: Vec::new(),
remote_changes_to_apply: Vec::new(),
after_sync: LocatedState::BothSynced( ItemState{
calendar: cal4.clone(),
name: String::from("Task A4"),
completed: false,
}),
}
);
tasks.push(
ItemScenario {
id: ItemId::random(),
initial_state: LocatedState::Local( ItemState{
calendar: cal3.clone(),
name: String::from("Task B3"),
completed: false,
}),
local_changes_to_apply: Vec::new(),
remote_changes_to_apply: Vec::new(),
after_sync: LocatedState::BothSynced( ItemState{
calendar: cal3.clone(),
name: String::from("Task B3"),
completed: false,
}),
}
);
tasks
}
/// Build a `Provider` that contains the data (defined in the given scenarii) before sync /// Build a `Provider` that contains the data (defined in the given scenarii) before sync
pub async fn populate_test_provider_before_sync(scenarii: &[ItemScenario]) -> Provider<Cache, CachedCalendar, Cache, CachedCalendar> { pub async fn populate_test_provider_before_sync(scenarii: &[ItemScenario]) -> Provider<Cache, CachedCalendar, Cache, CachedCalendar> {
let mut provider = populate_test_provider(scenarii, false).await; let mut provider = populate_test_provider(scenarii, false).await;
@ -453,8 +525,9 @@ pub async fn populate_test_provider_after_sync(scenarii: &[ItemScenario]) -> Pro
} }
async fn populate_test_provider(scenarii: &[ItemScenario], populate_for_final_state: bool) -> Provider<Cache, CachedCalendar, Cache, CachedCalendar> { async fn populate_test_provider(scenarii: &[ItemScenario], populate_for_final_state: bool) -> Provider<Cache, CachedCalendar, Cache, CachedCalendar> {
let mut remote = Cache::new(&PathBuf::from(String::from("test_cache_remote/")));
let mut local = Cache::new(&PathBuf::from(String::from("test_cache_local/"))); let mut local = Cache::new(&PathBuf::from(String::from("test_cache_local/")));
let mut remote = Cache::new(&PathBuf::from(String::from("test_cache_remote/")));
remote.set_is_mocking_remote_source();
// Create the initial state, as if we synced both sources in a given state // Create the initial state, as if we synced both sources in a given state
for item in scenarii { for item in scenarii {
@ -483,14 +556,14 @@ async fn populate_test_provider(scenarii: &[ItemScenario], populate_for_final_st
match required_state { match required_state {
LocatedState::None => panic!("Should not happen, we've continued already"), LocatedState::None => panic!("Should not happen, we've continued already"),
LocatedState::Local(s) => { LocatedState::Local(s) => {
get_or_insert_calendar(&mut local, &s.calendar, false).await.unwrap().lock().unwrap().add_item(new_item).await.unwrap(); get_or_insert_calendar(&mut local, &s.calendar).await.unwrap().lock().unwrap().add_item(new_item).await.unwrap();
}, },
LocatedState::Remote(s) => { LocatedState::Remote(s) => {
get_or_insert_calendar(&mut remote, &s.calendar, true).await.unwrap().lock().unwrap().add_item(new_item).await.unwrap(); get_or_insert_calendar(&mut remote, &s.calendar).await.unwrap().lock().unwrap().add_item(new_item).await.unwrap();
}, },
LocatedState::BothSynced(s) => { LocatedState::BothSynced(s) => {
get_or_insert_calendar(&mut local, &s.calendar, false).await.unwrap().lock().unwrap().add_item(new_item.clone()).await.unwrap(); get_or_insert_calendar(&mut local, &s.calendar).await.unwrap().lock().unwrap().add_item(new_item.clone()).await.unwrap();
get_or_insert_calendar(&mut remote, &s.calendar, true).await.unwrap().lock().unwrap().add_item(new_item).await.unwrap(); get_or_insert_calendar(&mut remote, &s.calendar).await.unwrap().lock().unwrap().add_item(new_item).await.unwrap();
}, },
} }
} }
@ -518,7 +591,7 @@ async fn apply_changes_on_provider(provider: &mut Provider<Cache, CachedCalendar
} }
} }
async fn get_or_insert_calendar(source: &mut Cache, id: &CalendarId, should_mock_remote_calendar: bool) async fn get_or_insert_calendar(source: &mut Cache, id: &CalendarId)
-> Result<Arc<Mutex<CachedCalendar>>, Box<dyn Error>> -> Result<Arc<Mutex<CachedCalendar>>, Box<dyn Error>>
{ {
match source.get_calendar(id).await { match source.get_calendar(id).await {
@ -526,11 +599,12 @@ async fn get_or_insert_calendar(source: &mut Cache, id: &CalendarId, should_mock
None => { None => {
let new_name = format!("Calendar for ID {}", id); let new_name = format!("Calendar for ID {}", id);
let supported_components = SupportedComponents::TODO; let supported_components = SupportedComponents::TODO;
let mut cal = CachedCalendar::new(new_name.to_string(), id.clone(), supported_components);
if should_mock_remote_calendar { source.create_calendar(
cal.set_is_mocking_remote_calendar(); id.clone(),
} new_name.to_string(),
source.insert_calendar(cal).await supported_components,
).await
} }
} }
} }

View file

@ -1,9 +1,5 @@
mod scenarii; mod scenarii;
use my_tasks::traits::CalDavSource;
use my_tasks::Provider;
use my_tasks::cache::Cache;
use my_tasks::calendar::cached_calendar::CachedCalendar;
@ -19,6 +15,8 @@ impl TestFlavour {
pub fn normal() -> Self { Self{} } pub fn normal() -> Self { Self{} }
#[cfg(not(feature = "local_calendar_mocks_remote_calendars"))] #[cfg(not(feature = "local_calendar_mocks_remote_calendars"))]
pub fn first_sync_to_local() -> Self { Self{} } pub fn first_sync_to_local() -> Self { Self{} }
#[cfg(not(feature = "local_calendar_mocks_remote_calendars"))]
pub fn first_sync_to_server() -> Self { Self{} }
#[cfg(feature = "local_calendar_mocks_remote_calendars")] #[cfg(feature = "local_calendar_mocks_remote_calendars")]
pub fn normal() -> Self { pub fn normal() -> Self {
@ -34,6 +32,13 @@ impl TestFlavour {
} }
} }
#[cfg(feature = "local_calendar_mocks_remote_calendars")]
pub fn first_sync_to_server() -> Self {
Self {
scenarii: scenarii::scenarii_first_sync_to_server(),
}
}
#[cfg(not(feature = "local_calendar_mocks_remote_calendars"))] #[cfg(not(feature = "local_calendar_mocks_remote_calendars"))]
pub async fn run(&self) { pub async fn run(&self) {
@ -83,6 +88,22 @@ async fn test_sync_empty_initial_local() {
flavour.run().await; flavour.run().await;
} }
#[tokio::test]
async fn test_sync_empty_initial_server() {
let _ = env_logger::builder().is_test(true).try_init();
let flavour = TestFlavour::first_sync_to_server();
flavour.run().await;
}
#[cfg(feature = "integration_tests")]
use my_tasks::{traits::CalDavSource,
Provider,
cache::Cache,
calendar::cached_calendar::CachedCalendar,
};
/// Print the contents of the provider. This is usually used for debugging /// Print the contents of the provider. This is usually used for debugging
#[allow(dead_code)] #[allow(dead_code)]
#[cfg(feature = "integration_tests")] #[cfg(feature = "integration_tests")]