{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/comments/192009250","pull_request_review_id":124693166,"id":192009250,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MjAwOTI1MA==","diff_hunk":"@@ -38,28 +39,57 @@ object CassandraSpec {\n     reduced.head.replaceFirst(\"\"\".*\\.\"\"\", \"\").replaceAll(\"[^a-zA-Z_0-9]\", \"_\")\n   }\n \n-  def configWithKeyspace(name: String) = ConfigFactory.parseString(\n+  def configWithKeyspace(journalKeyspace: String, snapshotStoreKeyspace: String, port: Int): Config = ConfigFactory.parseString(\n     s\"\"\"\n-      cassandra-journal.keyspace = $name\n-       cassandra-query-journal = {\n-         first-time-bucket = \"${today.minusHours(2).format(query.firstBucketFormat)}\"\n-       }\n+      cassandra-journal {\n+        keyspace = $journalKeyspace\n+        port = $port\n+      }\n+\n+      cassandra-snapshot-store {\n+        keyspace = $snapshotStoreKeyspace\n+        port = $port\n+      }\n     \"\"\"\n-  ).withFallback(CassandraLifecycle.config)\n+  )\n+\n }\n \n-abstract class CassandraSpec(config: Config) extends TestKit(ActorSystem(getCallerName(getClass), config.withFallback(configWithKeyspace(getCallerName(getClass)))))\n+/**\n+ * Picks a free port for Cassandra before starting the ActorSystem\n+ */\n+abstract class CassandraSpec(config: Config, val journalName: String = getCallerName(getClass), val snapshotName: String = getCallerName(getClass)) extends TestKitBase\n   with ImplicitSender\n   with WordSpecLike\n   with Matchers\n   with CassandraLifecycle\n   with ScalaFutures {\n \n-  override def systemName = system.name\n+  lazy val randomPort = freePort()\n+  override def port(): Int = randomPort\n+\n+  final implicit lazy val system: ActorSystem = {\n+    // always use this p;ort and keyspace generated here, then test config, then the lifecycle config\n+    val finalConfig = configWithKeyspace(journalName, snapshotName, port()).withFallback(config).withFallback(CassandraLifecycle.config).resolve()\n+    ActorSystem(journalName, finalConfig)\n+  }\n+\n+  final override def systemName = system.name\n+\n   implicit val mat = ActorMaterializer()(system)\n \n   implicit val patience = PatienceConfig(timeout = Span(5, Seconds), interval = Span(100, Milliseconds))\n \n+  private def freePort(): Int = {\n+    val serverSocket = ServerSocketChannel.open().socket()\n+    serverSocket.bind(new InetSocketAddress(\"127.0.0.1\", 0))\n+    val port = serverSocket.getLocalPort\n+    serverSocket.close()\n+    port\n+  }","path":"core/src/test/scala/akka/persistence/cassandra/CassandraSpec.scala","position":85,"original_position":85,"commit_id":"6e4f7a58d3e1b3dee07af0ab6cc8b44a9c008084","original_commit_id":"6e4f7a58d3e1b3dee07af0ab6cc8b44a9c008084","user":{"login":"patriknw","id":336161,"node_id":"MDQ6VXNlcjMzNjE2MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/336161?v=4","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"body":"use `akka.testkit.SocketUtil` ?","created_at":"2018-05-31T07:24:31Z","updated_at":"2018-05-31T07:29:49Z","html_url":"https://github.com/akka/akka-persistence-cassandra/pull/354#discussion_r192009250","pull_request_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/354","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/comments/192009250"},"html":{"href":"https://github.com/akka/akka-persistence-cassandra/pull/354#discussion_r192009250"},"pull_request":{"href":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/354"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/354","id":191401699,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxNDAxNjk5","html_url":"https://github.com/akka/akka-persistence-cassandra/pull/354","diff_url":"https://github.com/akka/akka-persistence-cassandra/pull/354.diff","patch_url":"https://github.com/akka/akka-persistence-cassandra/pull/354.patch","issue_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/issues/354","number":354,"state":"open","locked":false,"title":"Build reliability in travis","user":{"login":"chbatey","id":1866779,"node_id":"MDQ6VXNlcjE4NjY3Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/1866779?v=4","gravatar_id":"","url":"https://api.github.com/users/chbatey","html_url":"https://github.com/chbatey","followers_url":"https://api.github.com/users/chbatey/followers","following_url":"https://api.github.com/users/chbatey/following{/other_user}","gists_url":"https://api.github.com/users/chbatey/gists{/gist_id}","starred_url":"https://api.github.com/users/chbatey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chbatey/subscriptions","organizations_url":"https://api.github.com/users/chbatey/orgs","repos_url":"https://api.github.com/users/chbatey/repos","events_url":"https://api.github.com/users/chbatey/events{/privacy}","received_events_url":"https://api.github.com/users/chbatey/received_events","type":"User","site_admin":false},"body":"There were two things causing unstable builds:\r\n* Always using the same port for Cassandra, meaning that if it wasn't shutdown properly or the travis host didn't release the port right away then all the other tests would fail\r\n* Exceptions thrown in afterAll in tests, causing the super.afterAll not to be run which contained shuttung down Cassandra. This would make the rest of the tests fail, due to leaving around a 2GB JVM. \r\n\r\nI've also refactored a lot of the common stuff from tests into a `CassandraSpec` e.g getting a query, getting  cassandra connection. ","created_at":"2018-05-30T10:14:20Z","updated_at":"2018-05-31T07:29:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c46adfc8b8c5c5c9f15396d0e229d2016799ce6b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/354/commits","review_comments_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/354/comments","review_comment_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/issues/354/comments","statuses_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/statuses/6e4f7a58d3e1b3dee07af0ab6cc8b44a9c008084","head":{"label":"chbatey:build-speed","ref":"build-speed","sha":"6e4f7a58d3e1b3dee07af0ab6cc8b44a9c008084","user":{"login":"chbatey","id":1866779,"node_id":"MDQ6VXNlcjE4NjY3Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/1866779?v=4","gravatar_id":"","url":"https://api.github.com/users/chbatey","html_url":"https://github.com/chbatey","followers_url":"https://api.github.com/users/chbatey/followers","following_url":"https://api.github.com/users/chbatey/following{/other_user}","gists_url":"https://api.github.com/users/chbatey/gists{/gist_id}","starred_url":"https://api.github.com/users/chbatey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chbatey/subscriptions","organizations_url":"https://api.github.com/users/chbatey/orgs","repos_url":"https://api.github.com/users/chbatey/repos","events_url":"https://api.github.com/users/chbatey/events{/privacy}","received_events_url":"https://api.github.com/users/chbatey/received_events","type":"User","site_admin":false},"repo":{"id":98081504,"node_id":"MDEwOlJlcG9zaXRvcnk5ODA4MTUwNA==","name":"akka-persistence-cassandra","full_name":"chbatey/akka-persistence-cassandra","owner":{"login":"chbatey","id":1866779,"node_id":"MDQ6VXNlcjE4NjY3Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/1866779?v=4","gravatar_id":"","url":"https://api.github.com/users/chbatey","html_url":"https://github.com/chbatey","followers_url":"https://api.github.com/users/chbatey/followers","following_url":"https://api.github.com/users/chbatey/following{/other_user}","gists_url":"https://api.github.com/users/chbatey/gists{/gist_id}","starred_url":"https://api.github.com/users/chbatey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chbatey/subscriptions","organizations_url":"https://api.github.com/users/chbatey/orgs","repos_url":"https://api.github.com/users/chbatey/repos","events_url":"https://api.github.com/users/chbatey/events{/privacy}","received_events_url":"https://api.github.com/users/chbatey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chbatey/akka-persistence-cassandra","description":"A replicated Akka Persistence journal backed by Apache Cassandra","fork":true,"url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra","forks_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/forks","keys_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/teams","hooks_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/hooks","issue_events_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/issues/events{/number}","events_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/events","assignees_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/assignees{/user}","branches_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/branches{/branch}","tags_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/tags","blobs_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/git/refs{/sha}","trees_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/statuses/{sha}","languages_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/languages","stargazers_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/stargazers","contributors_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/contributors","subscribers_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/subscribers","subscription_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/subscription","commits_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/commits{/sha}","git_commits_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/git/commits{/sha}","comments_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/comments{/number}","issue_comment_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/issues/comments{/number}","contents_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/contents/{+path}","compare_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/merges","archive_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/downloads","issues_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/issues{/number}","pulls_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/pulls{/number}","milestones_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/milestones{/number}","notifications_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/labels{/name}","releases_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/releases{/id}","deployments_url":"https://api.github.com/repos/chbatey/akka-persistence-cassandra/deployments","created_at":"2017-07-23T07:22:13Z","updated_at":"2018-03-23T16:22:13Z","pushed_at":"2018-05-30T17:19:24Z","git_url":"git://github.com/chbatey/akka-persistence-cassandra.git","ssh_url":"git@github.com:chbatey/akka-persistence-cassandra.git","clone_url":"https://github.com/chbatey/akka-persistence-cassandra.git","svn_url":"https://github.com/chbatey/akka-persistence-cassandra","homepage":"","size":1394,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"08e151a9358506c29ec57db09898b8fb9a3fccda","user":{"login":"akka","id":1496237,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0OTYyMzc=","avatar_url":"https://avatars2.githubusercontent.com/u/1496237?v=4","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":48993109,"node_id":"MDEwOlJlcG9zaXRvcnk0ODk5MzEwOQ==","name":"akka-persistence-cassandra","full_name":"akka/akka-persistence-cassandra","owner":{"login":"akka","id":1496237,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0OTYyMzc=","avatar_url":"https://avatars2.githubusercontent.com/u/1496237?v=4","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka-persistence-cassandra","description":"A replicated Akka Persistence journal backed by Apache Cassandra","fork":true,"url":"https://api.github.com/repos/akka/akka-persistence-cassandra","forks_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/forks","keys_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/teams","hooks_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/hooks","issue_events_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/events","assignees_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/tags","blobs_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/languages","stargazers_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/stargazers","contributors_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/contributors","subscribers_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/subscribers","subscription_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/subscription","commits_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/merges","archive_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/downloads","issues_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka-persistence-cassandra/deployments","created_at":"2016-01-04T11:31:53Z","updated_at":"2018-05-30T09:36:12Z","pushed_at":"2018-05-30T17:19:25Z","git_url":"git://github.com/akka/akka-persistence-cassandra.git","ssh_url":"git@github.com:akka/akka-persistence-cassandra.git","clone_url":"https://github.com/akka/akka-persistence-cassandra.git","svn_url":"https://github.com/akka/akka-persistence-cassandra","homepage":"","size":1387,"stargazers_count":221,"watchers_count":221,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":75,"mirror_url":null,"archived":false,"open_issues_count":52,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":75,"open_issues":52,"watchers":221,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/354"},"html":{"href":"https://github.com/akka/akka-persistence-cassandra/pull/354"},"issue":{"href":"https://api.github.com/repos/akka/akka-persistence-cassandra/issues/354"},"comments":{"href":"https://api.github.com/repos/akka/akka-persistence-cassandra/issues/354/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/354/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka-persistence-cassandra/pulls/354/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka-persistence-cassandra/statuses/6e4f7a58d3e1b3dee07af0ab6cc8b44a9c008084"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"patriknw"}}