{"action":"opened","issue":{"url":"https://api.github.com/repos/cloudfoundry/cloud_controller_ng/issues/720","repository_url":"https://api.github.com/repos/cloudfoundry/cloud_controller_ng","labels_url":"https://api.github.com/repos/cloudfoundry/cloud_controller_ng/issues/720/labels{/name}","comments_url":"https://api.github.com/repos/cloudfoundry/cloud_controller_ng/issues/720/comments","events_url":"https://api.github.com/repos/cloudfoundry/cloud_controller_ng/issues/720/events","html_url":"https://github.com/cloudfoundry/cloud_controller_ng/issues/720","id":189686839,"number":720,"title":"Parallel tests fail due to race condition when creating cc_test DB","user":{"login":"petergtz","id":3618401,"avatar_url":"https://avatars.githubusercontent.com/u/3618401?v=3","gravatar_id":"","url":"https://api.github.com/users/petergtz","html_url":"https://github.com/petergtz","followers_url":"https://api.github.com/users/petergtz/followers","following_url":"https://api.github.com/users/petergtz/following{/other_user}","gists_url":"https://api.github.com/users/petergtz/gists{/gist_id}","starred_url":"https://api.github.com/users/petergtz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petergtz/subscriptions","organizations_url":"https://api.github.com/users/petergtz/orgs","repos_url":"https://api.github.com/users/petergtz/repos","events_url":"https://api.github.com/users/petergtz/events{/privacy}","received_events_url":"https://api.github.com/users/petergtz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-16T12:18:39Z","updated_at":"2016-11-16T12:18:39Z","closed_at":null,"body":"Thanks for submitting an issue to `cloud_controller_ng`. We are always trying to improve! To help us, please fill out the following template.\r\n\r\n## Issue\r\n\r\n`bundle exec rake` as documented in README.md currently fails with:\r\n\r\n```\r\n psql -q -h localhost -p 5432 -U postgres -c 'create database cc_test;'\r\nERROR:  permission denied to create database\r\nrake aborted!\r\nCommand failed with status (1): [ psql -q -h localhost -p 5432 -U postgres ...]\r\n/Users/pego/workspace/cloud_controller_ng_master/lib/tasks/db.rake:135:in `block (2 levels) in <top (required)>'\r\n/Users/pego/.gem/ruby/2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'\r\nTasks: TOP => db:create\r\n(See full trace by running task with --trace)\r\n```\r\n\r\n## Context\r\n\r\nWe simply followed the instructions in the README.md using `bundle exec rake`. We tested using a fresh install of postgres DB.\r\n\r\n## Steps to Reproduce\r\n\r\n```\r\ngit clone https://github.com/cloudfoundry/cloud_controller_ng\r\ncd cloud_controller_ng\r\nbundle exec rake\r\n```\r\n\r\n## Expected result\r\n\r\nTests should run successful.\r\n\r\n## Current result\r\nIn the test console:\r\n\r\n```\r\n psql -q -h localhost -p 5432 -U postgres -c 'create database cc_test;'\r\nERROR:  permission denied to create database\r\nrake aborted!\r\nCommand failed with status (1): [ psql -q -h localhost -p 5432 -U postgres ...]\r\n/Users/pego/workspace/cloud_controller_ng_master/lib/tasks/db.rake:135:in `block (2 levels) in <top (required)>'\r\n/Users/pego/.gem/ruby/2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'\r\nTasks: TOP => db:create\r\n(See full trace by running task with --trace)\r\n```\r\n\r\nIn the Postgres server log:\r\n```\r\nERROR:  duplicate key value violates unique constraint \"pg_database_datname_index\"\r\nDETAIL:  Key (datname)=(cc_test) already exists.\r\nSTATEMENT:  create database cc_test;\r\n```\r\n\r\nIt looks like the parallel tests cause a race condition when creating the cc_test DB.\r\n\r\n## Possible Fix\r\n\r\n`bundle exec rake spec:serial` fixed it for us. Maybe documenting it as such would suffice.\r\n\r\n"}}
{"actor":{"display_login":"petergtz"}}