devcontainers / devcontainers/cli

Testing features not possible on Windows

Aperta
#757 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
TypeScript
Stelle
3k
Fork
457
Merge medio
13h 17m
PR unite (30g)
6

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia in src/spec-node/featuresCLI/testCommandImpl.ts, in corrispondenza delle chiamate a chmod intorno alle righe 539 e 596, quindi esamina il modo in cui execTest invoca cliHost.exec(). Riproduci il flusso dei test della funzionalità su Windows e verifica che i test non falliscano più perché chmod non è disponibile sull’host; aggiungi o aggiorna la coverage se il file contiene test pertinenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
cli, operating-systems, testing-qa
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.