8000 GitHub - gpestana/kapacitor-unit at 0.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gpestana/kapacitor-unit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kapacitor-unit

A test framework for TICKscripts

Build Status

Release Version

Kapacitor-unit is a testing framework to make TICK scripts testing easy and automated. Test your tasks using pre defined data points and expected results and/or the recording and replay native features.

Read more about the idea and motivation behind kapacitor-unit in this blog post

Note: kapacitor-unit is still work in progress. Contributions and ideas are more then welcome!

Features

✔️ Run tests for stream TICK scripts using protocol line data input

🔜 Run tests for batch TICK scripts using protocol line data input

🔜 Run tests for stream and batch TICK scripts using recordings

Running kapacitor-unit:

  1. Install kapacitor-unit
go install github.com/gpestana/kapacitor-unit/kapacitor-unit 
  1. Define the test configuration file (see below)

  2. Run the tests

kapacitor-unit --dir <*.tick directory> --kapacitor <kapacitor host> --tests <test configuration path>

Test case definition:

# Test case for alert_weather.tick
tests:
  
   # This is the configuration for a test case. The 'name' must be unique in the
   # same test configuration. 'description' is optional

  - name: Alert weather:: warning
    description: Task should trigger Warning when temperature raises about 80 

    # 'task_script' defines the name of the file of the tick script to be loaded
    # when running the test
    task_script: alert_weather.tick

    db: weather
    rp: default 

     # 'data' is an array of data in the line protocol
    data:
      - weather,location=us-midwest temperature=75
      - weather,location=us-midwest temperature=82

    # Alert that should be triggered by Kapacitor when test data is running 
    # against the task
    expects:
      ok: 0
      warn: 1
      crit: 0


  - name: Alert no. 2
    task_id: alert_weather.tick
    db: weather
    rp: default 
    data:
      - weather,location=us-midwest temperature=80
      - weather,location=us-midwest temperature=82
    expects:
      ok: 0
      warn: 1
      crit: 0

Contributions:

Fork and PR and use issues for bug reports, feature requests and general comments.

©️ MIT

About

Testing framework for Kapacitor TICKscripts

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7

Languages

0