consuldemocracy
consuldemocracy copied to clipboard
Flaky spec: Commenting legislation questions Merged comment threads View comments of annotations in an included range
References
- This test, which is in the
spec/system/comments/legislation_annotations_spec.rbfile, has failed a few times, like in our test run 3695, job 4 (see the test run 3695 job log) - A similar test failed on or our test run 3861, job 0 (see the test run 3861 job log)
Failure
The test has failed with different error messages. Here's one of them:
1) Commenting legislation questions Merged comment threads View comments of annotations in an included range
Failure/Error: where(key: key).pluck(:value).first.presence
ActionView::Template::Error:
PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block
: SELECT "settings"."value" FROM "settings" WHERE "settings"."key" = $1 ORDER BY "settings"."id" ASC
# ./app/models/setting.rb:34:in `[]'
# ./app/models/comment.rb:122:in `body_max_length'
# ./app/views/legislation/annotations/_comments_box.html.erb:27:in `block in _app_views_legislation_annotations__comments_box_html_erb__1211365376757441395_339920'
# ./app/views/legislation/annotations/_comments_box.html.erb:24:in `_app_views_legislation_annotations__comments_box_html_erb__1211365376757441395_339920'
# ./app/views/legislation/annotations/comments.js.erb:2:in `_app_views_legislation_annotations_comments_js_erb__2521939281924984446_339900'
# ./config/initializers/wicked_pdf.rb:10:in `render'
# ------------------
# --- Caused by: ---
# PG::InFailedSqlTransaction:
# ERROR: current transaction is aborted, commands ignored until end of transaction block
# ./app/models/setting.rb:34:in `[]'
And here's another one:
1) Commenting legislation questions Merged comment threads View comments of annotations in an included range
1.1) Failure/Error: limit(Legislation::Annotation::COMMENTS_PAGE_SIZE).each do |comment| %>
ActionView::Template::Error:
PG::ProtocolViolation: ERROR: bind message supplies 0 parameters, but prepared statement "" requires 3
: SELECT "comments"."id", "comments"."commentable_id", "comments"."commentable_type", "comments"."subject", "comments"."user_id", "comments"."created_at", "comments"."updated_at", "comments"."hidden_at", "comments"."flags_count", "comments"."ignored_flag_at", "comments"."moderator_id", "comments"."administrator_id", "comments"."cached_votes_total", "comments"."cached_votes_up", "comments"."cached_votes_down", "comments"."confirmed_hide_at", "comments"."ancestry", "comments"."confidence_score", "comments"."valuation" FROM "comments" WHERE "comments"."hidden_at" IS NULL AND "comments"."commentable_id" = $1 AND "comments"."commentable_type" = $2 AND "comments"."ancestry" IS NULL ORDER BY "comments"."confidence_score" DESC, "comments"."created_at" DESC LIMIT $3
# ./app/views/legislation/annotations/_comments.html.erb:2:in `_app_views_legislation_annotations__comments_html_erb___455789374785188299_70050824054460'
# ./app/views/legislation/annotations/_comments_box.html.erb:7:in `_app_views_legislation_annotations__comments_box_html_erb__4106574774645463996_70050823892220'
# ./app/views/legislation/annotations/comments.js.erb:2:in `_app_views_legislation_annotations_comments_js_erb___3643519099197545612_70050823296160'
# ./config/initializers/wicked_pdf.rb:10:in `render'
# ------------------
# --- Caused by: ---
# PG::ProtocolViolation:
# ERROR: bind message supplies 0 parameters, but prepared statement "" requires 3
# ./app/views/legislation/annotations/_comments.html.erb:2:in `_app_views_legislation_annotations__comments_html_erb___455789374785188299_70050824054460'
1.2) Failure/Error: limit(Legislation::Annotation::COMMENTS_PAGE_SIZE).each do |comment| %>
ActionView::Template::Error:
PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block
: SELECT "comments"."id", "comments"."commentable_id", "comments"."commentable_type", "comments"."subject", "comments"."user_id", "comments"."created_at", "comments"."updated_at", "comments"."hidden_at", "comments"."flags_count", "comments"."ignored_flag_at", "comments"."moderator_id", "comments"."administrator_id", "comments"."cached_votes_total", "comments"."cached_votes_up", "comments"."cached_votes_down", "comments"."confirmed_hide_at", "comments"."ancestry", "comments"."confidence_score", "comments"."valuation" FROM "comments" WHERE "comments"."hidden_at" IS NULL AND "comments"."commentable_id" = $1 AND "comments"."commentable_type" = $2 AND "comments"."ancestry" IS NULL ORDER BY "comments"."confidence_score" DESC, "comments"."created_at" DESC LIMIT $3
There's another similar tests which has failed in a similar way:
1) Legislation Draft Versions Merged annotations View annotations and comments in an included range
Got 0 failures and 2 other errors:
1.1) Failure/Error: limit(Legislation::Annotation::COMMENTS_PAGE_SIZE).each do |comment| %>
ActionView::Template::Error:
PG::ProtocolViolation: ERROR: bind message supplies 0 parameters, but prepared statement "" requires 3
: SELECT "comments"."id", "comments"."commentable_id", "comments"."commentable_type", "comments"."subject", "comments"."user_id", "comments"."created_at", "comments"."updated_at", "comments"."hidden_at", "comments"."flags_count", "comments"."ignored_flag_at", "comments"."moderator_id", "comments"."administrator_id", "comments"."cached_votes_total", "comments"."cached_votes_up", "comments"."cached_votes_down", "comments"."confirmed_hide_at", "comments"."ancestry", "comments"."confidence_score", "comments"."valuation" FROM "comments" WHERE "comments"."hidden_at" IS NULL AND "comments"."commentable_id" = $1 AND "comments"."commentable_type" = $2 AND "comments"."ancestry" IS NULL ORDER BY "comments"."confidence_score" DESC, "comments"."created_at" DESC LIMIT $3
# ./app/views/legislation/annotations/_comments.html.erb:2:in `_app_views_legislation_annotations__comments_html_erb__676804302347985610_578380'
# ./app/views/legislation/annotations/_comments_box.html.erb:7:in `_app_views_legislation_annotations__comments_box_html_erb___72344952125184238_578320'
# ./app/views/legislation/annotations/comments.js.erb:2:in `_app_views_legislation_annotations_comments_js_erb__2255152332681239749_578300'
# ./config/initializers/wicked_pdf.rb:10:in `render'
# ./app/controllers/application_controller.rb:51:in `switch_locale'
# ------------------
# --- Caused by: ---
# PG::ProtocolViolation:
# ERROR: bind message supplies 0 parameters, but prepared statement "" requires 3
# ./app/views/legislation/annotations/_comments.html.erb:2:in `_app_views_legislation_annotations__comments_html_erb__676804302347985610_578380'
1.2) Failure/Error: where(key: key).pluck(:value).first.presence
ActionView::Template::Error:
PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block
: SELECT "settings"."value" FROM "settings" WHERE "settings"."key" = $1 ORDER BY "settings"."id" ASC
# ./app/models/setting.rb:34:in `[]'
# ./app/models/comment.rb:122:in `body_max_length'
# ./app/views/legislation/annotations/_comments_box.html.erb:27:in `block in _app_views_legislation_annotations__comments_box_html_erb___72344952125184238_578320'
# ./app/views/legislation/annotations/_comments_box.html.erb:24:in `_app_views_legislation_annotations__comments_box_html_erb___72344952125184238_578320'
# ./app/views/legislation/annotations/comments.js.erb:2:in `_app_views_legislation_annotations_comments_js_erb__2255152332681239749_578300'
# ./config/initializers/wicked_pdf.rb:10:in `render'
# ./app/controllers/application_controller.rb:51:in `switch_locale'
# ------------------
# --- Caused by: ---
# PG::InFailedSqlTransaction:
# ERROR: current transaction is aborted, commands ignored until end of transaction block
# ./app/models/setting.rb:34:in `[]'
Failure screenshots
This screenshot was automatically taken at the moment the test failed when running it in our CI. It might or might not be useful.

Notes
- Usually we get these
PG::ProtocolViolationerrors when we access the database from the test after we've fired the browser with avisitor we make a request before previous ones have finished; I haven't found where we might be doing so in this case - There's a chance the failure is not related to this test but to other tests that are executed before this one; according to the logs, one time these are the files whose tests were executed when this test failed:
"spec/system/advanced_search_spec.rb" "spec/system/users_auth_spec.rb" "spec/system/tags/budget_investments_spec.rb" "spec/system/comments/legislation_annotations_spec.rb" "spec/system/comments/legislation_questions_spec.rb" "spec/system/polls/polls_spec.rb".