Plots2: Intermittent failure on git actions

Created on 24 May 2021  路  4Comments  路  Source: publiclab/plots2

```

Progress: |================================================================ FAIL NodeTest#test_should_find_all_questions (20.16s)
--- expected
+++ actual
@@ -1 +1 @@
-[#, #, #, #, #, #, #]
+#, #, #, #, #, #, #]>
test/unit/node_test.rb:395:in `block in '

====|

Finished in 20.32495s
321 tests, 910 assertions, 1 failures, 0 errors, 0 skips
Writing XML reports to /home/runner/work/plots2/plots2/test/reports
Coverage report generated to /home/runner/work/plots2/plots2/coverage/codecov-result.json.
{"app/api/srch/api.rb"=>[nil, 1, 1, 1, nil, 1, 1, 1, 1, nil, nil, 1, nil, nil, 1, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], "app/api/srch/search.rb"=>[nil, 1, 1, nil, 1, 1, 1, nil, nil, nil, 1, nil, 1, nil, nil,...

bug systems testing

Most helpful comment

I think this error has to do with array sorting.

I formatted the output for readability.

Here are the expected results:

[
  #<Node nid: 8, vid: 0, type: "note", language: "", title: "How to use a Spectrometer", uid: 2, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/05-24-2021/how-to-use-a-spectrometer", main_image_id: nil, slug: "jeff-05-24-2021-how-to-use-a-spectrometer", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 9, vid: 0, type: "note", language: "", title: "How to ask a question", uid: 2, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/05-24-2021/how-to-ask-a-question", main_image_id: nil, slug: "jeff-05-24-2021-how-to-ask-a-question", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 10, vid: 0, type: "note", language: "", title: "A first timer question", uid: 7, status: 4, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/newcomer/05-24-2021/a-first-timer-question", main_image_id: nil, slug: "newcomer-05-24-2021-a-first-timer-question", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 15, vid: 0, type: "note", language: "", title: "Question by a moderated user", uid: 9, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/rob/05-24-2021/question-by-a-moderated-user", main_image_id: nil, slug: "rob-05-24-2021-question-by-a-moderated-user", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 36, vid: 0, type: "note", language: "", title: "Note tagged with question:sun", uid: 2, status: 1, created: 1581465600, changed: 1581465600, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/admin/02-12-2020/note-tagged-with-question-...", main_image_id: nil, slug: "note-tagged-with-question-sun", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 37, vid: 0, type: "note", language: "", title: "Can I post comments here", uid: 2, status: 1, created: 1607299200, changed: 1607299200, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/12-07-2020/can-i-post-comments-here", main_image_id: nil, slug: "jeff-12-07-2020-can-i-post-comments-here", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 40, vid: 0, type: "note", language: "", title: "Which condiments do you like", uid: 2, status: 1, created: 1608422400, changed: 1608422400, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/12-20-2020/which-condiments-do-you-lik...", main_image_id: nil, slug: "jeff-12-20-2020-which-condiments-do-you-like", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>
]

Here are the actual results:

[
  #<Node nid: 37, vid: 0, type: "note", language: "", title: "Can I post comments here", uid: 2, status: 1, created: 1607299200, changed: 1607299200, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/12-07-2020/can-i-post-comments-here", main_image_id: nil, slug: "jeff-12-07-2020-can-i-post-comments-here", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 40, vid: 0, type: "note", language: "", title: "Which condiments do you like", uid: 2, status: 1, created: 1608422400, changed: 1608422400, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/12-20-2020/which-condiments-do-you-lik...", main_image_id: nil, slug: "jeff-12-20-2020-which-condiments-do-you-like", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 8, vid: 0, type: "note", language: "", title: "How to use a Spectrometer", uid: 2, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/05-24-2021/how-to-use-a-spectrometer", main_image_id: nil, slug: "jeff-05-24-2021-how-to-use-a-spectrometer", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 9, vid: 0, type: "note", language: "", title: "How to ask a question", uid: 2, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/05-24-2021/how-to-ask-a-question", main_image_id: nil, slug: "jeff-05-24-2021-how-to-ask-a-question", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 10, vid: 0, type: "note", language: "", title: "A first timer question", uid: 7, status: 4, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/newcomer/05-24-2021/a-first-timer-question", main_image_id: nil, slug: "newcomer-05-24-2021-a-first-timer-question", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 15, vid: 0, type: "note", language: "", title: "Question by a moderated user", uid: 9, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/rob/05-24-2021/question-by-a-moderated-user", main_image_id: nil, slug: "rob-05-24-2021-question-by-a-moderated-user", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 36, vid: 0, type: "note", language: "", title: "Note tagged with question:sun", uid: 2, status: 1, created: 1581465600, changed: 1581465600, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/admin/02-12-2020/note-tagged-with-question-...", main_image_id: nil, slug: "note-tagged-with-question-sun", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>
]

This looks like the same set of results, just in a different order.

Here's the test that fails:

test 'should find all questions' do
    questions = Node.questions
    expected = [nodes(:question), nodes(:question2), nodes(:first_timer_question), nodes(:question3), nodes(:sun_question), nodes(:comment_question), nodes(:question_with_multiple_comments)]
    assert_equal expected, questions
end

Maybe expected needs to be reordered in the same order as questions?

All 4 comments

I think this error has to do with array sorting.

I formatted the output for readability.

Here are the expected results:

[
  #<Node nid: 8, vid: 0, type: "note", language: "", title: "How to use a Spectrometer", uid: 2, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/05-24-2021/how-to-use-a-spectrometer", main_image_id: nil, slug: "jeff-05-24-2021-how-to-use-a-spectrometer", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 9, vid: 0, type: "note", language: "", title: "How to ask a question", uid: 2, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/05-24-2021/how-to-ask-a-question", main_image_id: nil, slug: "jeff-05-24-2021-how-to-ask-a-question", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 10, vid: 0, type: "note", language: "", title: "A first timer question", uid: 7, status: 4, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/newcomer/05-24-2021/a-first-timer-question", main_image_id: nil, slug: "newcomer-05-24-2021-a-first-timer-question", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 15, vid: 0, type: "note", language: "", title: "Question by a moderated user", uid: 9, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/rob/05-24-2021/question-by-a-moderated-user", main_image_id: nil, slug: "rob-05-24-2021-question-by-a-moderated-user", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 36, vid: 0, type: "note", language: "", title: "Note tagged with question:sun", uid: 2, status: 1, created: 1581465600, changed: 1581465600, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/admin/02-12-2020/note-tagged-with-question-...", main_image_id: nil, slug: "note-tagged-with-question-sun", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 37, vid: 0, type: "note", language: "", title: "Can I post comments here", uid: 2, status: 1, created: 1607299200, changed: 1607299200, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/12-07-2020/can-i-post-comments-here", main_image_id: nil, slug: "jeff-12-07-2020-can-i-post-comments-here", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 40, vid: 0, type: "note", language: "", title: "Which condiments do you like", uid: 2, status: 1, created: 1608422400, changed: 1608422400, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/12-20-2020/which-condiments-do-you-lik...", main_image_id: nil, slug: "jeff-12-20-2020-which-condiments-do-you-like", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>
]

Here are the actual results:

[
  #<Node nid: 37, vid: 0, type: "note", language: "", title: "Can I post comments here", uid: 2, status: 1, created: 1607299200, changed: 1607299200, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/12-07-2020/can-i-post-comments-here", main_image_id: nil, slug: "jeff-12-07-2020-can-i-post-comments-here", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 40, vid: 0, type: "note", language: "", title: "Which condiments do you like", uid: 2, status: 1, created: 1608422400, changed: 1608422400, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/12-20-2020/which-condiments-do-you-lik...", main_image_id: nil, slug: "jeff-12-20-2020-which-condiments-do-you-like", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 8, vid: 0, type: "note", language: "", title: "How to use a Spectrometer", uid: 2, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/05-24-2021/how-to-use-a-spectrometer", main_image_id: nil, slug: "jeff-05-24-2021-how-to-use-a-spectrometer", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 9, vid: 0, type: "note", language: "", title: "How to ask a question", uid: 2, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/jeff/05-24-2021/how-to-ask-a-question", main_image_id: nil, slug: "jeff-05-24-2021-how-to-ask-a-question", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 10, vid: 0, type: "note", language: "", title: "A first timer question", uid: 7, status: 4, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/newcomer/05-24-2021/a-first-timer-question", main_image_id: nil, slug: "newcomer-05-24-2021-a-first-timer-question", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 15, vid: 0, type: "note", language: "", title: "Question by a moderated user", uid: 9, status: 1, created: 1621893293, changed: 1621893293, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/rob/05-24-2021/question-by-a-moderated-user", main_image_id: nil, slug: "rob-05-24-2021-question-by-a-moderated-user", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>, 
  #<Node nid: 36, vid: 0, type: "note", language: "", title: "Note tagged with question:sun", uid: 2, status: 1, created: 1581465600, changed: 1581465600, comment: 0, promote: 0, moderate: 0, sticky: 0, tnid: 0, translate: 0, cached_likes: 0, comments_count: 0, drupal_node_revisions_count: 0, path: "/notes/admin/02-12-2020/note-tagged-with-question-...", main_image_id: nil, slug: "note-tagged-with-question-sun", views: 0, latitude: nil, longitude: nil, precision: nil, flag: 0>
]

This looks like the same set of results, just in a different order.

Here's the test that fails:

test 'should find all questions' do
    questions = Node.questions
    expected = [nodes(:question), nodes(:question2), nodes(:first_timer_question), nodes(:question3), nodes(:sun_question), nodes(:comment_question), nodes(:question_with_multiple_comments)]
    assert_equal expected, questions
end

Maybe expected needs to be reordered in the same order as questions?

Shall we add a .sort in the test or the original code? Either should work!

Maybe sort by... what's the syntax, .sort_by(:created_at) or something?

Thanks a lot you both :tada: , I will try doing a sort within the test see if it helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

divyabaid16 picture divyabaid16  路  3Comments

keshavsethi picture keshavsethi  路  3Comments

milaaraujo picture milaaraujo  路  3Comments

grvsachdeva picture grvsachdeva  路  3Comments

first-timers[bot] picture first-timers[bot]  路  3Comments