I would like to automatically test PersistentEntity migrations, but it looks like there is no easy way to do this:
The PersistentEntityTestDriver does not seem to serialize and deserialize events, so it doesn’t use the migrations at all
When using the TestServer there is no easy way to add “old” events into my event store, except maybe if I add “test-only” command handlers that do it for me (which doesn’t seem like a great solution IMO).
Ideally, I would like to start a TestServer with a prepopulated Cassandra instance, but that does not seem to be possible. Is there any other way to automate testing of migrations that I’m not aware of?
Thanks for your answer, I saw the issue you linked and it caused me to try multiple things, like inserting old events manually by using the CassandraSession from the TestServer (which kind of worked), but eventually I settled for a solution that represents the production scenario the closest.
I ended up hooking up a CassandraContainer from testcontainers to the TestServer by overriding the port in the config, which worked fine. The container has an initialization script that mimics the current state of the event store, and I can use the TestServer to verify that the system is able to replay the migrated events.