M1: PHPUnit test suite for crypto, repository and resumable runs
Dev tooling via composer (phpunit, psalm, nextcloud/ocp); vendor/ is mounted from outside the repository by a helper script. 28 unit tests ported from the phase-0 spikes (round trips, corruption, wrong keys, dedup, incremental runs, partial restore, tampering, object binding, time-boxed steps, file changed between steps).
This commit is contained in:
@@ -272,7 +272,7 @@ final class Repository {
|
||||
private function storeBlob(string $data, PackWriter $packs, array &$stats): string {
|
||||
$id = $this->keys->blobId($data);
|
||||
if ($this->index->has($id)) {
|
||||
$stats['dupBlobs']++;
|
||||
$stats['dupBlobs'] = ($stats['dupBlobs'] ?? 0) + 1;
|
||||
return $id;
|
||||
}
|
||||
$flags = 0;
|
||||
@@ -282,8 +282,8 @@ final class Repository {
|
||||
$payload = $deflated;
|
||||
$flags |= self::FLAG_DEFLATE;
|
||||
}
|
||||
$stats['uploaded'] += $packs->add($id, $this->cipher->encryptString($payload, 'blob:' . $id), strlen($data), $flags);
|
||||
$stats['newBlobs']++;
|
||||
$stats['uploaded'] = ($stats['uploaded'] ?? 0) + $packs->add($id, $this->cipher->encryptString($payload, 'blob:' . $id), strlen($data), $flags);
|
||||
$stats['newBlobs'] = ($stats['newBlobs'] ?? 0) + 1;
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user