GithubHelp home page GithubHelp logo

conformance's Introduction

CloudEvents Conformance Testing

cloudevents is a tool for testing CloudEvents receivers.

GoDoc Go Report Card

Work in progress.

Installation

cloudevents can be installed via:

go get github.com/cloudevents/conformance/cmd/cloudevents

To update your installation:

go get -u github.com/cloudevents/conformance/cmd/cloudevents

Usage

cloudevents has three commands at the moment: send, invoke and listen.

Send

send will do a one-off creation of a cloudevent and send to a given target.

cloudevents send http://localhost:8080 --id abc-123 --source cloudevents.conformance.tool --type foo.bar

Invoke

invoke will read yaml files, convert them to http and send them to the given target.

cloudevents invoke http://localhost:8080 -f ./yaml/v0.3

Listen

listen will accept http request and write the converted yaml to stdout.

cloudevents listen -v > got.yaml

Optionally, you can forward the incoming request to a target.

cloudevents listen -v -t http://localhost:8181 > got.yaml

Diff

diff compares two yaml event files.

cloudevents diff ./want.yaml ./got.yaml

want.yaml could have fewer fields specified to allow for fuzzy matching.

Example, if you only wanted to compare on type and ignore additional fields:

$ cat ./want.yaml
ContextAttributes:
  type: com.example.someevent
$ cat ./got.yaml
Mode: structured
ContextAttributes:
  specversion: 1.0
  type: com.example.someevent
  time: 2018-04-05T03:56:24Z
  id: 4321-4321-4321-a
  source: /mycontext/subcontext
  Extensions:
    comexampleextension1 : "value"
    comexampleextension2 : |
      {"othervalue": 5}
TransportExtensions:
  user-agent: "foo"
Data: |
  {"world":"hello"}

$ cloudevents diff ./want.yaml ./got.yaml --match type --ignore-additions

This validates that at least one event of type com.example.someevent is present in the got.yaml file.

Advanced Usage

If you would like to produce a pre-produced event yaml file, you can use listen to collect requests. This works with both running event producers that can be directed at the listen port or directly with send.

conformance's People

Contributors

n3wscott avatar evankanderson avatar markpeek avatar bsideup 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.