Files
memind/scripts/imgproxy-runtime-package.test.mjs
T
john 78e5a6c026
Memind CI / Test, build, and release guards (pull_request) Failing after 18s
feat(ops): add imgproxy native runtime tooling and record 103 deployment
Bundle vendored imgproxy with Mach-O dylibs for 103 launchd, fix install to exec the binary directly with launchctl enable, and document the live native release in the runtime topology.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-31 05:38:14 +08:00

72 lines
3.3 KiB
JavaScript

import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import test from 'node:test';
const root = path.resolve(import.meta.dirname, '..');
const read = (name) => fs.readFileSync(path.join(root, name), 'utf8');
test('imgproxy runtime pins an arm64 image digest', () => {
const dockerfile = read('docker/imgproxy-runtime/Dockerfile');
assert.match(dockerfile, /FROM darthsim\/imgproxy@sha256:[a-f0-9]{64}/);
});
test('builder reuses an already verified digest without a network pull', () => {
const builder = read('scripts/build-imgproxy-runtime-image.sh');
assert.match(builder, /docker image inspect "\$IMAGE_REF"/);
assert.match(builder, /shasum -a 256 imgproxy-runtime-image\.tar\.gz/);
});
test('installer uses a read-only storage mount and both required ports', () => {
const installer = read('scripts/install-imgproxy-runtime-prod.sh');
assert.match(installer, /-p 127\.0\.0\.1:20082:8080/);
assert.match(installer, /\$MINDSPACE_STORAGE_ROOT:\/mnt\/images:ro/);
assert.match(installer, /10\.10\.0\.2/);
assert.match(installer, /IMGPROXY_UPSTREAM/);
assert.match(installer, /DOCKER_BIN/);
assert.match(installer, /seq 1 20/);
});
test('release verifies checksums before loading the image and backs up launch state', () => {
const release = read('scripts/release-imgproxy-runtime-prod.sh');
assert.match(release, /shasum -a 256 -c/);
assert.match(release, /shasum -a 256 "imgproxy-runtime-\$RELEASE_ID\.tar\.gz"/);
assert.match(release, /"\$DOCKER_BIN" load/);
assert.match(release, /DOCKER_BIN/);
assert.match(release, /imgproxy-compat-\$RELEASE_ID\.plist/);
assert.match(release, /img\.tkmind\.cn\/health/);
assert.match(release, /release\/\*/);
assert.match(release, /rev-parse origin\/main/);
});
test('native builder vendors a pinned darwin arm64 imgproxy binary', () => {
const builder = read('scripts/build-imgproxy-runtime-native.sh');
assert.match(builder, /vendor\/imgproxy-runtime\/bin\/imgproxy/);
assert.match(builder, /vendor\/imgproxy-runtime\/lib/);
assert.match(builder, /bundle_mach_dylibs/);
assert.match(builder, /shasum -a 256 bin\/imgproxy VERSION\.txt lib\/\*/);
assert.match(builder, /IMGPROXY_SOURCE_BIN/);
assert.match(builder, /run-imgproxy-prod\.sh/);
});
test('native installer uses the vendored binary and retires docker imgproxy', () => {
const installer = read('scripts/install-imgproxy-native-prod.sh');
assert.match(installer, /vendor\/imgproxy-runtime\/bin\/imgproxy/);
assert.match(installer, /ProgramArguments/);
assert.match(installer, /IMGPROXY_KEY/);
assert.match(installer, /127\.0\.0\.1:20082/);
assert.match(installer, /10\.10\.0\.2/);
assert.match(installer, /"\$\{DOCKER_BIN\}" stop/);
assert.match(installer, /"\$\{DOCKER_BIN\}" rm -f/);
assert.match(installer, /cn\.tkmind\.imgproxy/);
});
test('native release bundles vendor artifacts and verifies health on 103', () => {
const release = read('scripts/release-imgproxy-native-prod.sh');
assert.match(release, /build-imgproxy-runtime-native\.sh/);
assert.match(release, /vendor\/imgproxy-runtime\/bin\/imgproxy/);
assert.match(release, /install-imgproxy-native-prod\.sh/);
assert.match(release, /imgproxy-native-runtime-\$RELEASE_ID\.tar\.gz/);
assert.match(release, /img\.tkmind\.cn\/health/);
});