Unverified Commit 34f3fc6d authored by Ryan McCormick's avatar Ryan McCormick Committed by GitHub
Browse files

test: Add doc tests to Rust CI (#1102)

parent 75a69cd3
......@@ -83,6 +83,10 @@ jobs:
run: |
cargo-deny --version || cargo install cargo-deny@0.16.4
cargo-deny --no-default-features check --hide-inclusion-graph licenses bans --config ${{ github.workspace }}/deny.toml
- name: Run Doc Tests
working-directory: ${{ matrix.dir }}
run: cargo doc --no-deps && cargo test --locked --doc
- name: Run Unit Tests
working-directory: ${{ matrix.dir }}
# NOTE: --all-targets doesn't run doc tests
run: cargo test --locked --all-targets
......@@ -143,13 +143,11 @@ static LOG_PREFIX_RE: LazyLock<Regex> = LazyLock::new(|| {
/// Strips the log level, date, and time from the start of a log line.
///
/// # Examples
/// ```
/// let line = "INFO 05-06 09:38:50 [async_llm.py:252] Added request 1";
/// assert_eq!(strip_log_prefix(line), "[async_llm.py:252] Added request 1");
///
/// let line_no_prefix = "This is a normal line.";
/// assert_eq!(strip_log_prefix(line_no_prefix), "This is a normal line.");
/// ```
fn strip_log_prefix(line: &str) -> Cow<'_, str> {
if let Some(captures) = LOG_PREFIX_RE.captures(line) {
// `captures.get(0)` would be the entire matched prefix + message.
......
......@@ -30,8 +30,8 @@ repository = "https://github.com/ai-dynamo/dynamo.git"
path = "rust/lib.rs"
name = "_core"
# "cdylib" is necessary to produce a shared library for Python to import from.
crate-type = ["cdylib"]
# "rlib" is necessary to support doctests.
crate-type = ["cdylib", "rlib"]
[dependencies]
......
......@@ -4,14 +4,14 @@ This example extends the hello_world example by calling the `scrape_service` met
with the service name for the request response the client just issued a request.
```bash
DYN_LOG=debug cargo run --bin server
DYN_LOG=debug cargo run --bin service_server
```
The client can now observe some basic statistics about each instance of the service
begin hosted.
```bash
DYN_LOG=info cargo run --bin client
DYN_LOG=info cargo run --bin service_client
```
## Example Output
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment