GithubHelp home page GithubHelp logo

Catch2 test results in SIGABRT about oatpp HOT 9 CLOSED

oatpp avatar oatpp commented on May 20, 2024
Catch2 test results in SIGABRT

from oatpp.

Comments (9)

vinkaga avatar vinkaga commented on May 20, 2024 1

Ignore my silly concern about 2 runs - 2 tests, 2 runs! :-)

from oatpp.

vinkaga avatar vinkaga commented on May 20, 2024 1

Leonid,

Thanks again for the feedback.

  • I have updated to 0.19.6 and started using oatpp::base::Environment for logging.
  • I think using std::shared_ptr should prevent any memory leaks.
  • Will definitely consider caching it the load requires it.

Thanks a lot.

from oatpp.

lganzzzo avatar lganzzzo commented on May 20, 2024

Hello @vinkaga ,

Please find the PR vinkaga/oatpp-test#1

I added some comments to the steps of the test and its structure in the code.

The main problem was that config components were deleted before Runner object tried to inject them.


Apart from that you may find some additional "complicated" code for proper server stoppage and stoppage of async executor. Most of this complexity is because of the "real" port usage and difference in behavior of Linux/BSD api calls, read/write/close.

Which you may avoid by using oatpp virtual networking for test purposes.

You may also find some useful info here Testing oatpp applications


Note

You are using oatpp Async API for you controller. Developing using Async API may be pretty complicated when it comes to business logic / consuming other services / synchronization.

TIP: You may opt to use oatpp simple API (with multi threaded server) instead, which is much more "user friendly".

Async API - is needed for cases where you have to handle more than 1K simultaneous connections.
If you don't expect such load on you service - Simple API is the choice


Please let me know in case of any questions.

Best Regards,
Leonid

from oatpp.

lganzzzo avatar lganzzzo commented on May 20, 2024

Closing this.
@vinkaga please let me know if there are still questions left.

from oatpp.

vinkaga avatar vinkaga commented on May 20, 2024

I switched to using sync API. In order to remove boilerplate from the tests, I modified TestRunner and ControllerTest.

Is this a reasonable approach?

from oatpp.

lganzzzo avatar lganzzzo commented on May 20, 2024

Hello @vinkaga ,

I have reviewed the code. Looks good to me.

Comments:

Other from that looks great, even that you have defined your own TestRunner. But why not.

Regards,
Leonid

from oatpp.

vinkaga avatar vinkaga commented on May 20, 2024

Hello Leonid,

Would take a minute to look over the latest iteration of the my oatpp sample/test at https://github.com/vinkaga/oatpp-test? Here is the list of changes since the last version:

  1. Removed Environment usage and moved components into Server and TestClient objects. For me, it's easier for conceptual visualization and also reduces test boilerplate but does reduce dependency injectability.
  2. Added static content handler from your media example.

Additionally, not sure why, I get server running/stopped message twice when I run the test.

$ ./oatppex_test

 Server Running on port 8000

 Server Stopped

 Server Running on port 8000

 Server Stopped
===============================================================================
All tests passed (4 assertions in 2 test cases)

Thanks,
Vinay

from oatpp.

lganzzzo avatar lganzzzo commented on May 20, 2024

Hello @vinkaga ,

Would take a minute to look over the latest iteration of the my oatpp sample/test

Currently I am not able to review your code. But I will do it for sure.
Most probably I will be available tomorrow or the day after tomorrow.

Please feel free to put all the questions you have in the issues,- I will answer them all once I am available.

Regards,
Leonid

from oatpp.

lganzzzo avatar lganzzzo commented on May 20, 2024

Hello @vinkaga ,

I have reviewed the code. Everything looks good!

Some comments:

  • Please move to oatpp version 0.19.6. Project is in alpha so its important to be on a latest version.
  • It is recommended to use oatpp::base::Environment at least in order to make calls to OATPP_LOGD D/V/I/W/E to work and see oatpp system logs. You may also benefit from oatpp object counting in the tests to detect memory-leaks.
  • As you are building static server, you may want to think of a caching mechanism in order to reduce load on a hard-drive.

Regards,
Leonid

from oatpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.