mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-03 16:02:12 +00:00
* test(cli): stop CLI tests resolving a just-published windmill-client Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test: quote the Windows cert path in the pg attach assertion Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(cli): note when the windmill-client pin must move Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(cli): resolve fork specific items from the parent workspace entry Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(cli): keep fork resolution to the id-guarded inference Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { expect, test } from "bun:test";
|
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
import { execSync } from "node:child_process";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
|
|
import { inferWsNameFromForkBranch, type SyncOptions } from "../src/core/conf.ts";
|
|
|
|
// A fork id never has a wmill.yaml entry of its own. Unless it resolves to its
|
|
// parent's entry, a sync on the fork branch pushes the base files over the
|
|
// workspace-specific values the fork cloned from its parent.
|
|
test("a fork branch resolves to its parent's workspace entry", async () => {
|
|
const repoDir = await mkdtemp(path.join(os.tmpdir(), "wmill_fork_specific_"));
|
|
const originalCwd = process.cwd();
|
|
try {
|
|
execSync(
|
|
`git init -q -b wm-fork/dev-branch/t1 && git -c user.email=t@t -c user.name=t commit -q --allow-empty -m init`,
|
|
{ cwd: repoDir },
|
|
);
|
|
process.chdir(repoDir);
|
|
|
|
const config: SyncOptions = {
|
|
workspaces: {
|
|
dev: {
|
|
baseUrl: "http://localhost:8000/",
|
|
workspaceId: "dev-ws",
|
|
gitBranch: "dev-branch",
|
|
specificItems: { folders: ["f/team"] },
|
|
},
|
|
},
|
|
};
|
|
|
|
expect(inferWsNameFromForkBranch(config, "wm-fork-t1")).toEqual("dev");
|
|
// Only the fork the branch names inherits the parent's entry.
|
|
expect(inferWsNameFromForkBranch(config, "other-ws")).toBeUndefined();
|
|
} finally {
|
|
process.chdir(originalCwd);
|
|
await rm(repoDir, { recursive: true, force: true });
|
|
}
|
|
});
|