Skip to content

Commit cc92787

Browse files
committed
fix(cli): keep test specs on cli.lucli.* prefix
Reverts the cli.lucli -> modules.wheels rewrite for files under cli/lucli/tests/. The earlier global sed touched test specs along with production code, breaking the test runner because the test Application.cfc's mappings only register /cli, /wheels, and /vendor — not /modules/wheels in a way that resolves multi-segment virtual paths the same as LuCLI's runtime does. Reverting the test specs to cli.lucli.* keeps them resolvable via the existing /cli mapping (well-tested, has been in place since the deploy subsystem landed). Production code keeps the new modules.wheels.* prefix so it resolves in install contexts where /cli/lucli/ is not in the filesystem hierarchy. The /modules/wheels mapping in cli/lucli/tests/Application.cfc stays — it's still needed for service-internal cross-references that fire when a test instantiates a production component. This pairs the two prefix conventions cleanly: - test specs: cli.lucli.X (resolves via /cli mapping in tests) - prod code: modules.wheels.X (resolves via LuCLI runtime + tests mirror that with /modules/wheels mapping)
1 parent 0550aa4 commit cc92787

62 files changed

Lines changed: 400 additions & 397 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cli/lucli/tests/Application.cfc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@ component {
22

33
this.name = "WheelsCLITests_" & hash(getCurrentTemplatePath());
44

5-
// Map to project root so tests can instantiate modules.wheels.services.* and wheels.wheelstest.*
5+
// Map to project root so tests can instantiate cli.lucli.services.* and
6+
// wheels.wheelstest.* via the absolute dotted paths the spec files use.
67
local.projectRoot = expandPath("../../../");
78
this.mappings["/cli"] = local.projectRoot & "cli/";
89
this.mappings["/wheels"] = local.projectRoot & "vendor/wheels/";
910
this.mappings["/vendor"] = local.projectRoot & "vendor/";
1011

11-
// At runtime, LuCLI exposes the wheels module under the dotted path
12-
// `modules.wheels.X` (because LuCLI's executeModule.cfs uses
13-
// createObject("component", "modules.<name>.Module") to load each module).
14-
// Production code under cli/lucli/ uses that same prefix to refer to its
15-
// own services so the dotted paths resolve in every install context
16-
// (dev symlink, brew bottle, choco package). Tests need the matching
17-
// mapping so spec files can also use modules.wheels.services.* refs.
12+
// At runtime LuCLI exposes the wheels module under the `modules.wheels.X`
13+
// dotted path (LuCLI's executeModule.cfs does
14+
// `createObject("component", "modules.<name>.Module")` to load each module).
15+
// Production code under cli/lucli/services/ uses that prefix so its own
16+
// internal refs resolve in every install context (dev symlink, brew bottle,
17+
// choco package). Spec files load services via `cli.lucli.X` (above) — but
18+
// once a service is instantiated, its INTERNAL refs are `modules.wheels.X`,
19+
// so we mirror LuCLI's runtime mapping here to keep cross-service calls
20+
// resolvable inside the test runner.
1821
this.mappings["/modules/wheels"] = local.projectRoot & "cli/lucli/";
1922

2023
}

cli/lucli/tests/specs/commands/NewCommandSpec.cfc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ component extends="wheels.wheelstest.system.BaseSpec" {
1111
variables.testHelper = new cli.lucli.tests.TestHelper();
1212
variables.tempRoot = testHelper.scaffoldTempProject(expandPath("/"));
1313
variables.moduleRoot = expandPath("/cli/lucli/");
14-
variables.helpers = new modules.wheels.services.Helpers();
15-
variables.templates = new modules.wheels.services.Templates(
14+
variables.helpers = new cli.lucli.services.Helpers();
15+
variables.templates = new cli.lucli.services.Templates(
1616
helpers = variables.helpers,
1717
projectRoot = variables.tempRoot,
1818
moduleRoot = variables.moduleRoot
1919
);
20-
variables.codegen = new modules.wheels.services.CodeGen(
20+
variables.codegen = new cli.lucli.services.CodeGen(
2121
templateService = variables.templates,
2222
helpers = variables.helpers,
2323
projectRoot = variables.tempRoot

cli/lucli/tests/specs/deploy/cli/DeployAccessoryCliSpec.cfc

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ component extends="wheels.wheelstest.system.BaseSpec" {
88
describe("DeployAccessoryCli", () => {
99

1010
it("boot dispatches docker run on the accessory host", () => {
11-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
12-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
11+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
12+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
1313
cli.boot({configPath: variables.fixture, name: "db"});
1414
var cmds = $cmdsFrom(fake);
1515
expect($anyInclude(cmds, "docker run")).toBeTrue();
@@ -20,8 +20,8 @@ component extends="wheels.wheelstest.system.BaseSpec" {
2020
});
2121

2222
it("reboot chains stop/rm/run", () => {
23-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
24-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
23+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
24+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
2525
cli.reboot({configPath: variables.fixture, name: "db"});
2626
var cmds = $cmdsFrom(fake);
2727
expect($anyInclude(cmds, "docker stop demo-db")).toBeTrue();
@@ -30,61 +30,61 @@ component extends="wheels.wheelstest.system.BaseSpec" {
3030
});
3131

3232
it("start dispatches docker start", () => {
33-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
34-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
33+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
34+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
3535
cli.start({configPath: variables.fixture, name: "db"});
3636
expect($anyInclude($cmdsFrom(fake), "docker start demo-db")).toBeTrue();
3737
});
3838

3939
it("stop dispatches docker stop", () => {
40-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
41-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
40+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
41+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
4242
cli.stop({configPath: variables.fixture, name: "db"});
4343
expect($anyInclude($cmdsFrom(fake), "docker stop demo-db")).toBeTrue();
4444
});
4545

4646
it("restart dispatches docker restart", () => {
47-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
48-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
47+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
48+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
4949
cli.restart({configPath: variables.fixture, name: "db"});
5050
expect($anyInclude($cmdsFrom(fake), "docker restart demo-db")).toBeTrue();
5151
});
5252

5353
it("details inspects container", () => {
54-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
55-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
54+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
55+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
5656
cli.details({configPath: variables.fixture, name: "db"});
5757
expect($anyInclude($cmdsFrom(fake), "docker inspect")).toBeTrue();
5858
});
5959

6060
it("logs honors tail", () => {
61-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
62-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
61+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
62+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
6363
cli.logs({configPath: variables.fixture, name: "db", tail: 25});
6464
expect($anyInclude($cmdsFrom(fake), "--tail 25")).toBeTrue();
6565
});
6666

6767
it("remove chains stop + rm", () => {
68-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
69-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
68+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
69+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
7070
cli.remove({configPath: variables.fixture, name: "db"});
7171
var cmds = $cmdsFrom(fake);
7272
expect($anyInclude(cmds, "docker stop demo-db")).toBeTrue();
7373
expect($anyInclude(cmds, "docker rm demo-db")).toBeTrue();
7474
});
7575

7676
it("name=all fans out over every accessory", () => {
77-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
78-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
77+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
78+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
7979
cli.stop({configPath: variables.fixture, name: "all"});
8080
var cmds = $cmdsFrom(fake);
8181
expect($anyInclude(cmds, "docker stop demo-db")).toBeTrue();
8282
expect($anyInclude(cmds, "docker stop demo-redis")).toBeTrue();
8383
});
8484

8585
it("missing name throws DeployAccessoryCli.MissingName", () => {
86-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
87-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
86+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
87+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
8888
var thrown = false;
8989
try {
9090
cli.stop({configPath: variables.fixture});
@@ -95,8 +95,8 @@ component extends="wheels.wheelstest.system.BaseSpec" {
9595
});
9696

9797
it("dry-run buffers output instead of dispatching", () => {
98-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
99-
var cli = new modules.wheels.services.deploy.cli.DeployAccessoryCli(fake);
98+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
99+
var cli = new cli.lucli.services.deploy.cli.DeployAccessoryCli(fake);
100100
cli.stop({configPath: variables.fixture, name: "db", dryRun: true});
101101
expect(arrayLen(fake.calls())).toBe(0);
102102
var out = arrayToList(cli.dryRunOutput(), chr(10));

cli/lucli/tests/specs/deploy/cli/DeployAppCliSpec.cfc

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,69 @@ component extends="wheels.wheelstest.system.BaseSpec" {
88
describe("DeployAppCli", () => {
99

1010
it("boot emits docker run via SshPool per host", () => {
11-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
12-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
11+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
12+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
1313
cli.boot({configPath: variables.fixture, version: "abc1234"});
1414
var cmds = $cmdsFrom(fake);
1515
expect($anyInclude(cmds, "docker run")).toBeTrue();
1616
expect($anyInclude(cmds, "demo-web-abc1234")).toBeTrue();
1717
});
1818

1919
it("stop emits docker stop via SshPool", () => {
20-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
21-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
20+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
21+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
2222
cli.stop({configPath: variables.fixture, version: "v1"});
2323
expect($anyInclude($cmdsFrom(fake), "docker stop demo-web-v1")).toBeTrue();
2424
});
2525

2626
it("start emits docker start via SshPool", () => {
27-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
28-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
27+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
28+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
2929
cli.start({configPath: variables.fixture, version: "v1"});
3030
expect($anyInclude($cmdsFrom(fake), "docker start demo-web-v1")).toBeTrue();
3131
});
3232

3333
it("containers emits docker ps filter", () => {
34-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
35-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
34+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
35+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
3636
cli.containers({configPath: variables.fixture});
3737
expect($anyInclude($cmdsFrom(fake), "docker ps")).toBeTrue();
3838
expect($anyInclude($cmdsFrom(fake), "label=service=demo")).toBeTrue();
3939
});
4040

4141
it("logs honors tail and follow opts", () => {
42-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
43-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
42+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
43+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
4444
cli.logs({configPath: variables.fixture, tail: 50, follow: false});
4545
expect($anyInclude($cmdsFrom(fake), "--tail 50")).toBeTrue();
4646
});
4747

4848
it("maintenance creates the marker", () => {
49-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
50-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
49+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
50+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
5151
cli.maintenance({configPath: variables.fixture, version: "v1"});
5252
expect($anyInclude($cmdsFrom(fake), "touch /tmp/kamal-maintenance-demo")).toBeTrue();
5353
});
5454

5555
it("live clears the marker", () => {
56-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
57-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
56+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
57+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
5858
cli.live({configPath: variables.fixture, version: "v1"});
5959
expect($anyInclude($cmdsFrom(fake), "rm -f /tmp/kamal-maintenance-demo")).toBeTrue();
6060
});
6161

6262
it("remove stops and rms the container", () => {
63-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
64-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
63+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
64+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
6565
cli.remove({configPath: variables.fixture, version: "v1"});
6666
var cmds = $cmdsFrom(fake);
6767
expect($anyInclude(cmds, "docker stop demo-web-v1")).toBeTrue();
6868
expect($anyInclude(cmds, "docker rm demo-web-v1")).toBeTrue();
6969
});
7070

7171
it("dry-run buffers output instead of dispatching", () => {
72-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
73-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
72+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
73+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
7474
cli.stop({configPath: variables.fixture, version: "v1", dryRun: true});
7575
expect(arrayLen(fake.calls())).toBe(0);
7676
var out = arrayToList(cli.dryRunOutput(), chr(10));
@@ -82,16 +82,16 @@ component extends="wheels.wheelstest.system.BaseSpec" {
8282
// visible success summary, not an empty string.
8383

8484
it("boot (real mode) returns a non-empty success summary", () => {
85-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
86-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
85+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
86+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
8787
var out = cli.boot({configPath: variables.fixture, version: "v1"});
8888
expect(len(out)).toBeGT(0);
8989
expect(out).toInclude("Booted");
9090
});
9191

9292
it("stop --dry-run returns the buffered command list", () => {
93-
var fake = new modules.wheels.services.deploy.lib.FakeSshPool();
94-
var cli = new modules.wheels.services.deploy.cli.DeployAppCli(fake);
93+
var fake = new cli.lucli.services.deploy.lib.FakeSshPool();
94+
var cli = new cli.lucli.services.deploy.cli.DeployAppCli(fake);
9595
var out = cli.stop({configPath: variables.fixture, version: "v1", dryRun: true});
9696
expect(len(out)).toBeGT(0);
9797
expect(out).toInclude("docker stop");

0 commit comments

Comments
 (0)