testkube icon indicating copy to clipboard operation
testkube copied to clipboard

Allow webhooks to run on given Test/Testsuite only

Open exu opened this issue 2 years ago • 4 comments

Describe the enhancement you'd like to see

As a tester, I want to send webhook requests only for given Test/TestSuite execution events

WH1 (start,end) = Test1 
WH2 (start) = Test2 
WH3 (start) = "" test -> *

now:
Notify(start Test1) -> WH1 WH2 WH3 

want: 
Notify(start Test1) -> WH1 WH3
        

exu avatar Jul 22 '22 09:07 exu

cc: @TheBrunoLopes @geowalrus4gh

exu avatar Jul 22 '22 09:07 exu

  • Let's use test and test suite labels to filter which events will be sent by a certain webhook. Example of user scenario: User defines 1 or more tests with a certain label, after that he will define a webhook stating that for all the tests with a certain label, listen to "end-events" and send them to a specific URL.

cc: @exu @sweetca

TheBrunoLopes avatar Jul 25 '22 11:07 TheBrunoLopes

One thing to note, that labels can be used for different purposes, this way we will create an implicit link between tests and webhooks. For example, if user add ssome lables to just separate resource projects project=payment_gateway for all resources in same project, then all tests in this project will always use this webhook

I was originally thought about having explicit dependcy: We will add a webhook type to webhook: broadcasting and targeted For each test you will be able to list a set of targeted webhooks If the test is not linked to wehbooks, then notification are sent to all broadcasting webhooks If the test is linked to trageted webhooks, then notifications are sent to them

vsukhin avatar Jul 25 '22 13:07 vsukhin

Check a few uses cases:

  1. If we added a label to test, does it mean that it can only use a webhook for notifications wth the same label?
  2. If we added a label to webhook, does it mean that it can only send notifications for tests with the same label?
  3. If we want to have boardcast notifications, does it mean, that both webhook and test should not have any label?
  4. If test has labels app=testkube,type=backend and one webhook has labels app=testkube,type=backend,service=checkout and other webhook has label app=testkube. what should happen?

vsukhin avatar Jul 25 '22 16:07 vsukhin