Plots2: Anyone get this errors while using SQLite?

Created on 11 May 2018  Â·  13Comments  Â·  Source: publiclab/plots2

When I try: bundle exec rake test

Please show us where to look

ERROR["test_search_results_page_at_/search/foo", Minitest::Result, 10.483282999999574]
 test_search_results_page_at_/search/foo#Minitest::Result (10.48s)
ActionView::Template::Error:         ActionView::Template::Error: undefined method `title' for nil:NilClass
            app/views/notes/_notes.html.erb:23:in `block in _app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
            app/views/notes/_notes.html.erb:4:in `_app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
            app/views/searches/results.html.erb:13:in `_app_views_searches_results_html_erb___2440401835890634083_70162085130820'
            test/functional/searches_controller_test.rb:13:in `block in <class:SearchesControllerTest>'

ERROR["test_search_results_page_for_no_results_at_/search/somethingthathasnoresults", Minitest::Result, 10.589508000000023]
 test_search_results_page_for_no_results_at_/search/somethingthathasnoresults#Minitest::Result (10.59s)
ActionView::Template::Error:         ActionView::Template::Error: undefined method `title' for nil:NilClass
            app/views/notes/_notes.html.erb:23:in `block in _app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
            app/views/notes/_notes.html.erb:4:in `_app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
            app/views/searches/results.html.erb:13:in `_app_views_searches_results_html_erb___2440401835890634083_70162085130820'
            test/functional/searches_controller_test.rb:22:in `block in <class:SearchesControllerTest>'

ERROR["test_advanced_search_basic_test", Minitest::Result, 26.591191999999864]
 test_advanced_search_basic_test#Minitest::Result (26.59s)
ActionView::Template::Error:         ActionView::Template::Error: undefined method `title' for nil:NilClass
            app/views/notes/_notes.html.erb:23:in `block in _app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
            app/views/notes/_notes.html.erb:4:in `_app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
            app/views/searches/results.html.erb:13:in `_app_views_searches_results_html_erb___2440401835890634083_70162085130820'
            test/integration/search_flow_test.rb:9:in `block in <class:SearchFlowTest>'

ERROR["test_browse_/search/*", Minitest::Result, 28.237903999999617]
 test_browse_/search/*#Minitest::Result (28.24s)
ActionView::Template::Error:         ActionView::Template::Error: undefined method `title' for nil:NilClass
            app/views/notes/_notes.html.erb:23:in `block in _app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
            app/views/notes/_notes.html.erb:4:in `_app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
            app/views/searches/results.html.erb:13:in `_app_views_searches_results_html_erb___2440401835890634083_70162085130820'
            test/integration/public_pages_test.rb:73:in `block in <class:PublicPagesTest>'


 FAIL["test_running_TypeaheadService.new.notes", Minitest::Result, 27.105869999999413]
 test_running_TypeaheadService.new.notes#Minitest::Result (27.11s)
        Expected: 1
          Actual: 5
        test/unit/typeahead_service_test.rb:8:in `block in <class:TypeaheadServiceTest>'
bug help wanted testing

Most helpful comment

I understand why you decided to do that, but I don't think that's a good practice. We also had some annoying problems because of that. I am totally for using one and only database for all environments.
What we could is to add docs to help to install mariadb, etc.

All 13 comments

Hmm, are you using SQLite? Can you tell us a bit more about your setup?
Thanks!!

On Thu, May 10, 2018, 6:37 PM Jucavi notifications@github.com wrote:

When I try: bundle exec rake test
Please show us where to look

ERROR["test_search_results_page_at_/search/foo", Minitest::Result,
10.483282999999574]
test_search_results_page_at_/search/foo#Minitest::Result (10.48s)
ActionView::Template::Error: ActionView::Template::Error: undefined method title'
for nil:NilClass app/views/notes/_notes.html.erb:23:inblock in
_app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
app/views/notes/_notes.html.erb:4:in _app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
app/views/searches/results.html.erb:13:in
_app_views_searches_results_html_erb___2440401835890634083_70162085130820'
test/functional/searches_controller_test.rb:13:in `block in
class:SearchesControllerTest'

ERROR["test_search_results_page_for_no_results_at_/search/somethingthathasnoresults",
Minitest::Result, 10.589508000000023]
test_search_results_page_for_no_results_at_/search/somethingthathasnoresults#Minitest::Result
(10.59s)
ActionView::Template::Error: ActionView::Template::Error: undefined method title'
for nil:NilClass app/views/notes/_notes.html.erb:23:inblock in
_app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
app/views/notes/_notes.html.erb:4:in _app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
app/views/searches/results.html.erb:13:in
_app_views_searches_results_html_erb___2440401835890634083_70162085130820'
test/functional/searches_controller_test.rb:22:in `block in
class:SearchesControllerTest'

ERROR["test_advanced_search_basic_test", Minitest::Result,
26.591191999999864]
test_advanced_search_basic_test#Minitest::Result (26.59s)
ActionView::Template::Error: ActionView::Template::Error: undefined method title'
for nil:NilClass app/views/notes/_notes.html.erb:23:inblock in
_app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
app/views/notes/_notes.html.erb:4:in _app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
app/views/searches/results.html.erb:13:in
_app_views_searches_results_html_erb___2440401835890634083_70162085130820'
test/integration/search_flow_test.rb:9:in `block in class:SearchFlowTest'

ERROR["test_browse_/search/
", Minitest::Result, 28.237903999999617] test_browse_/search/#Minitest::Result
(28.24s)
ActionView::Template::Error: ActionView::Template::Error: undefined method title'
for nil:NilClass app/views/notes/_notes.html.erb:23:inblock in
_app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
app/views/notes/_notes.html.erb:4:in _app_views_notes__notes_html_erb__3153984447728883472_70162085150440'
app/views/searches/results.html.erb:13:in
_app_views_searches_results_html_erb___2440401835890634083_70162085130820'
test/integration/public_pages_test.rb:73:in `block in
class:PublicPagesTest'

FAIL["test_running_TypeaheadService.new.notes", Minitest::Result,
27.105869999999413]
test_running_TypeaheadService.new.notes#Minitest::Result (27.11s)
Expected: 1
Actual: 5
test/unit/typeahead_service_test.rb:8:in `block in
class:TypeaheadServiceTest'

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/2712, or mute the thread
https://github.com/notifications/unsubscribe-auth/AABfJ75aDw32jufrwCwmkvIFGifuVrrOks5txMEUgaJpZM4T6p1u
.

Yes I'm using SQLite.

About FAIL["test_running_TypeaheadService.new.notes", running from console the test should be pass

Loading development environment (Rails 4.2.10)
irb: warn: can't alias context from irb_context.
2.3.7 :001 > result = TypeaheadService.new.notes('blog')
  Node Load (0.3ms)  SELECT  "node".* FROM "node" WHERE (title LIKE '%%') AND "node"."status" = 1 AND "node"."type" = 'note' GROUP BY "node"."nid"  ORDER BY "node"."changed" DESC LIMIT 5
 => #<ActiveRecord::Relation [#<Node nid: 8, vid: 0, type: "note", language: "", title: "Blog Post", uid: 1, status: 1, created: 1525894286, changed: 1525894286, comment: 1, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 1, comments_count: 1, drupal_node_revisions_count: 1, path: "/notes/admin/05-09-2018/blog-post", main_image_id: nil, slug: nil, legacy_views: 0, views: 0>]>

2.3.7 :002 > result.length
 => 1

2.3.7 :003 > result.uniq.length
  Node Load (0.8ms)  SELECT  DISTINCT "node".* FROM "node" WHERE (title LIKE '%%') AND "node"."status" = 1 AND "node"."type" = 'note' GROUP BY "node"."nid"  ORDER BY "node"."changed" DESC LIMIT 5
 => 1

Thanks.

This is weird! Someone had recently shown that our main test suite, which runs in TravisCI.org on mysql, fails for some tests on sqlite. I'm trying to find a PR which they submitted which fixed a few of these.

I think perhaps we should consider having the tests run on sqlite as well? @icarito what do you think?

It would likely take our tests a bit longer, which is not convenient, but these variations keep popping up which fail in sqlite but not mysql.

@publiclab/reviewers has anyone else seen these kinds of errors in sqlite?

So I think we need to update the README and fix this as well. I'm getting this too. Following the README verbatim, it's hard to get tests running. Tests fail. And I glanced some parts of the code and realised there's use of raw SQL that's specific to some DBMSs. For example looking on this line there's SUBSTRING_INDEX. This is specific to MySQL, SQLite doesn't know about it. So if someone opted to use SQLite or some other DMBS things will break.

At this point I'm beginning to think, what's the point in using multiple DMBS? Is it to test code across all database systems? Won't it make sense to just use one database system (example one used on production) for development? @jywarren

I think we should hear from other @publiclab/reviewers @publiclab/plots2-reviewers about whether we should consider dropping sqlite - the main reason to keep it is that it can lower barriers to getting the installation running in the first place, since installing mariadb/mysql takes a little while. We have some code which we use to switch between DMBSs, too - we could skip that complexity if we dropped sqlite. But I'd like to hear pros/cons from people and then we can make a decision. Thanks!

In the short term, what would we want to change in the README as a short-term fix? Happy to take some PRs or suggestions! Thank you!!!

I understand why you decided to do that, but I don't think that's a good practice. We also had some annoying problems because of that. I am totally for using one and only database for all environments.
What we could is to add docs to help to install mariadb, etc.

@jywarren I also think if this is an issue various users are experiencing it would make sense to have everyone use mysql and instead open up more detailed instructions on setting that up. I don't think contributors will have to worry about installing mariadb unless they are working with the production database directly. But maybe this is one of those topics it would be useful to poll everyone on to see if there would be on average a benefit to it

Note discussion here #4896 !

And @jucavi - it's looking like installing mysql instead of sqlite may resolve this for you -- do you think you can follow some of the instructions here? https://github.com/publiclab/plots2/pull/4897

I also use sqlite3 and get the same errors so I have a count of the failures and errors in master and if I make changes I compare if the errors count on my branch is the same as that on master and resolve the new errors..quite tiring. Will try and install mysql thanks

@cesswairimu yeah it's tiring not to mention how much time-consuming it is! I agree with you! I wish

Hi all! As we've largely moved to using only MariaDB/MySQL, I'll go ahead and close this! TY!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

first-timers[bot] picture first-timers[bot]  Â·  3Comments

grvsachdeva picture grvsachdeva  Â·  3Comments

noi5e picture noi5e  Â·  3Comments

bronwen9 picture bronwen9  Â·  3Comments

ebarry picture ebarry  Â·  3Comments