Files
leleka/crates/runtime-client/tests/grpc_backend.rs
T
2026-11-07 09:41:44 +01:00

51 lines
1.6 KiB
Rust

//! `GrpcBackend` against a scripted `leleka.runtime.v1` server over real loopback HTTP/2.
//!
//! The server here is a stand-in: it answers snapshots, replays the frames a test gives it and counts
//! cancels. The full chain with the real `RuntimeServer` and a scripted engine behind it is exercised
//! in `strata-desktop-core` (`tests/api_over_runtime.rs`). Nothing here loads a model.
use std::{
net::SocketAddr,
pin::Pin,
sync::{
Arc, Mutex,
atomic::{AtomicUsize, Ordering},
},
time::Duration,
};
use futures_util::Stream;
use leleka_backend_api::{
Backend, ErrorCode, FinishReason, GenerationEvent, GenerationRequest, GenerationTerminal,
InferenceMode, LoadedModel, ModelDescriptor, RuntimeConfig, SamplingOptions, StreamError,
Usage,
};
use leleka_runtime_client::{
backend::GrpcBackend,
convert,
proto::{self, generation_frame::Payload},
};
use tonic::{Request, Response, Status};
#[path = "grpc_backend/attach_and_reconfigure.rs"]
mod attach_and_reconfigure;
#[path = "grpc_backend/generation.rs"]
mod generation;
#[path = "grpc_backend/runtime_restart_and_loss.rs"]
mod runtime_restart_and_loss;
#[path = "grpc_backend/stream_lifecycle.rs"]
mod stream_lifecycle;
#[path = "grpc_backend/fixtures.rs"]
mod fixtures;
use fixtures::{config, descriptor, loaded};
#[path = "grpc_backend/scripted_service.rs"]
mod scripted_service;
#[path = "grpc_backend/server_and_frames.rs"]
mod server_and_frames;
use server_and_frames::{blocking, drain, id, request, terminal, text, usage};
#[path = "grpc_backend/scripted_types.rs"]
mod scripted_types;
use scripted_types::{Fake, FakeState, Frames, Server, TOKEN};