Files
dpsapi/e2e/setup/image.setup.ts
T
bryanpedini fe0cd4bf6d test(e2e): add playwright e2e harness
Process and API-only Playwright harness: binary and image setup, server/CLI runners, fake Docker Engine socket, read-only database inspection, secret redaction in reports, seeded fuzzing, leak detection and harness self-checks.
2026-10-06 10:52:25 +02:00

21 lines
950 B
TypeScript

// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (C) 2026 Bryan Joshua Pedini
/**
* `image-setup` project: check the image under test ($DPSAPI_IMAGE) and the tools the image
* suite needs. All image tests depend on it.
*/
import { test as setup } from '@playwright/test';
import { imageRef } from '../harness/env';
import { HarnessError } from '../harness/errors';
import { requireCurl, requireDocker, sh } from './prereq';
setup('image prerequisites: Docker, curl, image under test', async () => {
requireCurl();
requireDocker();
const image = imageRef();
if (!image) throw new HarnessError('prerequisite', 'DPSAPI_IMAGE is not set (run `make docker-e2e`, or export DPSAPI_IMAGE=<image ref>)');
const r = sh('docker', ['image', 'inspect', '--format', '{{.Id}}', image]);
if (r.code !== 0) throw new HarnessError('prerequisite', `image ${image} is not present locally (build it with \`make docker\`): ${r.err.trim()}`);
});