Skip to content

Create mock endpoints for jobs and devices using wiremock

Edmund Smith requested to merge eds/lava-api:eds/mock into main

This MR provides:

  • A lava-api-mock crate which has a reasonably accurate model of a Lava instance.
  • Support for generating mock objects using boulder.
  • Support for serving mock object arrays using django-query and wiremock
  • A basic unit test for each of the main lava api functions, checking correctness vs the mock.
  • A basic unit test for each mock, checking output equivalence with a real Lava instance.

This MR does not provide:

  • A single object representing a Lava instance that you can instantiate (WIP - will be a separate MR).
  • A solution to the graph problem (the fact that Lava objects form a cyclic graph that's really hard to keep consistent).
  • A solution to the graph generation problem (the same, plus the need to make new objects that are consistent with the old ones).

I spent quite a bit of time thinking about and exploring options for the latter. This just seems to be a known hard problem in Rust. Rather than graft an unwieldy and broken implementation of these things into this MR, I'll save it for a subsequent MR when I can do it properly.

This MR is draft pending:

  • Merge of !15 (merged) which is a prerequisite for some of the unit tests (clearly one of them has to come first).
Edited by Edmund Smith

Merge request reports