-
Notifications
You must be signed in to change notification settings - Fork 19
Conversation
Await.result(future, 10 seconds) | ||
} | ||
|
||
def pp(obj: Any)(implicit testData: TestData = null) = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The = null
trick can be used to detect whether an implicit TestData
is in scope or not.
4ca9fab
to
7f97a25
Compare
f68af08
to
fbb35b7
Compare
def oAuthCallSubscriptions = Skipped("No way for current Nakadi docker image to detect \"wrong\" tokens") | ||
|
||
def oAuthPublishEvents = Skipped("No way for current Nakadi docker image to detect \"wrong\" tokens") | ||
ignore("No way for current Nakadi docker image to detect \"wrong\" tokens") { _ => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scalatest's ignore properly supports having code contained inside which doesn't run unlike with specs2 so I have gone ahead and undid the removal of the test code which happened in the past.
Even though the tests don't work with the current Nakadi docker image, the code illustrates what the expected behaviour is which is useful (and as a bonus if hypothetical future Nakadi docker image ends up supporting this kind of test its trivial to remove the ignore).
421b260
to
adf3a49
Compare
Await.result(createEventType, 10 seconds) | ||
|
||
override def afterAll = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up deleting this method because it wasn't actually being run correctly and when I fixed it I got
[info] org.zalando.kanadi.SubscriptionsSpec *** ABORTED ***
[info] org.zalando.kanadi.models.GeneralError: Error from server, response is Problem(None,Conflict,409,Some(Can't remove event type Kanadi-Test-Event-be9f9995-7b57-494f-a09f-64355b16d73e, as it has subscriptions),None)
I tried fixing it but I couldn't do so (likely need to put a manual wait) but in any case this cleanup is an artifact of when Kanadi used to test against the actual Zalando test realm (where you did need to clean up subscriptions), and since we run against a docker image this is pointless now so its just better to delete it
@gchudnov PR is ready to review |
adf3a49
to
8486f67
Compare
|
||
def createEventType = eventsTypesClient.create(EventType(eventTypeName, OwningApplication, Category.Business)) | ||
|
||
override def beforeAll = | ||
override def beforeAll(): Unit = { | ||
super.beforeAll() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should always call super.beforeAll
in case super traits also do some initialisation which is required
subscriptionsClient.createIfDoesntExist(subscription) | ||
}) | ||
} yield retrievedSubscription).flatMap(a => a) | ||
retrievedSubscription <- Future.sequence(subscriptions.map { subscription => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why left arrow wasn't being used here, Future.sequence
also returns a future so we should yield on it like another other Future
.
Pull Request Test Coverage Report for Build 5906887934
💛 - Coveralls |
Converted to draft again because although the tests passed I noticed this
Will need to look in more detail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good thank you!
wondering if that issue with ports is related to EventPublishRetrySpec.scala
, where several servers are started (with the same port (?))
@gchudnov Don't merge this yet, it seems the tests are always passing due to a qwerk with how async testing is working, currently fixing this now (and it should also helpfully fix the port issue). |
036d613
to
cc07a44
Compare
eventTypeName.pp | ||
s"Consumer Group: $consumerGroup".pp | ||
|
||
def createEventType = eventsTypesClient.create(EventType(eventTypeName, OwningApplication, Category.Business)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was causing issues when run in beforeAll
(likely due to scalatest not expecting to do async calls like this before the tests are run) so I just moved the logic into the main test and I also cleaned up the test so its easier to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aha, got it
cc07a44
to
a9e85d0
Compare
969a3a6
to
67f846e
Compare
yes, and it is not possible to merge a draft PR. |
So the good news is I fixed the fundamental issues with the PR which means the tests are properly running, i.e. I am now using The issues I am dealing with now is that although some of the test suites run in isolation, if you run all of the tests at once there is a race conditions where the tests don't complete. Its probably due to a test/class lifecycle, cleanup with Feel free to do a bit of digging on your side, I am currently playing around with disabling/disabling the |
wondering if it helps to serialize the tests on sbt level? |
I think that theoretically they should already be serialized so its probably something else |
Signed-off-by: Matthew de Detrich <mdedetrich@gmail.com>
67f846e
to
9e8b65d
Compare
@gchudnov I finally figured out the issue, it was kind of a face palm moment. Currently with specs2, the order in which the tests are executed is not determined by the test functions (i.e. override def is: SpecStructure = sequential ^ s2"""
Create Event Type $createEventType
Create Subscription events $createSubscription
Start streaming $startStreaming
Publish events $publishEvents
Receive events from source $receiveEvents
Close connection $closeConnection
Delete subscription $deleteSubscription
Delete event type $deleteEventType
""" It turns out that for the So to me the PR looks good now, I would also check through it to see if there is anything I may have missed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you,
merging..
Resolves: #135
Resolves: #207
This PR replaces specs2 with scalatest which provides the following benefits
pp
it can be extended to do things like auto generate a flowId (even further reducing the boilerplate of current tests).map
)I have done some minor improvements but in general I have preferenced minimizing the diff rather than doing more idiomatic improvements (which can be done in future PR's)