Build a nice to use http/binary-cache testing fixture in functional2 #600

Open
opened 2024-12-10 19:20:12 +00:00 by jade · 1 comment
Owner

We currently have the ability to generate custom NARs on the fly in functional2. This is pretty cool, but it only really utilized for generating invalid NARs to test the parser. Currently Lix contains a kinda bad testing http server and the tests using it are more janky than necessary. Also we currently use NixOS tests for a bunch of binary cache stuff and other network interaction which we could absolutely run against localhost instead, if we had better testing fixtures.

The concept that I have is something like this:

def test_cache_thingy(nix: Nix, binary_cache: BinaryCache):
    name = binary_cache.path(NAR([
        ('file1', NAR.file(b'foo bar')),
        ('abc', NAR.dir([
            ('file2', NAR.file(b'baz', executable=True))
        ]))
    ])

    nix.nix(['path-info', '--store', binary_cache.url])
    # ....
We currently have the ability to generate custom NARs on the fly in functional2. This is pretty cool, but it only really utilized for generating invalid NARs to test the parser. Currently Lix contains a kinda bad testing http server and the tests using it are more janky than necessary. Also we currently use NixOS tests for a bunch of binary cache stuff and other network interaction which we could *absolutely* run against localhost instead, if we had better testing fixtures. The concept that I have is something like this: ```python def test_cache_thingy(nix: Nix, binary_cache: BinaryCache): name = binary_cache.path(NAR([ ('file1', NAR.file(b'foo bar')), ('abc', NAR.dir([ ('file2', NAR.file(b'baz', executable=True)) ])) ]) nix.nix(['path-info', '--store', binary_cache.url]) # .... ```
jade self-assigned this 2025-01-22 18:13:50 +00:00
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/2431 ("WIP: functional2 binary cache server")
  • commit message in cl/2429 ("functional2: add http server fixture")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/2431", "number": 2431, "kind": "commit message"}, {"backlink": "https://gerrit.lix.systems/c/lix/+/2429", "number": 2429, "kind": "commit message"}], "cl_meta": {"2431": {"change_title": "WIP: functional2 binary cache server"}, "2429": {"change_title": "functional2: add http server fixture"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/2431](https://gerrit.lix.systems/c/lix/+/2431) ("WIP: functional2 binary cache server") * commit message in [cl/2429](https://gerrit.lix.systems/c/lix/+/2429) ("functional2: add http server fixture")
piegames added this to the functional2 project 2025-04-17 13:28:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 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#600
No description provided.