Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky investments order spec #4669

Merged
merged 1 commit into from
Sep 3, 2021
Merged

Fix flaky investments order spec #4669

merged 1 commit into from
Sep 3, 2021

Conversation

javierm
Copy link
Member

@javierm javierm commented Aug 25, 2021

References

Failure message

1) Budget Investments Orders Random order after another order
     Failure/Error: tags.sort { |a, b| b.taggings_count <=> a.taggings_count }[0, limit]

     ActionView::Template::Error:
       PG::ProtocolViolation: ERROR:  bind message supplies 0 parameters, but prepared statement "" requires 3
       : SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = $1 AND "taggings"."taggable_type" = $2 AND "taggings"."context" = $3

     # ./app/models/concerns/taggable.rb:12:in `sort'
     # ./app/models/concerns/taggable.rb:12:in `tag_list_with_limit'
     # ./app/components/shared/tag_list_component.rb:17:in `tag_links'
     # ./app/components/shared/tag_list_component.rb:13:in `links'
     # ./app/components/shared/tag_list_component.html.erb:1:in `call'
     # ./app/views/shared/_tags.html.erb:4:in `_app_views_shared__tags_html_erb__1786540979487546022_69985865643240'
     # ./app/views/budgets/investments/_investment.html.erb:30:in `block in _app_views_budgets_investments__investment_html_erb___3127551676118346414_46974811334080'
     # ./app/views/budgets/investments/_investment.html.erb:21:in `_app_views_budgets_investments__investment_html_erb___3127551676118346414_46974811334080'
     # ./app/views/budgets/investments/index.html.erb:78:in `block in _app_views_budgets_investments_index_html_erb__4007896506534525799_46974861443540'
     # ./app/views/budgets/investments/index.html.erb:77:in `_app_views_budgets_investments_index_html_erb__4007896506534525799_46974861443540'
     # ./config/initializers/wicked_pdf.rb:10:in `render'
     # ------------------
     # --- Caused by: ---
     # PG::ProtocolViolation:
     #   ERROR:  bind message supplies 0 parameters, but prepared statement "" requires 3
     #   ./app/models/concerns/taggable.rb:12:in `sort'

Notes

The test probably failed due to simultaneous requests:

  • We were clicking on a link and then clicking on another link (which was already on the page) before checking the first request had finished
  • We were then visiting a page after clicking the second link, without checking the second request had finished

@javierm javierm self-assigned this Aug 25, 2021
@javierm javierm added this to Reviewing in Consul Democracy via automation Aug 25, 2021
We were clicking links and visiting pages without checking the previous
request had already finished. This might cause concurrent requests,
leading to unpredictable results.

It might be the reason why this test failed once when running our
continuous integration [1].

[1] https://github.com/consul/consul/runs/3295502777
@Senen Senen self-assigned this Sep 3, 2021
Consul Democracy automation moved this from Reviewing to Testing Sep 3, 2021
@javierm javierm merged commit 39a0679 into master Sep 3, 2021
Consul Democracy automation moved this from Testing to Release 1.4.0 Sep 3, 2021
@javierm javierm deleted the fix_investment_spec branch September 3, 2021 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants