Open wabrit opened 3 weeks ago
@wabrit thanks for opening the issue. It sounds like a useful enhancement. Would you be interested in contributing a pull request for this?
Hi @shakuzen - I'd be happy to try, and I do have my own "workaround", but perhaps it would be a good idea to submit some kind of API design proposal first before a PR? Is here the right place to do that?
Sure, here is fine. Leave a comment with what you have in mind.
What I envisaged would be to extend the TestObservationRegistryAssert
class (and supporting classes) to support this:
TestObservationRegistryAssert.assertThat(observationRegistry)
.hasObservationWithNameEqualTo("foo")
.that()
.hasEvent("event1") /* event with name event1 exists in observation */
.doesNotHaveEvent("event2") /* no event with name event2 in observation */
....
Hi all - does the above proposal sound ok before I embark on a PR, and (not having committed to this project before) is there a guide to that process? (I assume I need to fork the repo and create a branch on the fork to submit the PR against)
Your proposal looks reasonable to me. As for contributing, check the contributing guide. Yes, forking the repo and committing the changes to a branch in that fork and submitting a pull request would be the right process.
Please describe the feature request. The
micrometer-observation-test
dependency does not appear to offer a simple way of asserting on observation events in testsRationale The
TestObservationRegistryAssert
class handles assertions on what observations have been made, the key values associated with an observation, etc. But it does not appear to provide support for asserting that particular calls toObservation#event(...)
have been made.This is necessary to provide test coverage for observations which raise events.
Additional context This is based on using version
1.13.2
ofio.micrometer:micrometer-observation-test