You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Kengo Seki (Jira)" <ji...@apache.org> on 2023/02/27 15:46:00 UTC

[jira] [Updated] (AMBARI-25874) Fix AlertTargetResourceProviderTest to work after merging AMBARI-25300

     [ https://issues.apache.org/jira/browse/AMBARI-25874?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kengo Seki updated AMBARI-25874:
--------------------------------
    Status: Patch Available  (was: Open)

> Fix AlertTargetResourceProviderTest to work after merging AMBARI-25300
> ----------------------------------------------------------------------
>
>                 Key: AMBARI-25874
>                 URL: https://issues.apache.org/jira/browse/AMBARI-25874
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>            Reporter: Kengo Seki
>            Assignee: Kengo Seki
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, running the following test fails: 
> {code}
> $ mvn clean test -Dtest="AlertTargetResourceProviderTest#testEnable" -f ambari-server/pom.xml
> ...
> [INFO] -------------------------------------------------------
> [INFO]  T E S T S
> [INFO] -------------------------------------------------------
> [INFO] Running org.apache.ambari.server.controller.internal.AlertTargetResourceProviderTest
> [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.173 s <<< FAILURE! - in org.apache.ambari.server.controller.internal.AlertTargetResourceProviderTest
> [ERROR] testEnable(org.apache.ambari.server.controller.internal.AlertTargetResourceProviderTest)  Time elapsed: 3.112 s  <<< FAILURE!
> java.lang.AssertionError: 
>   Unexpected method call AlertDispatchDAO.findTargetByName("The Administrators"):
>     AlertDispatchDAO.create(capture(Nothing captured yet)): expected: 1, actual: 0
> 	at org.apache.ambari.server.controller.internal.AlertTargetResourceProviderTest.testEnable(AlertTargetResourceProviderTest.java:1095)
> [INFO] 
> [INFO] Results:
> [INFO] 
> [ERROR] Failures: 
> [ERROR]   AlertTargetResourceProviderTest.testEnable:1095 
>   Unexpected method call AlertDispatchDAO.findTargetByName("The Administrators"):
>     AlertDispatchDAO.create(capture(Nothing captured yet)): expected: 1, actual: 0
> [INFO] 
> [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
> [INFO] 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time:  03:04 min
> [INFO] Finished at: 2023-02-28T00:18:38+09:00
> [INFO] ------------------------------------------------------------------------
> {code}
> This is because AMBARI-25300 changed {{AlertTargetResourceProvider#createAlertTargets}} to always (except for the cases of exception) call {{AlertDispatchDAO#findTargetByName}}
>  (https://github.com/apache/ambari/commit/05c826ec1a0eb2d672ad84505d9bde95a578fa09#diff-fff060a3bbe1aa6b1fd811d058ba8005333f8422dc6b4de92e133c4e2988f000), but the corresponding mock in {{AlertTargetResourceProviderTest#testEnable}} doesn't have a defined behavior for that method.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ambari.apache.org
For additional commands, e-mail: issues-help@ambari.apache.org