- (void) testDirCreate
{
MockFuse *mockFuse = [[MockFuse alloc] init];
SyncEngine *syncer = [Syncer engineWithFuseInstance:mockFuse];
// create folder (either via NSFileManager or system('mkdir ...'))
// Force sync (run sync logic)
// assert mock fuse 'create directory' method was called
}
// MockFuse methods
// attr tracks changes that the client has done, so the tests can verify the correct action was taken
NSMutableDictionary *attr = [[NSMutableDictionary alloc] init];
- (void) createDir:(NSString *)path {
// Probably better to set an attribute object here
[attr setObject:YES forKey:path];
}
- (BOOL) fileExistsAtPath:(NSString *)path {
return [attr objectForKey:path];
}
start_n_nodes 2
d1="$(mountpoint_for 1)"
d2="$(mountpoint_for 2)"
mkdir -p "$d1/a/b"
echo "x" > "$d1/a/b/c"
trigger_check 1 2
wait_until [ -f "$d2/a/b/c" ]
rm_dir_rec "$d1/a/b"
trigger_check 1 2
wait_until [ ! -f "$d2/a/b/c" ]
check mkdir "$d2/a/b"
trigger_check 2 1
wait_until [ -d "$d1/a/b" ]
stop_n_nodes 2