def test_get_config_sync_file_infos(): base_dir = cmk.utils.paths.omd_root / "replication" _create_get_config_sync_file_infos_test_config(base_dir) replication_paths = [ ReplicationPath("dir", "d1-empty", "etc/d1", []), ReplicationPath("dir", "d2-not-existing", "etc/d2", []), ReplicationPath("dir", "d3-single-file", "etc/d3", []), ReplicationPath("dir", "d4-multiple-files", "etc/d4", []), ReplicationPath("file", "f1-not-existing", "etc/f1", []), ReplicationPath("file", "f2", "bla/blub/f2", []), ReplicationPath("dir", "links", "links", []), ] sync_infos = activate_changes._get_config_sync_file_infos( replication_paths, base_dir) assert sync_infos == { "bla/blub/f2": ConfigSyncFileInfo( st_mode=33200, st_size=7, link_target=None, file_hash= "ae973806ace987a1889dc02cfa6b320912b68b6eb3929e425762795955990f35", ), "etc/d3/xyz": ConfigSyncFileInfo( st_mode=33200, st_size=5, link_target=None, file_hash= "780518619e3c5dfc931121362c7f14fa8d06457995c762bd818072ed42e6e69e", ), "etc/d4/layer1/layer2/x3.xyz": ConfigSyncFileInfo( st_mode=33200, st_size=6, link_target=None, file_hash= "c213b1ced86472704fdc0f77e15cc41f67341c4370def7a0ae9d90bedf37c8ca", ), "etc/d4/layer1/layer2/x4.xyz": ConfigSyncFileInfo( st_mode=33200, st_size=6, link_target=None, file_hash= "c213b1ced86472704fdc0f77e15cc41f67341c4370def7a0ae9d90bedf37c8ca", ), "etc/d4/x1": ConfigSyncFileInfo( st_mode=33200, st_size=6, link_target=None, file_hash= "1c77fe07e738fd6cbf0075195a773043a7507d53d6deeb1161549244c02ea0ff", ), "etc/d4/x2": ConfigSyncFileInfo( st_mode=33200, st_size=6, link_target=None, file_hash= "c213b1ced86472704fdc0f77e15cc41f67341c4370def7a0ae9d90bedf37c8ca", ), "etc/f1": ConfigSyncFileInfo( st_mode=33200, st_size=7, link_target=None, file_hash= "4dd985602450dfdeb261cedf8562cb62c5173d1d8bb5f3ca26cd3519add67cf7", ), "links/broken-symlink": ConfigSyncFileInfo( st_mode=41471, st_size=3, link_target="eeg", file_hash=None, ), "links/working-symlink-to-file": ConfigSyncFileInfo( st_mode=41471, st_size=13, link_target="../etc/d3/xyz", file_hash=None, ), "links/working-symlink-to-dir": ConfigSyncFileInfo( st_mode=41471, st_size=9, link_target="../etc/d3", file_hash=None, ), }
def _get_test_file_infos(): remote = { "remote-only": ConfigSyncFileInfo( st_mode=33200, st_size=2, link_target=None, file_hash= "9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa", ), "both": ConfigSyncFileInfo( st_mode=33200, st_size=37, link_target=None, file_hash= "3baece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), "both-differ-mode": ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash= "xbaece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), "both-differ-size": ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash= "xbaece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), "both-differ-hash": ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash= "xxxece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), "link-equal": ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target="abc", file_hash=None, ), "link-changed": ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target="abc", file_hash=None, ), "central-file-remote-link": ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash= "xxxece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), "central-link-remote-file": ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target="abc", file_hash=None, ), "central-link-remote-dir-with-file/file": ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash= "xxxece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), } central = { "central-only": ConfigSyncFileInfo( st_mode=33200, st_size=2, link_target=None, file_hash= "9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa", ), "both": ConfigSyncFileInfo( st_mode=33200, st_size=37, link_target=None, file_hash= "3baece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), "both-differ-mode": ConfigSyncFileInfo( st_mode=33202, st_size=36, link_target=None, file_hash= "xbaece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), "both-differ-size": ConfigSyncFileInfo( st_mode=33200, st_size=38, link_target=None, file_hash= "xbaece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), "both-differ-hash": ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash= "3baece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), "link-equal": ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target="abc", file_hash=None, ), "link-changed": ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target="/ddd/abc", file_hash=None, ), "central-file-remote-link": ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target="abc", file_hash=None, ), "central-link-remote-file": ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash= "3baece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08", ), "central-link-remote-dir-with-file": ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target="auuuuu", file_hash=None, ), } return remote, central
def _get_test_file_infos(): remote = { 'remote-only': ConfigSyncFileInfo( st_mode=33200, st_size=2, link_target=None, file_hash='9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa'), 'both': ConfigSyncFileInfo( st_mode=33200, st_size=37, link_target=None, file_hash='3baece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08'), 'both-differ-mode': ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash='xbaece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08'), 'both-differ-size': ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash='xbaece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08'), 'both-differ-hash': ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash='xxxece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08'), 'link-equal': ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target='abc', file_hash=None, ), 'link-changed': ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target='abc', file_hash=None, ), 'central-file-remote-link': ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash='xxxece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08', ), 'central-link-remote-file': ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target='abc', file_hash=None, ), 'central-link-remote-dir-with-file/file': ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash='xxxece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08', ), } central = { 'central-only': ConfigSyncFileInfo( st_mode=33200, st_size=2, link_target=None, file_hash='9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa'), 'both': ConfigSyncFileInfo( st_mode=33200, st_size=37, link_target=None, file_hash='3baece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08'), 'both-differ-mode': ConfigSyncFileInfo( st_mode=33202, st_size=36, link_target=None, file_hash='xbaece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08'), 'both-differ-size': ConfigSyncFileInfo( st_mode=33200, st_size=38, link_target=None, file_hash='xbaece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08'), 'both-differ-hash': ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash='3baece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08'), 'link-equal': ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target='abc', file_hash=None, ), 'link-changed': ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target='/ddd/abc', file_hash=None, ), 'central-file-remote-link': ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target='abc', file_hash=None, ), 'central-link-remote-file': ConfigSyncFileInfo( st_mode=33200, st_size=36, link_target=None, file_hash='3baece9027e3e7e034d693c1bcd4bc64c5171135d562295cd482920ed9c8eb08', ), 'central-link-remote-dir-with-file': ConfigSyncFileInfo( st_mode=41471, st_size=1, link_target='auuuuu', file_hash=None, ), } return remote, central