

















@@ -278,6 +278,8 @@ afterAll(() => {
278278});
279279280280describe.concurrent("scripts/crabbox-wrapper", () => {
281+const azureProviderHelp =
282+"provider: hetzner, aws, azure, local-container, blacksmith-testbox, or cloudflare\n";
281283const advertisedProviderAliasHelp = [
282284"provider: hetzner, aws, gcp, local-container, blacksmith-testbox,",
283285" namespace-devbox, runpod, semaphore, cloudflare, railway, exe-dev, or ssh",
@@ -353,6 +355,108 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
353355]);
354356});
355357358+it("prefers Azure for unqualified Windows runs", () => {
359+const result = runWrapper(azureProviderHelp, [
360+"run",
361+"--target",
362+"windows",
363+"--windows-mode",
364+"wsl2",
365+"--",
366+"corepack",
367+"pnpm",
368+"check:changed",
369+]);
370+371+expect(result.status).toBe(0);
372+expect(parseFakeCrabboxOutput(result).args).toEqual([
373+"run",
374+"--target",
375+"windows",
376+"--windows-mode",
377+"wsl2",
378+"--provider",
379+"azure",
380+"--",
381+"corepack",
382+"pnpm",
383+"check:changed",
384+]);
385+expect(result.stderr).toContain("provider=azure");
386+});
387+388+it("keeps explicit provider env overrides for Windows runs", () => {
389+const result = runWrapper(
390+azureProviderHelp,
391+["run", "--target", "windows", "--", "echo ok"],
392+{ env: { CRABBOX_PROVIDER: "aws" } },
393+);
394+395+expect(result.status).toBe(0);
396+expect(parseFakeCrabboxOutput(result).args).toEqual([
397+"run",
398+"--target",
399+"windows",
400+"--",
401+"echo ok",
402+]);
403+expect(result.stderr).toContain("provider=aws");
404+});
405+406+it("keeps the configured provider for Windows runs when Azure is unavailable", () => {
407+const result = runWrapper(
408+"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
409+["run", "--target", "windows", "--", "echo ok"],
410+);
411+412+expect(result.status).toBe(0);
413+expect(parseFakeCrabboxOutput(result).args).toEqual([
414+"run",
415+"--target",
416+"windows",
417+"--",
418+"echo ok",
419+]);
420+expect(result.stderr).toContain("provider=aws");
421+});
422+423+it("keeps existing Windows lease selections on the configured provider", () => {
424+const result = runWrapper(azureProviderHelp, [
425+"run",
426+"--id",
427+"cbx_existing",
428+"--target",
429+"windows",
430+"--",
431+"echo ok",
432+]);
433+434+expect(result.status).toBe(0);
435+expect(parseFakeCrabboxOutput(result).args).toEqual([
436+"run",
437+"--id",
438+"cbx_existing",
439+"--target",
440+"windows",
441+"--",
442+"echo ok",
443+]);
444+expect(result.stderr).toContain("provider=aws");
445+});
446+447+it("prefers Azure for unqualified Windows warmups", () => {
448+const result = runWrapper(azureProviderHelp, ["warmup", "--target", "windows"]);
449+450+expect(result.status).toBe(0);
451+expect(parseFakeCrabboxOutput(result).args).toEqual([
452+"warmup",
453+"--target",
454+"windows",
455+"--provider",
456+"azure",
457+]);
458+});
459+356460it("fails closed for AWS proof when broker auth is missing", () => {
357461const result = runWrapper(
358462"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。