{"action":"created","issue":{"url":"https://api.github.com/repos/pantsbuild/pants/issues/3496","repository_url":"https://api.github.com/repos/pantsbuild/pants","labels_url":"https://api.github.com/repos/pantsbuild/pants/issues/3496/labels{/name}","comments_url":"https://api.github.com/repos/pantsbuild/pants/issues/3496/comments","events_url":"https://api.github.com/repos/pantsbuild/pants/issues/3496/events","html_url":"https://github.com/pantsbuild/pants/issues/3496","id":156602910,"number":3496,"title":"Junit test fails with parallel-threads and the output says it ran twice.","user":{"login":"mateor","id":1743873,"avatar_url":"https://avatars.githubusercontent.com/u/1743873?v=3","gravatar_id":"","url":"https://api.github.com/users/mateor","html_url":"https://github.com/mateor","followers_url":"https://api.github.com/users/mateor/followers","following_url":"https://api.github.com/users/mateor/following{/other_user}","gists_url":"https://api.github.com/users/mateor/gists{/gist_id}","starred_url":"https://api.github.com/users/mateor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mateor/subscriptions","organizations_url":"https://api.github.com/users/mateor/orgs","repos_url":"https://api.github.com/users/mateor/repos","events_url":"https://api.github.com/users/mateor/events{/privacy}","received_events_url":"https://api.github.com/users/mateor/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-05-24T20:36:08Z","updated_at":"2016-05-24T22:16:27Z","closed_at":"2016-05-24T22:16:27Z","body":"This is with vanilla pants 1.0.0 and so far only triggers on Linux CI - but it is non-deterministic so the platform could be a red-herring.\r\n\r\nWe have a test that makes db calls. It fails non-deterministically unless parallel-threads is set to 1. When it fails, the output says that the test is being run twice. The circumstantial evidence is that the test is being sharded within the test itself, but I don't really know what these runners do under the hood atm.\r\n\r\n\r\nThe test is open source, so:\r\n\r\n        @Test\r\n        def testBulkInsertOne: Unit = {\r\n          val venues = (1 to 5).map(_ => baseTestVenue())\r\n          val venueIds = venues.map(_.id)\r\n          val clauses = venues.map(v => BulkInsertOne(v))\r\n          db.bulk(clauses)\r\n\r\n          db.count(Q(ThriftVenue).where(_.id in venueIds)) must_== venues.length\r\n        }\r\n\r\nAnd the results of running `./pants test test::`:\r\n\r\n\r\n                   There were 2 failures:\r\n                     1) testBulkInsertOne(io.fsq.rogue.spindle.test.EndToEndTest)\r\n                     java.lang.Exception: '1' is not equal to '5'\r\n                     ...\r\n                     2) testBulkInsertOne(io.fsq.rogue.spindle.test.EndToEndTest)\r\n                     java.lang.Exception: '4' is not equal to '0'\r\n\r\nThere are no other tests with that name and this test is not depended upon by any other targets. If I dig into the `junit_run.py`, it looks to me like the runner is gathering all of the tests into a single batch, but that the test is being broken up into its composite functions.\r\n\r\nI see these elements if I examine the `batch` variable on [line 338 of `junit_run.py`](https://github.com/pantsbuild/pants/blob/1.0.x/src/python/pants/backend/jvm/tasks/junit_run.py#L338) (which has changed since 1.0.0)\r\n\r\n      ...,\r\n      u'io.fsq.rogue.spindle.test.EndToEndTest$$anonfun$testBulkInsertOne$1$$anonfun$apply$mcJ$sp$19',\r\n      ...,\r\n      u'io.fsq.rogue.spindle.test.EndToEndTest$$anonfun$testBulkInsertOne$1',\r\n      ..., \r\n      u'io.fsq.rogue.spindle.test.EndToEndTest$$anonfun$testBulkInsertOne$2',\r\n      ...\r\n\r\nThe output is suspicious in the same way, in that it is failing to find 5 entries in one check and is instead finding 1 element and then 4 elements in two.\r\n"},"comment":{"url":"https://api.github.com/repos/pantsbuild/pants/issues/comments/221418431","html_url":"https://github.com/pantsbuild/pants/issues/3496#issuecomment-221418431","issue_url":"https://api.github.com/repos/pantsbuild/pants/issues/3496","id":221418431,"user":{"login":"mateor","id":1743873,"avatar_url":"https://avatars.githubusercontent.com/u/1743873?v=3","gravatar_id":"","url":"https://api.github.com/users/mateor","html_url":"https://github.com/mateor","followers_url":"https://api.github.com/users/mateor/followers","following_url":"https://api.github.com/users/mateor/following{/other_user}","gists_url":"https://api.github.com/users/mateor/gists{/gist_id}","starred_url":"https://api.github.com/users/mateor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mateor/subscriptions","organizations_url":"https://api.github.com/users/mateor/orgs","repos_url":"https://api.github.com/users/mateor/repos","events_url":"https://api.github.com/users/mateor/events{/privacy}","received_events_url":"https://api.github.com/users/mateor/received_events","type":"User","site_admin":false},"created_at":"2016-05-24T22:16:27Z","updated_at":"2016-05-24T22:16:27Z","body":"I am damn glad you stopped by. I was busy trying to learn about the junit_run test sharding. I got waylaid by the Pants output - I don't remember seeing the same test report multiple failures.\r\n\r\nI do appreciate shaking this loose for me, it will be nice to have someone else own the mongo threading bug :)"}}
{"actor":{"display_login":"mateor"}}