cli icon indicating copy to clipboard operation
cli copied to clipboard

Testing features not possible on Windows

Open gingters opened this issue 1 year ago โ€ข 3 comments

I am trying to build a feature, and I failed. So I wrote a test to see what failed. However, when trying to execute my test, I get this error:

๐Ÿš€ Launched container.
>  containerId:          765681ff36037ff597185005ba19c57bd1db92eccda9bbd6127d536fd97c6c2e

๐Ÿƒ Starting test(s)...

๐Ÿงช Starting 'oh-my-posh' tests...
Error: Exectuable 'chmod' not found on PATH 'C:\Program Files\PowerShell\7;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;...'.
    at EF (C:\Users\SebastianGingter\AppData\Roaming\npm\node_modules\@devcontainers\cli\dist\spec-node\devContainersSpecCLI.js:150:4280)
    at async Object.exec (C:\Users\SebastianGingter\AppData\Roaming\npm\node_modules\@devcontainers\cli\dist\spec-node\devContainersSpecCLI.js:150:1655)
    at async W0 (C:\Users\SebastianGingter\AppData\Roaming\npm\node_modules\@devcontainers\cli\dist\spec-node\devContainersSpecCLI.js:591:83)
    at async WtA (C:\Users\SebastianGingter\AppData\Roaming\npm\node_modules\@devcontainers\cli\dist\spec-node\devContainersSpecCLI.js:572:678)
    at async jtA (C:\Users\SebastianGingter\AppData\Roaming\npm\node_modules\@devcontainers\cli\dist\spec-node\devContainersSpecCLI.js:572:197)
    at async $H (C:\Users\SebastianGingter\AppData\Roaming\npm\node_modules\@devcontainers\cli\dist\spec-node\devContainersSpecCLI.js:567:190)
    at async AiA (C:\Users\SebastianGingter\AppData\Roaming\npm\node_modules\@devcontainers\cli\dist\spec-node\devContainersSpecCLI.js:591:4218)
    at async C:\Users\SebastianGingter\AppData\Roaming\npm\node_modules\@devcontainers\cli\dist\spec-node\devContainersSpecCLI.js:591:3506 {
  code: 'ENOENT'
}

It seems, the execTest method in testCommandImpl.ts hardcodes a call to chmod, which is executed on the cliHost. In my case this is Windows, which does not have a chmod.

See https://github.com/devcontainers/cli/blob/2a6ab1ac82f4917654205e2a9b1ac928260d902e/src/spec-node/featuresCLI/testCommandImpl.ts#L596

There's another cliHost.exec() call to chmod in line 539: https://github.com/devcontainers/cli/blob/2a6ab1ac82f4917654205e2a9b1ac928260d902e/src/spec-node/featuresCLI/testCommandImpl.ts#L539

Maybe the chmod should be done in the container, and not on the host?

gingters avatar Feb 14 '24 15:02 gingters

Hi ๐Ÿ‘‹

Thanks for reporting, it definitely looks like a bug.

In the meanwhile, @gingters can you work within a dev container? I believe that's how most of the community runs Feature tests, hence, this wasn't reported until now.

samruddhikhandale avatar Feb 23 '24 23:02 samruddhikhandale

//cc @joshspicer for visibility

samruddhikhandale avatar Feb 27 '24 18:02 samruddhikhandale

Thanks for reporting. In the meantime, i'd also suggest using WSL if possible to run the CLI.

joshspicer avatar Mar 04 '24 17:03 joshspicer