jgaa / restc-cpp

Modern C++ REST Client library
MIT License
605 stars 95 forks source link

running test cases on Linux - questions #157

Open greenozon opened 1 month ago

greenozon commented 1 month ago

I've got a question on the test cases pass rate is it expected to be 100%?

I've built fresh lib as per Linux wiki steps and wanted to see the TC run, but it has lots of fails OS: Ubuntu 22.04 LTS, x64 tc run log attached

there is even one core dump

./tests/run-tests.sh: line 25: 171885 Aborted                 (core dumped) $f > /dev/null

Ubuntu20.04.LTS_tests_run_results.log

jgaa commented 1 month ago

If the test-backend containers are running, the success rate should be 100%.

I have just upgraded my workstation to Ubuntu 24.04. There are a few problems I have to address (one test failing, one compilation error with g++-14, and docker-compose changing name to docker compose (breaking the automated tests).

I'll fix this and release a new version later this week. I'll check the documentation as well, I'll see if I can reproduce any problems with Ubuntu 22.04 LTS, x64 (that's what I used until now, and it used to work).

greenozon commented 1 month ago

oh, pardon me! I missed one step from the wiki page:

./create-and-run-containers.sh

after running again with it the pass rate is much, much better as well as no core dumps (btw, is it OK to have core dump even if the step was missed? IMHO it should gracefully report some sort of error ...

failed TC:

testing dbuild/tests/functional/crud_tests
Mon Aug 12 21:20:09 2024 INFO 139755927910208 Logging on level trace. Boost version is 1_74
Mon Aug 12 21:20:09 2024 DEBUG 139755927905856 Worker 0 is starting.
Mon Aug 12 21:20:09 2024 DEBUG 139755927905856 Connecting to 127.0.0.1:3000
Mon Aug 12 21:20:09 2024 DEBUG 139755927905856 Sent POST request to 'http://localhost:3000/posts' {Connection dc903220-29eb-4fb8-a792-ef29624b7bcf {Socket socket# 6 127.0.0.1:39412 <--> 127.0.0.1:3000}}
Mon Aug 12 21:20:09 2024 ERROR 139755927905856 ProcessInWorker: Caught exception: assign_value: Invalid data conversion from string to int*_t
Mon Aug 12 21:20:09 2024 DEBUG 139755927905856 Worker 0 is done.
Mon Aug 12 21:20:09 2024 DEBUG 139755919513152 Worker 0 is starting.
Mon Aug 12 21:20:09 2024 DEBUG 139755919513152 Connecting to 127.0.0.1:3000
Mon Aug 12 21:20:09 2024 DEBUG 139755919513152 Sent OPTIONS request to 'http://localhost:3000/posts' {Connection bd27c294-9004-48d5-8e89-5f1bd4c1e1d5 {Socket socket# 6 127.0.0.1:39418 <--> 127.0.0.1:3000}}
Mon Aug 12 21:20:09 2024 DEBUG 139755919513152 Worker 0 is done.
Mon Aug 12 21:20:09 2024 DEBUG 139755927905856 Worker 0 is starting.
Mon Aug 12 21:20:09 2024 DEBUG 139755927905856 Connecting to 127.0.0.1:3000
Mon Aug 12 21:20:09 2024 DEBUG 139755927905856 Sent HEAD request to 'http://localhost:3000/posts' {Connection 894d9dea-251f-46ef-84a5-0d981e1f608b {Socket socket# 6 127.0.0.1:39422 <--> 127.0.0.1:3000}}
Mon Aug 12 21:20:09 2024 DEBUG 139755927905856 Worker 0 is done.
1 tests FAILED
jgaa commented 1 month ago

The failure is due to a change in a general backend container used to test POST requests. An id value was changed from int to string. The reason it crash is that the test itself don't catch exceptions and there fore the exception from json serialization leaks back to the restc-cpp core, where it is treated as a fatal error and terminate() is called.

I will soon push an update that handle both ;)

jgaa commented 1 month ago

I just merged the fixes to the master branch.