cli icon indicating copy to clipboard operation
cli copied to clipboard

[Tracking] `devcontainer features test` improvements

Open joshspicer opened this issue 3 years ago • 5 comments

An issue collecting various improvements that can be made for the features test... command. The command is still experimental and under active development.

  • [x] remoteUser, containerUser, or a container with a default non-root user are failing with a permissions issue when included in a scenario
  • [x] Scenario tests appear to run as root even when -u specified in command line
  • [ ] Feature values specified in scenario.json do not appear to be space escaped ("a b" ends up as "a")
  • [x] -f prevents other parameters after it from being used since it treats them all as part of the array. Makes it impossible to pass in the require parameters.
  • [x] Document all command functionality (ie: https://github.com/devcontainers/spec/discussions/113#discussioncomment-3830454) (https://github.com/devcontainers/cli/pull/219)
  • [ ] If there is a scenario.json file and no test.sh, the test will not run unless --skip-autogenerated is set. We should be smarter about this
  • [x] The one positional argument (path to collection) is required and doesn't use the default value (cwd)
  • [x] Support build.dockerfile - Currently errors since Dockerfile referenced is not copied to temp location
  • [x] Allow specifying a specific scenario to test via the CLI (helps if only one of several is failing)
  • [ ] #438
  • [ ] Output results to stdout so you can pipe to a log file w/o getting the entire build output (appears to go to stderr right now)
  • [ ] Be able to override a certain base image <-> feature combos in the autogenerated tests (https://github.com/devcontainers/features/pull/116#pullrequestreview-1090984379)
  • [x] https://github.com/devcontainers/cli/issues/163 / https://github.com/devcontainers/cli/issues/217
  • [x] https://github.com/devcontainers/spec/discussions/114#discussioncomment-4031722
  • [ ] https://github.com/devcontainers/cli/issues/334
  • [ ] https://github.com/devcontainers/cli/issues/409
  • [ ] https://github.com/devcontainers/cli/issues/448

joshspicer avatar Aug 24 '22 19:08 joshspicer

Hello. I developed a feature using the feature template and noticed that the test for option selection was not covered.

Is it possible to run multiple installations by referencing a pre-created options matrix (json file) when running an installation as a test? Or the user may want to give options as CLI arguments to parallelize using the matrix on GitHub Actions.

Similarly, it would be useful to be able to specify the platform (CPU architecture).

edit: I understand that we can add scenarios.json to the folder for each feature, but ~~it seems useless because when I set up the GitHub matrix, the tests in scenarios.json are run under all matrix conditions~~ --skip-scenarios seems work fine.

eitsupi avatar Sep 24 '22 09:09 eitsupi

Can we add another task? Currently, there isn't a way to supply --docker-path/--docker-compose-path to any of the features commands, which causes issues if you're using podman in ci scenarios.

Clockwork-Muse avatar Dec 02 '22 22:12 Clockwork-Muse

@Clockwork-Muse Do you mean a way to specify the path to the docker/docker-compose CLIs? Yes, I'll convert your request into an issue 👍 (If you're interested, we'd also accept a PR on this)

joshspicer avatar Dec 21 '22 21:12 joshspicer

Yes, that's what I meant.

Clockwork-Muse avatar Dec 21 '22 22:12 Clockwork-Muse

If there is a scenario.json file and no test.sh, the test will not run unless --skip-autogenerated is set. We should be smarter about this

👍 id very much like to see this so that i can do this in something like gh actions:

devcontainer features test -f ${{ matrix.id }}

and NOT fail like this: image

as a workaround I'm currently doing this:

if [[ -e test/${{ matrix.id }}/test.sh ]]; then
  devcontainer features test -f ${{ matrix.id }}
else
  devcontainer features test -f ${{ matrix.id }} --skip-autogenerated
fi

accidentally made https://github.com/devcontainers/spec/issues/294 🙄

jcbhmr avatar Aug 17 '23 15:08 jcbhmr