CartoDB / cartodb

Location Intelligence & Data Visualization tool
http://carto.com
BSD 3-Clause "New" or "Revised" License
2.76k stars 650 forks source link

rspec: ERROR: role "publicuser" does not exist #261

Closed strk closed 11 years ago

strk commented 11 years ago

The tetsuite runner is designed to "prepare" the testing database BUT tests are failing for me due to role "publicuser" not existing.

I guess the preparation step doesn't ensure such user exist ?

strk commented 11 years ago

I confirm bundle exec rake db:test:prepare doesn't create the publicuser role. Shouldn't it ? I mean, it does create a bunch of users during run, in the form test_cartodb_user_X, why then not creating the publciuser ? Note that the "publicuser" username is currently hard-coded into config/initializers/carto_db.rb

strk commented 11 years ago

Same thing happens with tileuser, also required but not created by the db:test:prepare rake task

demimismo commented 11 years ago

Those users should be created by rake cartodb:db:setup. Did you perform some kind of platform reset?

strk commented 11 years ago

Thanks for the information. I don't know what you mean by "platform reset". You're saying that `rake cartodb:db:setup should create the users, well, that's NOT happening. Not even with 2.2.1 release:

[strk@cartodb(release/2.2.1)] psql -XtAc "select usename from pg_user" template1
strk
[strk@cartodb(release/2.2.1)] bundle exec rake db:test:prepare
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.0
/var/lib/gems/1.9.1/gems/backports-3.1.1/lib/backports/tools.rb:328:in `require_with_backports': iconv will be deprecated in the future, use String#encode instead.
/usr/src/cartodb/cartodb/cartodb/lib/importer/lib/cartodb-importer/importer.rb:20: warning: already initialized constant SUPPORTED_FORMATS
[sequel] Dropped database 'carto_db_test'
[sequel] Created database 'carto_db_test'
createdb: database creation failed: ERROR:  database "carto_db_test" already exists
[sequel] Created database 'carto_db_test'
[strk@cartodb(release/2.2.1)] psql -XtAc "select usename from pg_user" template1
strk

I'll try to figure out what's wrong with the task then.

strk commented 11 years ago

Ah, sorry, I now see you said cartodb:db:setup, not db:test:prepare ! The former is not a dependency of the latter, thus the problem! Should we have a cartodb:test:prepare to ensure proper users setup then ?

strk commented 11 years ago

Strictly, it is cartodb:db:create_publicuser task that's needed here

strk commented 11 years ago

With the pull request I've added a cartodb:test:prepare rake task and updated the instructions in the TESTING file. Do I need a Jira ticket to get this in ?

demimismo commented 11 years ago

Nope, but I assume you should have a running cartodb instance, so that user should be already present on the database.

strk commented 11 years ago

Requirements should be encoded if possible, documented otherwise. Assumptions hurt :)

demimismo commented 11 years ago

Yep, I agree, I'd just document that you should have a running cartodb instance in order to run the test suite.

strk commented 11 years ago

Non need to have a running instance, really. Just a prepared setup. Pull request #262 adds the preparation rake task and appropriate documentation. Looking forward for the merge.

demimismo commented 11 years ago

I don't like adding more complexity to the test setup. Same with Redis, if you remember we ended up complicating the initializer so a new redis server was started with every test run.

I don't think there's anything wrong with documenting that in order to run the test suite you should have a running redis-server or that you should have ran all the rake tasks required to have a running instance of CartoDB.

strk commented 11 years ago

What's complicated ? Have you seen the pull request ?

strk commented 11 years ago

new pull request is rebased to master. I hope it can make it into next release. Will start filing tickets for "make check" failures afterwards. \cc @rafacas