You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/10/28 16:23:00 UTC

[jira] [Work logged] (MATH-1560) testGetAvailableLocales can fail

     [ https://issues.apache.org/jira/browse/MATH-1560?focusedWorklogId=505792&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-505792 ]

ASF GitHub Bot logged work on MATH-1560:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Oct/20 16:22
            Start Date: 28/Oct/20 16:22
    Worklog Time Spent: 10m 
      Work Description: tongxin97 opened a new pull request #163:
URL: https://github.com/apache/commons-math/pull/163


   Detailed description of the issue: https://issues.apache.org/jira/browse/MATH-1560
   
   This patch converts the return arrays of `NumberFormat.getAvailableLocales()` and `ComplexFormat.getAvailableLocales()` to HashSets, before doing an `assertEqual` on the content of the sets.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 505792)
    Remaining Estimate: 0h
            Time Spent: 10m

> testGetAvailableLocales can fail
> --------------------------------
>
>                 Key: MATH-1560
>                 URL: https://issues.apache.org/jira/browse/MATH-1560
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: XinT
>            Priority: Minor
>              Labels: pull-request-available, test
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> ComplexFormatAbstractTest.testGetAvailableLocales() is flaky because the return array of the call to NumberFormat.getAvailableLocales() is not always ordered in the same way (eg. alphabetically). In fact, the javadoc of getAvailableLocales() in the ComplexFormat class says the function "get the *set* of locales for which complex formats are available". So the return array should logically be treated as a set. 
> I detected this flaky test using a tool called NonDex, which detects flakiness due to wrong assumptions about Java APIs. You can find its [implementation here|https://github.com/TestingResearchIllinois/NonDex] and the [paper here|http://mir.cs.illinois.edu/awshi2/publications/FSEDEMO2016.pdf]. 
> My understanding of why this particular test is caught to be flaky is: the spec of NumberFormat.getAvailableLocales() doesn't say the return array is ordered in any way. So the NonDex tool I mentioned shuffles this array, causing the test to fail sometimes, and it decides the test is flaky. 
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)