Git Product home page Git Product logo

immune's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

devopstoday11

immune's Issues

Add Authentication

Allow authentication configuration, so we can test against authenticated APIs

Isolate Test cases

After long discussions with the team, we have decided to implement isolation of test cases in the following way:

"test_cases": [
        {
            "setup": [
                "setup_group",
                "setup_app",
                "setup_app_endpoint",
            ],
            "http_method": "POST",
            "endpoint": "/events?groupID={group_id}",
            "callback": {
                "enabled": true,
                "times": 2
            },
            "request_body": {
                "app_id": "{app_id}",
                "event_type": "payment.failed",
                "data": {
                    "sc": "gene",
                    "marvel": "stark"
                }
            },
            "response_body": true,
        }
    ]

Where the setup array references the names of the setup funcs to be run before this test case is run
After each test case finishes the db is truncated.

Scope callback channel to Test cases

The way it works now, consecutive test cases that require callbacks may spill over. For instance, if a test case specifies 1 callback but 2 come through for it, the next test case to require a callback will first of all drain the excess callback from the channel. This corrupts the system & makes its integrity false.

Ways to solve this may include:

  • would be to scope that for each channel, it is a single channel that receives its callback, a new channel for the next test case.
  • duplicate the net object that executes test cases, this way we can tweak it to ensure the server object starts each test case with a new channel
  • have an array of channels for each respective test case.

I will give this some thought before trying to solve it.

Verify Webhook Events

Immune callbacks should validate webhook events. It means when a callback receives an event. It should:

  1. Sign the payload with the shared secret.
  2. Compare the derived hash with the header's hash.

A success in step 2 indicates a successful test else a failure.

This feature is essential for verifying that Convoy is signing the payload properly, and bugs like this don't repeat themselves.

Register callback channel with callback server

The test cases should register a channel with the callback server with its callback id in this manner:

cs := callback.NewServer()
cs.RegisterCallbackChannel(uid string, ch chan struct{})

The cs.RegisterCallbackChannel method should look like this:

func (s *Server) RegisterCallbackChannel(uid string, ch chan struct{}) {
   s.chanMap[uid] = ch
}

And when a callback is received the uuid should be extracted and the channel gotten from that map, then a struct{}{} sent on it. This allows the callback signalling to be disjointed, and is one step to allowing us run test cases concurrently.

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.