Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

Proposal: Enable testing and linting charts with test values. #3943

Closed

Description

@unguiculus

Currently, we can only test charts with their default values. There are certain cases when this is not ideal:

  • Charts cannot use the required function without providing a default value.
  • Some charts need key files (e. g. [stable/ethereum] Add Chart for Deploying Private Ethereum Network #3220). Adding keys to the chart is a security risk, even if we document that the user is supposed to provide their own keys. In such a case we could create keys for the tests only. for a real installation the user would be required to specify their own.

I propose that a chart can have a ci folder. Any file in this folder that ends with -values.yaml is considered a values file for testing. Linting and tests are run with each of these files. If no test values are found, the chart is installed with defaults.

Here's some bash code that illustrates this.

#!/usr/bin/env bash

shopt -s nullglob
has_test_values=

for values_file in ./ci/*-values.yaml; do
    echo "Testing chart with values file: $values_file..."

    helm lint stable/mychart --values "$values_file"
    helm install stable/mychart --values "$values_file"
    has_test_values=true
done

if [[ -z "$has_test_values" ]]; then
    echo "Chart does not provide test values. Testing installation with defaults..."

    helm lint stable/mychart
    helm install stable/mychart
fi

Activity

  1. unguiculus commented on Mar 1, 2018

    @unguiculus
    MemberAuthor

    /cc @kubernetes/charts-maintainers

  2. mattfarina commented on Mar 6, 2018

    @mattfarina
    Contributor

    /cc @kubernetes/helm-maintainers what do y'all think ... the idea is to help with CI.

    /cc @viglesiasce since this impacts CI

  3. prydonius commented on Mar 6, 2018

    @prydonius
    Member

    +1 from me

  4. sameersbn commented on Mar 7, 2018

    @sameersbn
    Contributor

    sgtm!

  5. jpoon commented on Mar 13, 2018

    @jpoon
    Collaborator

    Having this ability would be awesome. I've been hesitant/lazy to update #3220 to pass the tests as it would mean updating all the start-up scripts to include "if no keys included, NOP" which is such an ugly hack to get around requiring keys.

  6. viglesiasce commented on Mar 14, 2018

    @viglesiasce
    Contributor

    This is awesome! +1 from me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions