Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for helm completion #6115

Closed
marckhouzam opened this issue Jul 30, 2019 · 1 comment
Closed

Tests for helm completion #6115

marckhouzam opened this issue Jul 30, 2019 · 1 comment
Labels

Comments

@marckhouzam
Copy link
Member

Unless I'm wrong, there is currently no way to test command-line completion for helm.

Although completion is handled quasi-automatically by Cobra, there is code residing in the Helm project directly. It has happened that completion was broken for helm such as #5072 #5406 . And there are feature requests as well as bug reports in the completion area such as #3693 #3170 #3171 . As more completion features are added to the Helm project, such as dynamic completion, tests will be more and more important.

Such tests should allow to cover:

  • bash 4
  • bash 3
  • zsh
  • Linux
  • MacOS (as much as possible)
  • static completion
  • dynamic completion

I will be proposing a solution soon.

marckhouzam added a commit to VilledeMontreal/helm that referenced this issue Jul 30, 2019
This commit adds a framework and tests for helm command-line
completion.

To cover different shells (bash 4, bash 3, zsh) we use docker.

For MacOS, the tests are run locally if the host is MacOS and has
the right setup (bash completion installed, or zsh installed).

To run the tests use:
  make test-completion

Although the framework supports marking tests as known failures,
this commit commented out the failing tests to allow for a clean
output for this proposal.  They can be uncommented later on.

A new directory is added: scripts/completion-tests.
It contains the required scripts used for the completion tests.

scripts/completion-tests/completionTests.sh:
   Helm-specific completion tests.
   This script should evolve as new tests are added and new
   completion features implemented.

scripts/completion-tests/test-completion.sh:
   This script repeatedly runs the completion-tests in different
   environments using docker.
   This script would need changes if a new environment needs to
   be added.

scripts/completion-tests/lib/completionTests-base.sh:
   The magic. It is this script that allows completion testing.
   This script is not expected to change in day-to-day helm
   evolution.

Signed-off-by: Marc Khouzam <marc.khouzam@ville.montreal.qc.ca>
marckhouzam added a commit to VilledeMontreal/helm that referenced this issue Jul 30, 2019
This commit adds a framework and tests for helm command-line
completion.

To cover different shells (bash 4, bash 3, zsh) we use docker.

For MacOS, the tests are run locally if the host is MacOS and has
the right setup (bash completion installed, or zsh installed).

Dynamic-completion (e.g., helm status <TAB>) is not yet tested, but has
been considered in the design of the framework.

To run the tests:
  make test-completion

Although the framework supports marking tests as known failures,
this commit commented out the failing tests to allow for a clean
output for this proposal.  They can be uncommented later on.

A new directory is added: scripts/completion-tests.
It contains the required scripts for the completion tests.

scripts/completion-tests/completionTests.sh:
   Helm-specific completion tests.
   This script should evolve as new tests are added and new
   completion features implemented.

scripts/completion-tests/test-completion.sh:
   This script repeatedly runs the completion-tests in different
   environments using docker.
   This script would need changes if a new environment needs to
   be added.

scripts/completion-tests/lib/completionTests-base.sh:
   The magic. It is this script that allows completion testing.
   This script is not expected to change in day-to-day helm
   evolution.

Signed-off-by: Marc Khouzam <marc.khouzam@ville.montreal.qc.ca>
@marckhouzam
Copy link
Member Author

This is now available in the acceptance-testing repo (dynamic completion testing is still pending).
#6256 would allow to run these tests from the Helm repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants