Git Product home page Git Product logo

lambdacd-pipeline-def-test's Introduction

lambdacd-pipeline-def-test

If you define your pipeline definition in LambdaCD it could happen that you have a typo in a step name or that you forget to import a namespace. In this case you are able to build and run your pipeline but it will stop if it tries to execute this undefinied step. And it will stop without any exception.

This library can be used in your test namespace to avoid this behaviour.

Another feature of this library is to test the argument lists of your meta-steps. The test will fail if you try to use a regular LambdaCD step as meta-step or if you provide the wrong count of arguments.

Usage

[lambdacd-pipeline-def-test.core :refer :all]

(deftest pipeline-test
  (testing "test that all steps are definied in your pipeline"
    (is (test-p-def :success pipeline-def)))

test-p-def [mode p-def user-meta-steps]
  • mode: :success or :failure
  • p-def: Your pipeline definition
  • user-meta-steps: List of meta-steps that don't be declared as meta-step even though they are.

Meta-Steps

A meta-step is step in your pipeline which creates a regular LambdaCD step.

Example:

(defn deploy-my-app [env]
  (fn [args ctx]
    ;deploy to env
    {:status ...}))

(def pipeline-def
  `(step-1
    step-2
    (deploy-my-app "dev")
    step-3
    (deploy-my-app "live"))

By using a meta-step you can parameterize your steps to use them in different stages of your pipeline. Regular LambdaCD steps also take two arguments: args and ctx. They will be injected when you run your pipeline. To validate your pipeline definition this library has to make a distinction between these two kinds of steps. There are two ways how you can tag your step as a meta-step:

Add the :meta-step tag to the function declaration:

(defn deploy-my-app
  {:meta-step true}
  [env]
  (fn [args ctx]
    ;deploy to env
    {:status ...}))

Pass a list with all meta-steps to the test-p-def function

(defn deploy-my-app [env]
  (fn [args ctx]
    ;deploy to env
    {:status ...}))

(def pipeline-def
  ...)

(deftest pipeline-test
  (testing "test that all steps are definied in your pipeline"
    (is (test-p-def :success pipeline-def `(deploy-my-app))))

You can use this way if can not change the function declaration.

License

Copyright © 2015 Simon Monecke

Distributed under MIT License

lambdacd-pipeline-def-test's People

Contributors

simonmonecke avatar simonmonecke1708 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.