{"action":"created","issue":{"url":"https://api.github.com/repos/jdgoldie/akka-persistence-shared-inmemory/issues/7","labels_url":"https://api.github.com/repos/jdgoldie/akka-persistence-shared-inmemory/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/jdgoldie/akka-persistence-shared-inmemory/issues/7/comments","events_url":"https://api.github.com/repos/jdgoldie/akka-persistence-shared-inmemory/issues/7/events","html_url":"https://github.com/jdgoldie/akka-persistence-shared-inmemory/issues/7","id":83177287,"number":7,"title":"Reset journal between single node tests","user":{"login":"Unisay","id":1009751,"avatar_url":"https://avatars.githubusercontent.com/u/1009751?v=3","gravatar_id":"","url":"https://api.github.com/users/Unisay","html_url":"https://github.com/Unisay","followers_url":"https://api.github.com/users/Unisay/followers","following_url":"https://api.github.com/users/Unisay/following{/other_user}","gists_url":"https://api.github.com/users/Unisay/gists{/gist_id}","starred_url":"https://api.github.com/users/Unisay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unisay/subscriptions","organizations_url":"https://api.github.com/users/Unisay/orgs","repos_url":"https://api.github.com/users/Unisay/repos","events_url":"https://api.github.com/users/Unisay/events{/privacy}","received_events_url":"https://api.github.com/users/Unisay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-05-31T20:19:51Z","updated_at":"2015-06-03T07:22:26Z","closed_at":null,"body":"My test class extends `akka.testkit.TestKit` and contains several tests.\r\n\r\nI would like to be able to reset journal so that each test starts from scratch (currently journal is kept between tests).\r\n\r\nFirst idea was to send `JournalProtocol.DeleteMessagesTo(persistenceId, toSeqNr, true)` before each test, but this is `private[persistence]`\r\n\r\nCould you please suggest a solution?\r\n\r\nThanks."},"comment":{"url":"https://api.github.com/repos/jdgoldie/akka-persistence-shared-inmemory/issues/comments/108227904","html_url":"https://github.com/jdgoldie/akka-persistence-shared-inmemory/issues/7#issuecomment-108227904","issue_url":"https://api.github.com/repos/jdgoldie/akka-persistence-shared-inmemory/issues/7","id":108227904,"user":{"login":"Unisay","id":1009751,"avatar_url":"https://avatars.githubusercontent.com/u/1009751?v=3","gravatar_id":"","url":"https://api.github.com/users/Unisay","html_url":"https://github.com/Unisay","followers_url":"https://api.github.com/users/Unisay/followers","following_url":"https://api.github.com/users/Unisay/following{/other_user}","gists_url":"https://api.github.com/users/Unisay/gists{/gist_id}","starred_url":"https://api.github.com/users/Unisay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unisay/subscriptions","organizations_url":"https://api.github.com/users/Unisay/orgs","repos_url":"https://api.github.com/users/Unisay/repos","events_url":"https://api.github.com/users/Unisay/events{/privacy}","received_events_url":"https://api.github.com/users/Unisay/received_events","type":"User","site_admin":false},"created_at":"2015-06-03T07:22:25Z","updated_at":"2015-06-03T07:22:25Z","body":"Joshua,\r\n\r\nI have created a pull request that uses other (more simpler) approach to Journal / SnapshotStore truncation - exposes truncate() operation for the underlying hashmap via companion object.\r\n\r\nThis works well for Journal, however, for the SnapshotStore several tests fail:\r\n- they only fail when run as `sbt test`\r\n- if run from IDE without sbt - it doesn't fail.\r\n\r\nThe failure is subtle and somehow related to timing, look:\r\n```\r\nexpected \r\nLoadSnapshotResult(Some(SelectedSnapshot(SnapshotMetadata(p-8,14,1433270708272),s-4)),9223372036854775807), \r\nfound \r\nLoadSnapshotResult(Some(SelectedSnapshot(SnapshotMetadata(p-8,14,1433270707599),s-4)),9223372036854775807)\r\n```\r\n\r\nThe only difference is the timestamp of `SnapshotMetadata`. \r\nI tried to debug it but without luck (so far) as my knowledge/understanding of persistence internal protocols is limited yet.\r\n\r\nI was wondering how to make the test do not depend on System.currentTimeMillis to make it more deterministic...\r\n\r\nDo you have any ideas how moving hasmap to the companion object could affect timestamp of snapshot metadata?"}}