/ytt-test

Primary LanguageShell

ytt-test

(prototype) End-to-end test runner for ytt.

Quick Start

  1. Put ./ytt-test.sh in the $PATH.

  2. outside of your ytt source directory, create a directory named .ytt-tests

  3. for each test you want to run, create a test file (i.e. with a .test.yaml suffix)

    #! .ytt-tests/sample.test.yaml
    ---
    
    actual: ytt --file ${YTT_SUBJECT}/config/ --data-values-file values.yaml
    expected: ytt --file expected/
    • ytt-test sets YTT_SUBJECT to the absolute path to parent directory of .ytt-tests
  4. create the fixture(s) for the test

    #! .ytt-tests/values.yaml
    ---
    instances: 7
  5. in the parent directory of .ytt-tests run the test runner

    $ ls -a1F
    .ytt-tests/
    config/
    
    $ ytt-test.sh
    fail  .ytt-tests/sample.test.yaml
            ==> .ytt-test-out/sample/result.diff
    
    FAILURE
  6. examine the "actual" result; if acceptable, make it the "expected"

    $ mv .ytt-test-out/sample/actual .ytt-tests/expected
  7. re-run the test

    $ ytt-test.sh
    pass  .ytt-tests/sample.test.yaml
    SUCCESS

(See also ./examples)