All Projects → Stono → Helm Test

Stono / Helm Test

Licence: mit
A mocha based testing CLI for helm packages

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Helm Test

Should Enzyme
Useful functions for testing React Components with Enzyme.
Stars: ✭ 41 (+86.36%)
Mutual labels:  tdd, mocha
Karma
Spectacular Test Runner for JavaScript
Stars: ✭ 11,591 (+52586.36%)
Mutual labels:  tdd, mocha
Snap Shot It
Smarter snapshot utility for Mocha and BDD test runners + data-driven testing!
Stars: ✭ 138 (+527.27%)
Mutual labels:  tdd, mocha
Cracking The Coding Interview Javascript Solutions Ctci
Javascript solutions to Cracking the Coding Interview (CTCI)
Stars: ✭ 139 (+531.82%)
Mutual labels:  tdd, mocha
mocha-cakes-2
A BDD plugin for Mocha testing framework
Stars: ✭ 44 (+100%)
Mutual labels:  mocha, tdd
Mochawesome
A Gorgeous HTML/CSS Reporter for Mocha.js
Stars: ✭ 860 (+3809.09%)
Mutual labels:  tdd, mocha
Mochawesome Report Generator
Standalone mochawesome report generator. Just add test data.
Stars: ✭ 152 (+590.91%)
Mutual labels:  tdd, mocha
Public
Repository for wallaby.js questions and issues
Stars: ✭ 662 (+2909.09%)
Mutual labels:  tdd, mocha
chai-exclude
Exclude keys to compare from a deep equal operation with chai expect or assert.
Stars: ✭ 33 (+50%)
Mutual labels:  mocha, tdd
Nspec
A battle hardened testing framework for C# that's heavily inspired by Mocha and RSpec.
Stars: ✭ 242 (+1000%)
Mutual labels:  tdd, mocha
Testdeck
Object oriented testing
Stars: ✭ 206 (+836.36%)
Mutual labels:  tdd, mocha
Baretest
An extremely fast and simple JavaScript test runner.
Stars: ✭ 364 (+1554.55%)
Mutual labels:  tdd, mocha
xv
❌ ✔️ zero-config test runner for simple projects
Stars: ✭ 588 (+2572.73%)
Mutual labels:  mocha, tdd
Mocha
☕️ simple, flexible, fun javascript test framework for node.js & the browser
Stars: ✭ 20,986 (+95290.91%)
Mutual labels:  tdd, mocha
Chimp
Tooling that helps you do quality, faster.
Stars: ✭ 783 (+3459.09%)
Mutual labels:  tdd
Istanbuljs
monorepo containing the various nuts and bolts that facilitate istanbul.js test instrumentation
Stars: ✭ 656 (+2881.82%)
Mutual labels:  mocha
Awesome Swift Korean Lecture
훌륭한 Swift 세션 동영상(강좌), 한글 자막있는 혹은 한국어 강의 정보 링크 모음 (Awesome Swift Korean lecture information)
Stars: ✭ 649 (+2850%)
Mutual labels:  tdd
Webdriverio
Next-gen browser and mobile automation test framework for Node.js
Stars: ✭ 7,214 (+32690.91%)
Mutual labels:  mocha
Unit Test Demo
一步一步介绍如何给项目添加单元测试
Stars: ✭ 766 (+3381.82%)
Mutual labels:  mocha
Geodesic
🚀 Geodesic is a DevOps Linux Distro. We use it as a cloud automation shell. It's the fastest way to get up and running with a rock solid Open Source toolchain. ★ this repo! https://slack.cloudposse.com/
Stars: ✭ 629 (+2759.09%)
Mutual labels:  helm

helm-test

Mocha based testing for Helm packages!

logo

What does it do?

Helm is a great tool for packaging and templating your kubernetes definitions. However as your templates grow in complexity, and you start to introduce conditionals and other logic it becomes increasingly easy to unwittingly break them. Supports both helmv2 and helmv3.

I wanted to take some of the tooling that I use when coding, and create a simple cli to test the manifest files that helm generates. helm-test will run helm to generate your manifests and then parse the results into JSON for you to perform assertions against.

How to use it

Installation

helm-test is distributed as a command line interface, simply type npm install -g helm-test. Once you've got that installed, you just need to write some tests.

Writing tests

Tests should be placed in the root of your helm chart, in a tests/ folder like so:

/
  Chart.yaml
  values.yaml
  charts/
  templates/
  tests/
    your-tests.js
    some-more-tests.js

Your test specification follows the popular Mocha layout. You can see an example here

There are some global helper variables defined for use in your tests:

helm

This is the root context and exposes the following functions:

  • withValueFile(path): Specify a value file to use when running helm, relative to the root of your chart. You can call this multiple times
  • set(key, value): Allows you to override a specific value, for example set('service.port', '80') would do --set service.port=80 when running helm
  • go(done): Run a helm template generation and parse the output

yaml

This global helper function allows you to parse yaml using js-yaml. This is useful for scenarios like a configmap containing a string block which sub contains yaml, that you wish to assert on.

eg.

const json = yaml.load(results.ofType('ConfigMap')[0].spec.data);
json.metadata.name.should.eql('some-manifest');

results

After running helm.go, the results variable will be populated, and it exposes the following:

  • length: The number of manifest files
  • ofType(type): Get all manifests of a given type

Running your tests

Is a simple as doing helm-test:

❯ helm-test
  helm-test [info] Welcome to helm-test v0.1.6! +0ms
  helm-test [info] Testing... +0ms


  Helm Chart
    ✓ should have three manifests
    The Service
      ✓ should have standard labels
      ✓ should have valid metadata.name
      ✓ should be a LoadBalancer
      ✓ should be on an internal ip
      ✓ should have a single http-web port
      ✓ should select the right pods
    The StatefulSet
      ✓ should have the right name
      ✓ should have standard labels
      ✓ should have a serviceName
      ✓ should have a single replica
      ✓ should be a RollingUpdate strategy
      ✓ should have matching matchLabels and template labels
      Containers
        ✓ should have two containers
        Master
          ✓ should use the right image
          ✓ should limit 2gig of ram
          ✓ should limit 1.8 CPU
          ✓ should have a http-web port
    The ConfigMap
      ✓ should have standard labels
      ✓ should have valid metadata
      ✓ should have a docker-host key


  21 passing (123ms)

  helm-test [info] Complete. +443ms

Constantly running tests and watching for changes

You can have helm-test run every time it detects a change in your chart by simply doing helm-test --watch

License

Copyright (c) 2017 Karl Stoney Licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].