diff options
author | Andrew Moss <1043609+amoss@users.noreply.github.com> | 2019-11-07 15:29:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-07 15:29:43 +0100 |
commit | 87a7a044d58a518740f2a14e2266b5631c4aee10 (patch) | |
tree | 020f6e71e9f44dfb30d34e8a0cebb3cc4d66f4f1 /Makefile.am | |
parent | 727fe4ebaca0c468bf3aceef0918acbb1280d49e (diff) |
Initial CMocka testing against web_client.c (issue #7229). (#7264)
* Start of unit-test for http request processing.
A CMocka test-driver has been added to replay the live-capture headers against the http request processing code. Enough stubs / mocking code have been written to check that we can inject a chosen raw request into the web_client code and check how it was processed. A parameterised buffer building function can setup requests for testing in `web_buffer` structures. Each endpoint in the API will be checked against a variety of http requests. This PoC demonstrates enough functionality to show building the request on demand for each test-case and cleaning up afterwards.
Diffstat (limited to 'Makefile.am')
-rw-r--r-- | Makefile.am | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index ccd26d1f7f..094581bcc0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -644,10 +644,32 @@ if ENABLE_UNITTESTS check_PROGRAMS = \ libnetdata/tests/str2ld_testdriver \ libnetdata/storage_number/tests/storage_number_testdriver \ + web/api/tests/web_api_testdriver \ $(NULL) TESTS = $(check_PROGRAMS) + web_api_tests_web_api_testdriver_LDFLAGS = \ + -Wl,--wrap=rrdhost_find_by_hostname \ + -Wl,--wrap=finished_web_request_statistics \ + -Wl,--wrap=config_get \ + -Wl,--wrap=web_client_api_request_v1 \ + -Wl,--wrap=rrdhost_find_by_guid \ + -Wl,--wrap=rrdset_find_byname \ + -Wl,--wrap=rrdset_find \ + -Wl,--wrap=rrdpush_receiver_thread_spawn \ + -Wl,--wrap=debug_int \ + -Wl,--wrap=error_int \ + -Wl,--wrap=info_int \ + $(TEST_LDFLAGS) \ + $(NULL) + web_api_tests_web_api_testdriver_SOURCES = \ + web/api/tests/web_api.c \ + web/server/web_client.c \ + $(LIBNETDATA_FILES) \ + $(NULL) + web_api_tests_web_api_testdriver_LDADD = $(NETDATA_COMMON_LIBS) $(TEST_LIBS) + libnetdata_tests_str2ld_testdriver_SOURCES = \ libnetdata/tests/test_str2ld.c \ $(LIBNETDATA_FILES) \ |