Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial CMocka testing against web_client.c (issue #7229). #7264

Merged
merged 7 commits into from
Nov 7, 2019
Merged

Initial CMocka testing against web_client.c (issue #7229). #7264

merged 7 commits into from
Nov 7, 2019

Conversation

amoss
Copy link
Contributor

@amoss amoss commented Nov 6, 2019

Summary

Fixes #7229

Component Name

area/web
area/testing

Additional Information

PoC for CMocka testing against web_client.c. Marks the end of investigating which parts of the http request processing code need to be tested.

Live data from captured from an instrumented host, this mixed fuzzing by the tool against access from various
browsers. A CMocka test-driver has been added to replay the headers against the http request processing code.
Enough stubs / mocking code has been written to check that we can inject a chosen raw request into the
web_client code and check it was processed.
This is a modified version of Vlad's clag-format from his WIP PR on the exporters, and the code updated to
match it.
Each endpoint in the API will be checked against a variety of http requests. This function builds the request on
demand for each test-case and cleans up afterwards. Quick sketch of how this will be hooked into the testgenerator
for CMocka.

Current problems:
* Produces incorrect status codes (unit-test or request validation?)
* Strange sizes being reported during execution of web_client code.
* Needs to step through partial buffer fills.
We don't need the live capture data in the tree (squashing this chain of commits will remove it) and @vlvkobal was
currently changing the .clang-format so avoid conflicts. Although this version was better :)
@squash-labs
Copy link

squash-labs bot commented Nov 6, 2019

Manage this branch in Squash

Test this branch here: https://amossissue-7229-eqtn8.squash.io

@amoss amoss requested review from ilyam8 and removed request for knatsakis, cakrit, mfundul and thiagoftsm November 6, 2019 22:41
@amoss amoss merged commit 87a7a04 into netdata:master Nov 7, 2019
jackyhuang85 pushed a commit to jackyhuang85/netdata that referenced this pull request Jan 1, 2020
…tdata#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.
@amoss amoss deleted the issue_7229 branch January 15, 2020 19:24
Saruspete pushed a commit to Saruspete/netdata that referenced this pull request May 21, 2020
…tdata#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Analyse the current http header processing
4 participants