You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by GitBox <gi...@apache.org> on 2022/11/13 05:19:29 UTC

[GitHub] [incubator-streampark] RocMarshal opened a new issue, #2014: [Improve] Enhance the tests of 'streampark-console' module.

RocMarshal opened a new issue, #2014:
URL: https://github.com/apache/incubator-streampark/issues/2014

   ### Search before asking
   
   - [X] I had searched in the [feature](https://github.com/apache/streampark/issues?q=is%3Aissue+label%3A%22Feature%22) and found no similar feature requirement.
   
   
   ### Description
   
   ### Main Objective in the Improvement:
   - Supplement unit test cases of streampark console.
   
   ### Why do this ?
   #### Present situation: 
   At present, there are few test cases for streampark console based on JUnit5(Jupiter).
   To make a long story short for no test cases:
     - As a part of the development specification, test cases are indispensable. 
     - It is not conducive to the long-term evolution of the project. 
     - When changing the current module, it is difficult to find potential problems.
   
   
   ### Choose Test Suites(If the improvement was accepted)
   
   JUnit5 & Mockito [& AssertJ]
   
   #### Why JUNIT5?
   
   1. Released in 2017, JUnit 5 has become more and more popular among Java projects. With quite a lot of new features such as extension model, advanced parameterized test, and better support of lambda functions, JUnit 5 presents more convenience and flexibility to developers.
   2. Support integration with many frameworks, such as Spring, Testcontainers, etc
   [JUnit5 Official website](https://junit.org/junit5/)
   
   #### About Mock
   
   Why Mockito instead of Powermock?
   
   - Mockito supports Junit5
   - Powermock works based on Junit4, https://github.com/powermock/powermock
   - Mockito's community is more active than Powermock. https://github.com/mockito/mockito
   
   #### Assertion API
   - JUnit5 Assertion API: is the built-in API of JUnit5. If We use 'JUnit5 Assertions' to work, we can reduce some learning costs.
   - [AssertJ](https://joel-costigliola.github.io/assertj/index.html): AssertJ can perform the same functions as JUnit5 Assertion, and has many APIs based on stream coding, which makes it more elegant.
   
   
   ### Integration test problems and other module test problems.
   Maybe we also need to consider the test suites selection based on the sections.
   
   
   ### E2E test 
   There is an issue describe the E2E test plan in https://github.com/apache/incubator-streampark/issues/1381
   
   ### Any suggestion and idea is appreciated!
   - About other test suites, TestNG...
   - Or anything important for the improvment.
   
   ### Usage Scenario
   
   N.A
   
   ### Related issues
   
   ### E2E test 
   There is an issue describe the E2E test plan in https://github.com/apache/incubator-streampark/issues/1381
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] RocMarshal commented on issue #2014: [Improve] Enhance the tests of 'streampark-console' module.

Posted by GitBox <gi...@apache.org>.
RocMarshal commented on issue #2014:
URL: https://github.com/apache/incubator-streampark/issues/2014#issuecomment-1312642231

   CC @wolfboys @1996fanrui @MonsterChenzhuo 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on issue #2014: [Improve] Enhance the tests of 'streampark-console' module.

Posted by GitBox <gi...@apache.org>.
wolfboys commented on issue #2014:
URL: https://github.com/apache/incubator-streampark/issues/2014#issuecomment-1312655715

   Very good proposal 👍👍,  welcome to contributions


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] MonsterChenzhuo commented on issue #2014: [Improve] Enhance the tests of 'streampark-console' module.

Posted by GitBox <gi...@apache.org>.
MonsterChenzhuo commented on issue #2014:
URL: https://github.com/apache/incubator-streampark/issues/2014#issuecomment-1340957761

   +1 Very good proposal


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on issue #2014: [Improve] Enhance the tests of 'streampark-console' module.

Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys commented on issue #2014:
URL: https://github.com/apache/incubator-streampark/issues/2014#issuecomment-1454735570

   > > 2. When integrating `test-containers`, it is intended to reuse the mysql sql file (but the current mysql sql file is not under `resources`, so it cannot be reused).
   > 
   > We'd prefer use embed h2 as the DB level in test. so the problem was dicarded.
   
   yes, h2 DB is better for testing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys closed issue #2014: [Improve] Enhance the tests of 'streampark-console' module.

Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys closed issue #2014: [Improve] Enhance the tests of 'streampark-console' module.
URL: https://github.com/apache/incubator-streampark/issues/2014


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] RocMarshal commented on issue #2014: [Improve] Enhance the tests of 'streampark-console' module.

Posted by "RocMarshal (via GitHub)" <gi...@apache.org>.
RocMarshal commented on issue #2014:
URL: https://github.com/apache/incubator-streampark/issues/2014#issuecomment-1454677765

   > 2\. When integrating `test-containers`, it is intended to reuse the mysql sql file (but the current mysql sql file is not under `resources`, so it cannot be reused).
   
   We'd prefer use embed h2 as the DB level in test. so the problem was dicarded.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] RocMarshal commented on issue #2014: [Improve] Enhance the tests of 'streampark-console' module.

Posted by "RocMarshal (via GitHub)" <gi...@apache.org>.
RocMarshal commented on issue #2014:
URL: https://github.com/apache/incubator-streampark/issues/2014#issuecomment-1416662513

   I encountered two case have to solve to support the integration test enhancement.
   
   1. Error is reported when initializing app.home resources in the run `EnvInitializer#storageInitialize`.
   The main error is that the file does not exist and the target directory is empty when initializing the copy of `lib, plugins, client and other directories`.
   
   There are two solutions from me:
   
   1). copy the mock manually folders and files in the `resources` directory to the path set by `app.home` before the EnvInitializer class executes the` run` method
   
   2).  set a `System properties` to mark whether `EnvInitializer#run`  really need to  execute the logic of the method body
   
   Other try:  to use `mockito` to spy the `EnvInitializer#run`, but the idea  is not feasible due to the feature of ApplicationRunner.
   
   In the long item, if automated testing is carried out in as wide a range as possible, the files in `app.home` must not be implemented with mocks, but need a real `app.home` and its' resource, which is same as the production Env.
   
   In the short term, I prefer to mock, and support the rapid improvement of the test part.
   
   2. When integrating `test-containers`, it is intended to reuse the mysql sql file (but the current mysql sql file is not under `resources`, so it cannot be reused).
   
   Can the `sql scripts file` of `mysql&postgresql` be placed in the `resources folder`,  then we could change the  descriptions content of  `assembly` to reach the same packaging-effect with original implementation ?
   
   Looking forward to your suggestions. 
   CC @wolfboys @MonsterChenzhuo @1996fanrui 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] RocMarshal commented on issue #2014: [Improve] Enhance the tests of 'streampark-console' module.

Posted by "RocMarshal (via GitHub)" <gi...@apache.org>.
RocMarshal commented on issue #2014:
URL: https://github.com/apache/incubator-streampark/issues/2014#issuecomment-1454677356

   > 1. Error is reported when initializing app.home resources in the run `EnvInitializer#storageInitialize`.
   >    The main error is that the file does not exist and the target directory is empty when initializing the copy of `lib, plugins, client and other directories`.
   
   We will use preview policy 2 , do some public init logic in `SpringTestBase` , and make some test class to inherit SpringTestBase.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org