Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventTrasformationForTriggerTest can run with any Broker #3603

Conversation

pierDipi
Copy link
Member

Proposed Changes

  • Allow running EventTrasformationForTriggerTest test with any Broker

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 16, 2020
@knative-prow-robot knative-prow-robot added the area/test-and-release Test infrastructure, tests or release label Jul 16, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 16, 2020
@pierDipi
Copy link
Member Author

/cc devguyio
/cc chizhg

- Allow to run this test with any Broker

Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
@pierDipi pierDipi force-pushed the generic-event-trasformation-for-trigger-test branch from aaf1872 to 981e839 Compare July 16, 2020 09:50
@slinkydeveloper
Copy link
Contributor

slinkydeveloper commented Jul 16, 2020

/lgtm
/approve
/hold

@devguyio mind giving a look? you're doing a similar thing in sources, so it would be better if we keep aligned the patterns, in order to reduce a bit the complexity of them 😄 unhold when it's ready for you

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 16, 2020
@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 16, 2020
@vaikas
Copy link
Contributor

vaikas commented Jul 16, 2020

Great! Thanks for working on this!!

Also related to:
#3531

My thinking was that for all these tests, we should just need to pass in the ns/broker name and run the tests against that. So pulling the Broker creation out. Ideally you could create the Broker out of band (kubectl) and just run these tests by specifying the ns/brokername.

Broker specific behaviour tests (creating them, are the right channels, etc. being created) should only really exercise the MT Channel Based Broker. Thoughts?

@slinkydeveloper
Copy link
Contributor

Broker specific behaviour tests (creating them, are the right channels, etc. being created) should only really exercise the MT Channel Based Broker. Thoughts?

@vaikas I may be wrong, but i'm not sure this is always doable because some tests might want to configure some bits of the broker (not dependant on the specific version), like the dlq, and this seems to be better to properly configure it inside using the setup fn.

@pierDipi
Copy link
Member Author

My thinking was that for all these tests, we should just need to pass in the ns/broker name and run the tests against that. So pulling the Broker creation out. Ideally you could create the Broker out of band (kubectl) and just run these tests by specifying the ns/brokername.

I actually think this is an interesting idea, not applicable to all tests, though.
For example, there are tests like control plane conformance tests where we assess specific conditions (e.g. ready / not ready) that we can reproduce when we create objects in a specific order.
Is the goal of this change improving debuggability?

Anyway, I think using a simple function like in this PR, nothing prevents us to create a no-op function that just returns the name of the object you created before, and for the namespace, we can tweak the client to use a specific namespace based on a flag. Of course, this needs to be extended not only to the Broker but also to the Trigger.

Broker specific behaviour tests (creating them, are the right channels, etc. being created) should only really exercise the MT Channel Based Broker. Thoughts?

@vaikas I may be wrong, but i'm not sure this is always doable because some tests might want to configure some bits of the broker (not dependant on the specific version), like the dlq, and this seems to be better to properly configure it inside using the setup fn.

My feeling is similar, there are tests that require a specific configuration of the object.
We can document this behavior and then it's up the user (us) to properly configure the object.

@vaikas
Copy link
Contributor

vaikas commented Jul 18, 2020

Everybody's right but probably me :)

I think as you correctly point out there are few kinds of categories of tests where how the broker is created is important, the dlq example is a good one. But I think there are also classes of tests where we're testing things like routing, replying, and so forth where especially if I'm writing a broker, I'd like to run the tests against my broker that I have created, and I just think that by breaking the broker creation from the tests that exercise it might be helpful. Again, I think about this in terms:

  • create the Unit Under Test
  • Run tests

Right now if a user wants to not modify any of our test code but just use it, they would have to modify the tests. That can be a barrier for testing. I think it's reasonable to expect that if you run DLQ tests, you should configure your broker to be configured properly and so forth, or then I'd expect the tests to fail, which I think is a good thing :)

So @pierDipi you're totally right that nothing is preventing and as you point out you can pass in the BrokerCreator that just returns the string but that still requires changing our code. I wonder if we can just add (not part of this PR, this is great stuff you're doing here so no need to block on that) a flag that says use this broker instead, and then we can parse the flag and if it's given, we pass in a custom BrokerCreator that just returns that flag?

@vaikas
Copy link
Contributor

vaikas commented Jul 19, 2020

/lgtm
/approve

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pierDipi, slinkydeveloper, vaikas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@slinkydeveloper
Copy link
Contributor

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 20, 2020
@pierDipi
Copy link
Member Author

FAIL: TestPersistedStore (1.02s)

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test-and-release Test infrastructure, tests or release cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants