•  
      request #26393 Tracker DB test assertions should not care about order
    Infos
    #26393
    Joris MASSON (jmasson)
    2022-04-15 12:41
    2022-04-15 10:03
    27917
    Details
    Tracker DB test assertions should not care about order

    Tracker v3 to v5 DB integration tests use assertEquals() to compare arrays. AssertEquals requires array elements to be in the same order as the expected array. Here, it is used to compare user group permissions on fields, but there is no inherent order to those permissions. The order of those permissions has no business meaning.

    AssertEquals makes the test flaky because the order of array elements can change (since it depends on the DB). We should use other assertions such as assertEqualsCanonicalizing() that are not affected by the order of elements.

     --- Expected
    tests_1         | +++ Actual
    tests_1         | @@ @@
    tests_1         |  Array (
    tests_1         |      1 => Array (...)
    tests_1         |      3 => Array (
    tests_1         | -        0 => 'PLUGIN_TRACKER_FIELD_UPDATE'
    tests_1         | -        1 => 'PLUGIN_TRACKER_FIELD_SUBMIT'
    tests_1         | +        0 => 'PLUGIN_TRACKER_FIELD_SUBMIT'
    tests_1         | +        1 => 'PLUGIN_TRACKER_FIELD_UPDATE'
    tests_1         |      )
    tests_1         |  )
    

    This was found by the Nightly run of tests.

    Dev tools
    Empty
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Joris MASSON (jmasson)
    Closed
    2022-04-15
    Attachments
    Empty
    References
    Referencing request #26393
    Referenced by request #26393

    Artifact Tracker v5

    rel #25363 13.8

    Follow-ups

    User avatar
    Thomas Gerbet (tgerbet)2022-04-15 12:41

    Integrated into Tuleap 13.7.99.165.


    • Status changed from Under review to Closed
    • Connected artifacts
    • Close date set to 2022-04-15
    User avatar
    Joris MASSON (jmasson)2022-04-15 10:33
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes