apache / eventmesh

EventMesh is a new generation serverless event middleware for building distributed event-driven applications.
https://eventmesh.apache.org/
Apache License 2.0
1.6k stars 637 forks source link

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

Open Alonexc opened 2 years ago

Alonexc commented 2 years ago

Search before asking

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?

walterlife commented 2 years ago

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

qqeasonchen commented 2 years ago

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

dunchin7 commented 1 year ago

Can i work on this?

hanshal101 commented 1 year ago

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

arsenalzp commented 8 months ago

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

Pil0tXia commented 8 months ago

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

arsenalzp commented 8 months ago

@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
Pil0tXia commented 8 months ago

@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.

arsenalzp commented 8 months ago

@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

melisolmez commented 2 weeks ago

Hello, Can I work on this issue ?