Write test fixturing for libfetchers #363

Open
opened 2024-05-30 21:30:15 +00:00 by jade · 4 comments
Owner

Steps:

Move the serveHTTP infrastructure from

static std::tuple<uint16_t, AutoCloseFD>
serveHTTP(std::vector<Reply> replies)

into a .cc file in libutil-support instead and add a header, then bring up a libfetchers unit test suite using the http server in a similar way as tests/unit/libstore/filetransfer.cc.

Steps: Move the serveHTTP infrastructure from https://git.lix.systems/lix-project/lix/src/commit/285bc67318e2ee4b69b13eb0b8e7b202fc287c51/tests/unit/libstore/filetransfer.cc#L29-L30 into a .cc file in libutil-support instead and add a header, then bring up a libfetchers unit test suite using the http server in a similar way as tests/unit/libstore/filetransfer.cc.
Owner

actually. can we do one better and include libmicrohttpd or something that's actually an http server? serveHTTP is already grown perhaps a bit too far, and testing actual fetchers might need a lot more still?

actually. can we do one better and include libmicrohttpd or something that's *actually an http server*? `serveHTTP` is already grown perhaps a bit too far, and testing actual fetchers might need a lot more still?
Author
Owner

yeah, we probably should just do that. i have also abused python http.server elsewhere as an http server that's already in our closure. microhttpd would also be extremely reasonable for the c++ side. i would be fine with either approach, either doing it in c++ or doing the fake apis in python.

yeah, we probably should just do that. i have also abused python http.server elsewhere as an http server that's already in our closure. microhttpd would also be extremely reasonable for the c++ side. i would be fine with either approach, either doing it in c++ or doing the fake apis in python.
Author
Owner

stuff like https://gerrit.lix.systems/c/lix/+/1363 is just goofy and we would like to make it easier to get it right in the future

stuff like https://gerrit.lix.systems/c/lix/+/1363 is just goofy and we would like to make it easier to get it right in the future
rootile added this to the functional2 project 2025-12-23 17:01:42 +00:00
Member

note the unfinished existence of https://git.lix.systems/lix-project/lix/src/branch/main/tests/functional2/testlib/fixtures/http_server.py which can be expaned for this issue

note the unfinished existence of https://git.lix.systems/lix-project/lix/src/branch/main/tests/functional2/testlib/fixtures/http_server.py which can be expaned for this issue
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lix-project/lix#363
No description provided.