feat: add browser upload queue and trusted sessions with bounded projections
This commit is contained in:
1 parent
84d52390f9
commit
b90aef79d0
79 files changed
+1962
-196
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import {spawnSync} from 'node:child_process';
|
||||
import {pathToFileURL} from 'node:url';
|
||||
|
||||
export const images = ['pageswiki-app', 'pageswiki-adaptor-gateway', 'pageswiki-excalidraw-viewer'];
|
||||
export const images = ['pageswiki-app', 'pageswiki-adaptor-gateway', 'pageswiki-excalidraw-viewer', 'pageswiki-gecko-relay'];
|
||||
// SemVer 2.0.0: numeric prerelease identifiers cannot have leading zeroes.
|
||||
const number = '(0|[1-9][0-9]*)';
|
||||
const identifier = '(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)';
|
||||
|
||||
@@ -37,19 +37,19 @@ function registry() {
|
||||
return {client, entries, copies};
|
||||
}
|
||||
|
||||
test('promotes three sources by digest and retry does not rewrite', () => {
|
||||
test('promotes all sources by digest and retry does not rewrite', () => {
|
||||
const {client, copies} = registry();
|
||||
const plan = promote(options, client, () => {});
|
||||
assert.equal(copies.length, 3);
|
||||
assert.equal(copies.length, images.length);
|
||||
for (const item of plan) assert.ok(item.source.endsWith(`@${item.digest}`));
|
||||
promote(options, client, () => {});
|
||||
assert.equal(copies.length, 3);
|
||||
assert.equal(copies.length, images.length);
|
||||
});
|
||||
|
||||
test('missing source, wrong revision or existing release conflict prevents all writes', () => {
|
||||
for (const failure of ['missing', 'revision', 'conflict']) {
|
||||
const {client, entries, copies} = registry();
|
||||
const last = `${options.prefix}/${images[2]}`;
|
||||
const last = `${options.prefix}/${images.at(-1)}`;
|
||||
if (failure === 'missing') entries.delete(`${last}:sha-${revision}`);
|
||||
if (failure === 'revision') client.revision = () => 'b'.repeat(40);
|
||||
if (failure === 'conflict') entries.set(`${last}:v0.1.0`, `sha256:${'f'.repeat(64)}`);
|
||||
@@ -68,7 +68,7 @@ test('partial promotion is safely resumable', () => {
|
||||
assert.throws(() => promote(options, client, () => {}), /unavailable/);
|
||||
client.copy = copy;
|
||||
promote(options, client, () => {});
|
||||
assert.equal(copies.length, 3);
|
||||
assert.equal(copies.length, images.length);
|
||||
});
|
||||
|
||||
test('destination digest mismatch and concurrent overwrite are failures', () => {
|
||||
@@ -79,7 +79,7 @@ test('destination digest mismatch and concurrent overwrite are failures', () =>
|
||||
const get = other.client.digest;
|
||||
let reads = 0;
|
||||
other.client.digest = (ref, optional) => {
|
||||
if (ref.endsWith(':v0.1.0') && ++reads > 3) return `sha256:${'f'.repeat(64)}`;
|
||||
if (ref.endsWith(':v0.1.0') && ++reads > images.length) return `sha256:${'f'.repeat(64)}`;
|
||||
return get(ref, optional);
|
||||
};
|
||||
assert.throws(() => promote(options, other.client), /concurrently/);
|
||||
|
||||
Reference in new issue
Block a user