Expand description
This crate provides a set of types for constructing mock servers providing the LAVA REST API with generated data.
§Overview
The main types in a Lava database have types in this crate:
AliasArchitectureBitWidthCoreDeviceDeviceTypeGroupJobProcessorFamilyTagTestCaseTestSetTestSuiteUserWorker
There is a container type State which implements
Context from the
persian-rug crate. All types are
GeneratableWithPersianRug
and BuildableWithPersianRug
which are from the boulder crate.
§LavaMock
Most users will want to base their tests around LavaMock,
which is a django-query derived server, which
provides all of the v0.2 query REST endpoints of a standard Lava
server. See the documentation for details of its limitations. The
data it serves comes from a SharedState (a synchronised
wrapper over a State) which can both be populated with default
data as a starting point, and also updated on the fly to simulate
whatever update pattern is desired.
Example:
use futures::stream::TryStreamExt;
use lava_api_mock::{LavaMock, PaginationLimits, PopulationParams, SharedState};
use lava_api::Lava;
// Make the mock server
let limits = PaginationLimits::new();
let population = PopulationParams::new();
let mock = LavaMock::new(SharedState::new_populated(population), limits).await;
// Make the Lava client for reading back data from the server
let lava = Lava::new(&mock.uri(), None).expect("failed to make lava client");
// Read back the devices using the Lava client
let mut ld = lava.devices();
while let Some(device) = ld
.try_next()
.await
.expect("failed to read devices from server")
{
println!("Got device {:?}", device);
}Structs§
- Alias
- An alias from the LAVA API
- Architecture
- An architecture from the LAVA API
- BitWidth
- A bit width from the LAVA API
- Core
- A core from the LAVA API
- Device
- A device from the LAVA API.
- Device
Type - A device type from the LAVA API
- Group
- A group in the LAVA API
- Job
- A job from the LAVA API
- Junit
Endpoint - Lava
Mock - A mock server that provides access to a
SharedState. - Metadata
- A representation of the metadata for a test case.
- Pagination
Limits - Pagination limits for constructing a
LavaMockinstance. - Population
Params - Initial population sizes for the data in a
State - Processor
Family - A processor family from the LAVA API
- Shared
State - A thin wrapper around
Statefor shared access. - State
- The data backing a mock Lava instance
- Tag
- A tag in the LAVA API
- Test
Case - A test from the LAVA API.
- TestSet
- A set of tests from the LAVA API.
- Test
Suite - A suite of tests from the LAVA API.
- User
- A user in the LAVA API
- Worker
- A worker in the LAVA API
Enums§
- Device
Health - The health status of a
Devicefrom the LAVA API. - Device
State - The state of a
Devicefrom the LAVA API. - JobHealth
- The health (i.e. completion type) of a
Jobin the LAVA API - JobState
- The state (i.e. progress) of a
Jobin the LAVA API - Pass
Fail - A test result from the LAVA API