Esempio n. 1
0
def _ssresults(*kwarg_list):
    return [
        ipc.SnapshotResult(progress=_progress_done,
                           hostname="host-{i}",
                           start=utils.now(),
                           **kw) for i, kw in enumerate(kwarg_list, 1)
    ]
Esempio n. 2
0
def test_node_to_backup_index(node_azlist, backup_azlist, expected_index,
                              exception):
    nodes = [CoordinatorNode(url="unused", az=az) for az in node_azlist]
    manifest = ipc.BackupManifest(
        start=utils.now(),
        attempt=1,
        snapshot_results=[ipc.SnapshotResult(az=az) for az in backup_azlist],
        upload_results=[],
        plugin="files")

    op = DummyRestoreOp(nodes, manifest)
    with exception:
        op.assert_node_to_backup_index_is(expected_index)
Esempio n. 3
0
def test_partial_node_to_backup_index(partial_node_spec, expected_index,
                                      exception):
    num_nodes = 3
    nodes = [CoordinatorNode(url=f"url{i}") for i in range(num_nodes)]
    manifest = ipc.BackupManifest(start=utils.now(),
                                  attempt=1,
                                  snapshot_results=[
                                      ipc.SnapshotResult(hostname=f"host{i}")
                                      for i in range(num_nodes)
                                  ],
                                  upload_results=[],
                                  plugin="files")
    op = DummyRestoreOp(nodes, manifest)
    with exception:
        op.req.partial_restore_nodes = [
            ipc.PartialRestoreRequestNode.parse_obj(partial_node_spec)
        ]
        op.assert_node_to_backup_index_is(expected_index)
Esempio n. 4
0
import respx

BACKUP_NAME = "dummybackup"

BACKUP_MANIFEST = ipc.BackupManifest(
    start="2020-01-01 21:43:00Z",
    end="2020-02-02 12:34:56Z",
    attempt=1,
    snapshot_results=[
        ipc.SnapshotResult(
            state=ipc.SnapshotState(root_globs=["*"],
                                    files=[
                                        ipc.SnapshotFile(
                                            relative_path=Path("foo"),
                                            file_size=6,
                                            mtime_ns=0,
                                            hexdigest="DEADBEEF")
                                    ]),
            hashes=[ipc.SnapshotHash(hexdigest="DEADBEEF", size=6)],
            files=1,
            total_size=6,
        )
    ],
    upload_results=[
        ipc.SnapshotUploadResult(total_size=6, total_stored_size=10),
    ],
    plugin="files",
)


@dataclass
Esempio n. 5
0
 def create_result(self):
     return ipc.SnapshotResult()