Kengo Seki created AMBARI-25874:
-----------------------------------
Summary: 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
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: [email protected]
For additional commands, e-mail: [email protected]