eventmesh icon indicating copy to clipboard operation
eventmesh copied to clipboard

[Enhancement] Add test code for this module [eventmesh-runtime]

Open Alonexc opened this issue 2 years ago • 9 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Enhancement Request

Add test code for eventmesh-runtime module.

Describe the solution you'd like

Module name: eventmesh-runtime Located in: eventmesh-runtime Task status: ×(unfinished) / √(finished)

Notes: The following classes are only a part of this module. If you want to do some unit tests for this module, you can select some classes in this module for unit testing, but please submit a detailed issue separately and linked to the pr you submitted, because this issue will not be deleted.

Task Status Class Type
× org/apache/eventmesh/runtime/util/EventMeshThreadFactoryImpl.java utils
× org/apache/eventmesh/runtime/util/EventMeshUtil.java utils
× org/apache/eventmesh/runtime/util/HttpTinyClient.java utils
× org/apache/eventmesh/runtime/util/IOTinyUtils.java utils
× org/apache/eventmesh/runtime/util/NetUtils.java utils
× org/apache/eventmesh/runtime/util/RemotingHelper.java utils
× org/apache/eventmesh/runtime/util/WebhookUtil.java utils
× org/apache/eventmesh/runtime/admin/controller/ClientManageController.java controller
× org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandler.java handler
× org/apache/eventmesh/runtime/admin/handler/RedirectClientByPathHandler.java handler

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

Alonexc avatar May 17 '22 09:05 Alonexc

Please assign to me. I'll try to work on this.

walterlife avatar Jun 11 '22 08:06 walterlife

@walterlife you can reopen a new sub-issue and work on it, this issue will open until the code coverage up to 100%.

qqeasonchen avatar Jun 13 '22 03:06 qqeasonchen

Can i work on this?

dunchin7 avatar Oct 25 '22 12:10 dunchin7

Please assign me I would like to work on this issue.

hanshal101 avatar Jan 31 '23 03:01 hanshal101

Any progress with this issue? I would like to tackle.

arsenalzp avatar Jan 26 '24 10:01 arsenalzp

@arsenalzp You may add missing unit tests under the runtime module.

Pil0tXia avatar Jan 26 '24 10:01 Pil0tXia

@arsenalzp You may add missing unit tests under the runtime module.

Hello, I took some unit tests, however I guess my project was not configured properly because even already merged unit tests code failed with error:

Run the test:

gradle test --tests org.apache.eventmesh.runtime.admin.handler.QueryRecommendEventMeshHandlerTest

Output:

org.mockito.exceptions.base.MockitoException: 
Mockito cannot mock this class: class org.apache.eventmesh.runtime.boot.EventMeshTCPServer.

If you're not sure why you're getting this error, please report to the mailing list.


Java               : 17
JVM vendor name    : Red Hat, Inc.
JVM vendor version : 17.0.8+7
JVM name           : OpenJDK 64-Bit Server VM
JVM version        : 17.0.8+7
JVM info           : mixed mode, sharing
OS name            : Linux
OS version         : 6.2.15-200.fc37.x86_64


You are seeing this disclaimer because Mockito is configured to create inlined mocks.
You can learn about inline mocks and their limitations under item #39 of the Mockito class javadoc.

> Task :eventmesh-runtime:test

QueryRecommendEventMeshHandlerTest > testHandle() FAILED
    org.mockito.exceptions.base.MockitoException at QueryRecommendEventMeshHandlerTest.java:52
        Caused by: org.mockito.exceptions.base.MockitoException at QueryRecommendEventMeshHandlerTest.java:52
            Caused by: java.lang.IllegalStateException at QueryRecommendEventMeshHandlerTest.java:52
                Caused by: java.lang.IllegalArgumentException at QueryRecommendEventMeshHandlerTest.java:52

arsenalzp avatar Jan 27 '24 15:01 arsenalzp

@arsenalzp

JVM version : 17.0.8+7

Please retry using JDK8. If you're still encountering problems, it may be a potential bug and it's welcome to fix it.

Pil0tXia avatar Jan 28 '24 17:01 Pil0tXia

@arsenalzp

JVM version : 17.0.8+7

Please retry using JDK8. If you're still encountering problems, it may be a potential bug and it's welcome to fix it.

Hello, You were right, the issue fixed by using OpenJSK 8

arsenalzp avatar Feb 02 '24 15:02 arsenalzp