about summary refs log tree commit diff
path: root/tvix/store/src/tests
AgeCommit message (Collapse)AuthorFilesLines
2023-03-10 r/5935 feat(tvix/store): use Memory*Service instead of temporary sledFlorian Klink1-8/+8
Change-Id: I65d2030aa643b6937dd92baa85db033bdce38b02 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8208 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-03-10 r/5934 feat(tvix/store): add new_temporary for all Sled servicesFlorian Klink3-73/+52
This provides a service using /dev/shm, that's deleted once the reference is dropped. Refactor all tests to use these, which allows getting rid of most TempDir usage in the tests. The only place where we still use TempDir is in the importer tests, which work on a filesystem path. Change-Id: I08a950aa774bf9b46d9f5c92edf5efba36053242 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8193 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-03-10 r/5932 feat(tvix/store): add import::import_pathFlorian Klink2-0/+137
This imports the contents at a given Path into the tvix store. It doesn't register the contents at a Path in the store itself, that's up to the PathInfoService. Change-Id: I2c493532d65b90f199ddb7dfc90249f5c2957dee Reviewed-on: https://cl.tvl.fyi/c/depot/+/8159 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-03-10 r/5931 refactor(tvix/store/tests/nar_renderer): only upload EMPTY_BLOBFlorian Klink1-16/+14
This also uploaded HELLOWORLD_BLOB_CONTENTS before, but it's not referred from anywhere in the fixture. Change-Id: I823133afe0f08d18a59e2ac4e4d4bb7d34ce8a2b Reviewed-on: https://cl.tvl.fyi/c/depot/+/8158 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-03-10 r/5930 refactor(tvix/store/tests): move nar contents to fixturesFlorian Klink2-90/+88
Change-Id: I89a700240e7250a4d93eb8c4235e79c29ecb7f64 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8157 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-03-10 r/5929 refactor(tvix/store/tests): move fixtures into separate moduleFlorian Klink3-37/+88
Change-Id: I362dbf0899e4dc42114fd2e6a8fa7f537e9ea138 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8156 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-03-10 r/5928 refactor(tvix/store/tests): move gen_*_service() into helperFlorian Klink3-16/+26
This allows hiding to tests what exact implementation we're using, when testing things that do something with a store, but don't care what's used for underlying storage. Change-Id: I7cdf60fd73c25d5050159cb31ec177db2bc2a7f1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8155 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-03-10 r/5923 chore(tvix/store): remove old implementationsFlorian Klink3-337/+0
These were implementing against the (more complicated) gRPC interface, for which we now have a wrapper. Change-Id: I0a8284493718ab99618a1d21a76df4d173edb899 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8100 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-03-10 r/5917 feat(tvix/store): validate blob size in NARRendererFlorian Klink1-0/+101
Make sure the blob size in the current proto node matches what we get back from the blob backend. Change-Id: I939fa18f37c7bc86ada8a495c7be622e69ec47f8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8129 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-03-10 r/5916 refactor(tvix/store): don't use anyhow::Result<()> in testsFlorian Klink1-11/+6
It's much easier to just unwrap the TempDir::new() result. Change-Id: I7b05bc18f3146401e30e1cc2bb412503c5171a66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8128 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-03-10 r/5915 chore(tvix/store): move NAR rendering logic into Renderer structFlorian Klink2-111/+117
This moves the logic rendering NARs to a struct using the previously introduced, more granular BlobService, ChunkService and DirectoryService. Instead of passing them around to the helper functions, they're kept as members of a struct. Remove the async invocations in the nar_renderer tests, there's nothing async in here. Change-Id: Ic6d24aaad68a1fda46ce29f2cdb5f7b87f481d5c Reviewed-on: https://cl.tvl.fyi/c/depot/+/8095 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-03-10 r/5907 chore(tvix/store): move protos into separate mod.rsFlorian Klink4-577/+0
This allows adding more stuff into this namespace, from different files. Also move tests on proto-related code from src/tests to src/proto/tests. Change-Id: I49e066fce90efbc18e16d68f94497b32ed5625c0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8091 Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-01-31 r/5794 feat(tvix/store): add write_nar functionFlorian Klink2-0/+268
This adds a function that consumes a [proto::node::Node] pointing to the root of a (store) path, and writes the contents in NAR serialization to the passed [std::io::Write]. We need this in various places: - tvix-store's calculate_nar() RPC method needs to render a NAR stream to get the nar hash, which is necessary to give things imported in the store a "NAR-based" store path. - communication with (remote) Nix (via daemon protocol) needs a NAR representation. - Things like nar-bridge, exposing a NAR/NARInfo HTTP interface need a NAR representation. Change-Id: I7fb2e0bf01814a1c09094c0e35394d9d6b3e43b6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7956 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-31 r/5790 feat(tvix/store): implement iteration over Directory nodesFlorian Klink2-0/+83
This provides a `Directory.nodes()` function, returning an iterator over all three node types in an ordered fashion. Change-Id: Ib98696c03a9db8b6c613d6e2bf5587c1ae35133f Reviewed-on: https://cl.tvl.fyi/c/depot/+/7955 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-31 r/5788 refactor(tvix): introduce nix-compat crateFlorian Klink1-4/+2
Move nixbase32 and store_path into this. This allows //tvix/cli to not pull in //tvix/store for now. Change-Id: Id3a32867205d95794bc0d33b21d4cb3d9bafd02a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7964 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-30 r/5780 refactor(tvix/store/tests): move Directory tests into directory.rsFlorian Klink2-286/+286
There's gonna be more tests coming, let's move them into a separate file everything Directory-related into a separate module. Change-Id: I78a0f263925528907a22724b028f75cce644b329 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7954 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-21 r/5724 feat(tvix/store/directory): validate Directory and sizesFlorian Klink1-1/+61
This calls out to Directory::validate() for all received Directory messages, and also makes sure the sizes we refer a Directory message as matches the sizes that have been calculated. Change-Id: I316f9191d5872ee4ba6d78b9a4326f069b22fa63 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7882 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-21 r/5723 feat(tvix/store/directory): deduplicate Directory messagesFlorian Klink1-0/+50
We can omit sending Directory messages to clients that have already been sent in the same stream. We can also omit storing a Directory message if we already have it - they're content-addressed anyways. Change-Id: Iba44565e07157a83a033177a2ffbdddced64ba5c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7881 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-21 r/5722 feat(tvix/store): add SledDirectoryServiceFlorian Klink2-0/+159
Change-Id: I8e97a59da2c6623f4cca746efa741097a6dbe5b1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7871 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-21 r/5719 refactor(tvix/store): simplify test a bitFlorian Klink1-24/+17
Import more things, and use expect_err to unpack the response. Change-Id: Ia319dd4d126b8d0e1df585234710d825a33a0002 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7868 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-12 r/5649 feat(tvix/store): implement PathInfoService with sledFlorian Klink2-0/+75
This uses [sled](https://github.com/spacejam/sled) to store PathInfo objects. Change-Id: I12e8032e5562af8f884efa23a78049fd1108fdbc Reviewed-on: https://cl.tvl.fyi/c/depot/+/7726 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-06 r/5613 refactor(tvix/store): rename NixPath to StorePathFlorian Klink1-11/+14
As discussed in #tvl, this is a more common term for it. Change-Id: I9b904222b8c076f82192c9b7f0b42be171614ab7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7776 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-03 r/5570 feat(src/proto): add PathInfo.validate()Florian Klink2-0/+208
This provides validation of PathInfo messages, and ensures the output hashes are properly parsed from the root node names. NixPath already has a more extensive test suite for various wrong NixPaths, so it's omitted from here. Change-Id: I5d69118df5816daabb521ddb19d178bddd1caacf Reviewed-on: https://cl.tvl.fyi/c/depot/+/7684 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-29 r/5531 chore(tvix/store): move tests into separate fileFlorian Klink1-0/+285
Move them from the bottom of src/proto.rs to its own src/tests/mod.rs. Also drop the test_ prefix, this is not golang. Change-Id: I2e0b6b9812264f3d9721c0766936f08157fadc66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7667 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>