Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a simplified central object to act as porcelain for the mock #10

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lava-api-mock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ readme = "../README.md"
[dependencies]
boulder = { version="0.3", features = ["persian-rug"] }
chrono = { version = "0.4", features = ["serde"] }
clocks = "0.0.1"
clone-replace = "0.1"
django-query = { version="0.2", features = ["wiremock", "persian-rug", "clone-replace"] }
futures = "0.3"
itertools = "0.10"
num = "0.4"
persian-rug = { version = "0.1", features = ["clone-replace"] }
rust_decimal = "1"
rust_decimal_macros = "1"
Expand Down
14 changes: 8 additions & 6 deletions lava-api-mock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
//! and [`BuildableWithPersianRug`](boulder::BuildableWithPersianRug)
//! which are from the [`boulder`] crate.
//!
//! # LavaMock
//! # Server
//!
//! Most users will want to base their tests around [`LavaMock`],
//! Most users will want to base their tests around [`Server`],
//! which is a [`django-query`](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
Expand All @@ -42,14 +42,14 @@
//! Example:
//! ```rust
//! use futures::stream::TryStreamExt;
//! use lava_api_mock::{LavaMock, PaginationLimits, PopulationParams, SharedState};
//! use lava_api_mock::{Server, PaginationLimits, PopulationParams, SharedState};
//! use lava_api::Lava;
//!
//! # tokio_test::block_on( async {
//! // Make the mock server
//! let limits = PaginationLimits::new();
//! let population = PopulationParams::new();
//! let mock = LavaMock::new(SharedState::new_populated(population), limits).await;
//! let mock = Server::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");
Expand All @@ -69,7 +69,8 @@
mod devices;
mod devicetypes;
mod jobs;
mod lava_mock;
mod mock;
mod server;
mod state;
mod tags;
mod testcases;
Expand All @@ -80,7 +81,8 @@ pub use devices::{Device, Health as DeviceHealth, State as DeviceState};
pub use devicetypes::{Alias, Architecture, BitWidth, Core, DeviceType, ProcessorFamily};
pub use jobs::Job;
pub use jobs::{Health as JobHealth, State as JobState};
pub use lava_mock::{LavaMock, PaginationLimits};
pub use mock::{create_mock, Mock as LavaMock};
pub use server::{PaginationLimits, Server};
pub use state::{PopulationParams, SharedState, State};
pub use tags::Tag;
pub use testcases::{Metadata, PassFail, TestCase, TestSet, TestSuite};
Expand Down
Loading