Exercise alias pin discovery and refresh in always-run Nix fixtures (#713)
This commit is contained in:
parent
31d155fd88
commit
6f5b5265b6
+13
-21
@@ -156,26 +156,6 @@ test(
|
||||
);
|
||||
assert.equal(graph.resources[0].directory, "resources/Named");
|
||||
assert.equal(graph.directResources[0].directory, "resources/Named");
|
||||
const alias = `${workbench}-guest-alias`;
|
||||
await fs.symlink(workbench, alias);
|
||||
context.after(() => fs.unlink(alias));
|
||||
const graphFile = path.join(workbench, ".quixos/resource-graph.json");
|
||||
await fs.writeFile(
|
||||
graphFile,
|
||||
JSON.stringify({
|
||||
...graph,
|
||||
resources: graph.resources.map((entry: { directory: string }) => ({
|
||||
...entry,
|
||||
directory: path.join(alias, entry.directory),
|
||||
})),
|
||||
}),
|
||||
);
|
||||
assert.equal((await discoverUpgradeSpec(alias)).nodes[1]!.directory, "resources/Named");
|
||||
const aliasPlan = await planPinUpgrades(alias, { ...(await discoverUpgradeSpec(alias)), bootstrap: true });
|
||||
await applyPinUpgrades(aliasPlan);
|
||||
const refreshed = JSON.parse(await fs.readFile(graphFile, "utf8"));
|
||||
assert.equal(refreshed.resources[0].directory, "resources/Named");
|
||||
assert.equal(refreshed.directResources[0].directory, "resources/Named");
|
||||
// A retained workbench can move without keeping its original absolute path
|
||||
// alive. Recovery journals remain bound to their original writer/root.
|
||||
const relocated = `${workbench}-relocated`;
|
||||
@@ -196,6 +176,9 @@ for (const dependencyKind of ["interface", "build"] as const)
|
||||
test(`${dependencyKind} pin upgrades publish children before parent locks and resume without republishing completed nodes`, async (context) => {
|
||||
const workbench = await fs.mkdtemp(path.join(os.tmpdir(), "qx-upgrade-test-"));
|
||||
context.after(() => fs.rm(workbench, { recursive: true, force: true }));
|
||||
const alias = `${workbench}-guest-alias`;
|
||||
await fs.symlink(workbench, alias);
|
||||
context.after(() => fs.unlink(alias));
|
||||
const from = "a".repeat(40),
|
||||
to = "b".repeat(40),
|
||||
framework = "c".repeat(40);
|
||||
@@ -264,7 +247,15 @@ for (const dependencyKind of ["interface", "build"] as const)
|
||||
await fs.mkdir(path.join(workbench, ".quixos"), { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(workbench, ".quixos/resource-graph.json"),
|
||||
JSON.stringify({ resources: [{ ...sources[1], source: { resolver: "git", ...sources[1].source } }] }),
|
||||
JSON.stringify({
|
||||
resources: [
|
||||
{
|
||||
...sources[1],
|
||||
directory: path.join(alias, sources[1].directory),
|
||||
source: { resolver: "git", ...sources[1].source },
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
assert.deepEqual(
|
||||
plan.nodes.map((node) => node.directory),
|
||||
@@ -295,6 +286,7 @@ for (const dependencyKind of ["interface", "build"] as const)
|
||||
assert.deepEqual(published, ["resources/Named", "root"]);
|
||||
const graph = JSON.parse(await fs.readFile(path.join(workbench, ".quixos/resource-graph.json"), "utf8"));
|
||||
assert.equal(graph.resources.length, 1);
|
||||
assert.equal(graph.resources[0].directory, "resources/Named");
|
||||
assert.equal(graph.resources[0].source.commit, to);
|
||||
const next = await planPinUpgrades(workbench, {
|
||||
nodes: [sources[0], { ...sources[1], source: graph.resources[0].source }],
|
||||
|
||||
Reference in New Issue
Block a user