etr / libhttpserver

C++ library for creating an embedded Rest HTTP server (and more)
GNU Lesser General Public License v2.1
882 stars 184 forks source link

Make more robust tests. #312

Closed bcsgh closed 1 year ago

bcsgh commented 1 year ago

This is "more of the same" with regards to making the tests more robust about the environment they are run in.

bcsgh commented 1 year ago

@etr Can you take a look at the CI failures? I'm unable to reproduce that specific error locally and I think the one in CI might be pre-existing? (It seems that exceptions escaping a test are silently ignored?)

etr commented 1 year ago

It seems to be impacting only the SSL related tests and I agree with you, this seems to be pre-existing.

I think as we moved to github-actions, we missed the installation of the gnutls dependency that libmicrohttpd needs to enable SSL.

I need to check why the tests weren't failing though, I suspect that this is because the exception is not on the main thread, but nonetheless, it would be worth for this to be caught.

etr commented 1 year ago

The issue was due to libgnutls not being installed in the CI flow. Now I still have one remaining issue with one of the tests legitimately failing.

etr commented 1 year ago

It should all work now if you pull from live

bcsgh commented 1 year ago

It should all work now if you pull from live

Am I still doing something wrong?

[ASSERT FAILURE] (../../test/integ/ws_start_stop.cpp:460) - error in "ssl_with_protocol_priorities": exceptions thown by ((ws.start(false)))

Looking at the diff it look like I've correctly propagated your fix:

LT_ASSERT_NOTHROW(cws.https_priorities("NONE:+AES-256-GCM:+SHA384"));
bcsgh commented 1 year ago

Wrapping individual lines in LT_ASSERT_NOTHROW seems like a sisyphean task, I've backed out some of that in favor of solving that at the more general layer: https://github.com/etr/libhttpserver/pull/316