Skip to content

Commit eaca62e

Browse files
committed
Include collector lease module in runtime sync
1 parent 61f2c83 commit eaca62e

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

scripts/collector-runtime-policy.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const COLLECTOR_RUNTIME_SOURCE_FILES = [
1313
"scripts/import-sub2api-api-transit.mjs",
1414
"scripts/probe-api-transit.mjs",
1515
"scripts/refresh-public-api-snapshots.mjs",
16+
"scripts/runtime-lease.mjs",
1617
"scripts/safe-fetch.mjs",
1718
"config/api-transit-probes.json",
1819
"config/api-transit-sources.json",

scripts/test-api-transit.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,22 @@
33
import assert from "node:assert/strict";
44
import { spawnSync } from "node:child_process";
55
import { readFileSync } from "node:fs";
6+
import path from "node:path";
67
import { fileURLToPath } from "node:url";
78
import { __test } from "./collect-api-transit.mjs";
9+
import { COLLECTOR_RUNTIME_SOURCE_FILES } from "./collector-runtime-policy.mjs";
10+
11+
const collectorRuntimeSources = new Set(COLLECTOR_RUNTIME_SOURCE_FILES);
12+
for (const sourceFile of COLLECTOR_RUNTIME_SOURCE_FILES.filter((file) => file.endsWith(".mjs"))) {
13+
const source = readFileSync(new URL(`../${sourceFile}`, import.meta.url), "utf8");
14+
for (const match of source.matchAll(/from\s+["'](\.\/[^"']+\.mjs)["']/g)) {
15+
const dependency = path.posix.normalize(path.posix.join(path.posix.dirname(sourceFile), match[1]));
16+
assert.ok(
17+
collectorRuntimeSources.has(dependency),
18+
`${sourceFile} imports ${dependency}, which must be included in the collector runtime source manifest.`,
19+
);
20+
}
21+
}
822

923
const leaseCliSmoke = spawnSync(process.execPath, [fileURLToPath(new URL("./collect-api-transit.mjs", import.meta.url)), "--post", "--source", "__lease_smoke__"], {
1024
cwd: fileURLToPath(new URL("..", import.meta.url)),

0 commit comments

Comments
 (0)