Files
windmill/cli/test/gitsync_settings_workspace_resolution_unit.test.ts
T
Ruben FiszelandClaude Opus 5.5 0960d7c16f fix: resolve gitsync-settings wmill.yaml entry by workspace, not branch (#12230)
* fix: resolve gitsync-settings wmill.yaml entry by workspace, not branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: write gitsync-settings pull overrides to the resolved workspace entry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: refuse ambiguous gitsync-settings override target instead of guessing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: never adopt a branch entry that names another workspace on override

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: refuse gitsync-settings override when the workspace resolves to no entry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep the branch binding in the gitsync-settings override refusal hint

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: pin git-sync hub scripts to windmill-cli 1.862.1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 15:17:55 +00:00

39 lines
1.3 KiB
TypeScript

import { expect, test } from "bun:test";
import type { SyncOptions } from "../src/core/conf.ts";
import { getEffectiveSettingsForWorkspace } from "../src/commands/gitsync-settings/utils.ts";
// Entries sharing a gitBranch must resolve by workspace, not by the first one
// bound to the branch.
test("gitsync-settings: entries sharing a gitBranch resolve by workspace", async () => {
const config: SyncOptions = {
includes: ["f/**"],
workspaces: {
"team-a-staging": {
baseUrl: "https://windmill.example.com/",
gitBranch: "staging",
overrides: { includes: ["f/team_a/**"] },
},
"team-b": {
baseUrl: "https://windmill.example.com/",
workspaceId: "team-b-staging",
gitBranch: "staging",
overrides: { includes: ["f/team_b/**"] },
},
},
};
const byFlag = await getEffectiveSettingsForWorkspace(
config,
{ workspace: "team-a-staging", jsonOutput: true },
{ remote: "http://windmill_server:8000/", workspaceId: "team-a-staging" },
);
expect(byFlag.includes).toEqual(["f/team_a/**"]);
const byProfile = await getEffectiveSettingsForWorkspace(
config,
{ workspace: "team-b-staging", jsonOutput: true },
{ remote: "https://windmill.example.com/", workspaceId: "team-b-staging" },
);
expect(byProfile.includes).toEqual(["f/team_b/**"]);
});