Hello,
I’m trying to write integration test for our software, where in various scenarios we expect a certain set of events to be stored in the eventstore.
In the @Before method of our test, I want to clean up a stream an write certain events to that stream.
I’m having problems with the first part: the clean up of the stream. Based upon what I found here, I trying to use the ‘Truncate Before’ by setting the $tb to the stream metadata.
In order to determine the number for the $tb-value I read the feed of /stream/my-stream and us the number of the first entry (So far I’m fine)
In order to set the $tb I POST to the POST /streams/my-stream/metadata the following message:
[{“eventType”:“TruncateBeforeFromIntegrationTest”,“eventId”:“898534db-b423-49ee-b98d-e03147861355”,“data”:{"$tb":3}}]
and I get “HTTP/1.1 201 Created” with /streams/%24%24my-stream//11"
When I get /streams/my-stream/metadata I see: No 11 / Stream: $$my-stream with correct type and timestamp and as data:
{
"$tb": 3
}
But when I get /streams/my-stream I still see the list of 4 previous events in the stream.
What more do I need to do or what do I need to change to stop seeing the previous events?
With kind regards,
Marco Beelen