ambari-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Miklos Gergely (JIRA)" <>
Subject [jira] [Commented] (AMBARI-17004) Unit tests failing because of the order of hash sets/maps
Date Thu, 02 Jun 2016 11:41:59 GMT


Miklos Gergely commented on AMBARI-17004:

ComponentResourceProviderTest.testGetResourcesAs* (3 tests)

ComponentResourceProviderTest:244 specifies that the first two ambariMetaInfo.getComponent(...)
will return the "MASTER componentInfo", the 3rd call returns the "SLAVE componentInfo". The
results will be fine only if ComponentResourceProvider:442 iterates over serviceComponentMap
created at ComponentResourceProviderTest:219 in the order 1,3,2 or 3,1,2, so 1 and 3 will
be categorized as MASTER, and 2 as SLAVE.

Suggested solution: ComponentInfo returned at ComponentResourceProviderTest:244 should be
broken up to 3 expect calls, instead of using anyString() it should return componentInfos
based on the parameters.

> Unit tests failing because of the order of hash sets/maps
> ---------------------------------------------------------
>                 Key: AMBARI-17004
>                 URL:
>             Project: Ambari
>          Issue Type: Bug
>            Reporter: Miklos Gergely
> Some unit tests are failing because they depend on the order elements are returned by
the iterator of a HashSet/HashMap. Usually they are small (2-3 entries), so they may easily
produce good results. Still in other environments they fail as the order the elements are
returned from a HashSet/HashMap may depend on the JVM used.
> The tests will be described in the comments.

This message was sent by Atlassian JIRA

View raw message