Skip to content

Commit 34f3fc6

Browse files
authored
test: Add doc tests to Rust CI (#1102)
1 parent 75a69cd commit 34f3fc6

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed

.github/workflows/pre-merge-rust.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ jobs:
8383
run: |
8484
cargo-deny --version || cargo install cargo-deny@0.16.4
8585
cargo-deny --no-default-features check --hide-inclusion-graph licenses bans --config ${{ github.workspace }}/deny.toml
86+
- name: Run Doc Tests
87+
working-directory: ${{ matrix.dir }}
88+
run: cargo doc --no-deps && cargo test --locked --doc
8689
- name: Run Unit Tests
8790
working-directory: ${{ matrix.dir }}
91+
# NOTE: --all-targets doesn't run doc tests
8892
run: cargo test --locked --all-targets

launch/dynamo-run/src/subprocess.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,11 @@ static LOG_PREFIX_RE: LazyLock<Regex> = LazyLock::new(|| {
143143
/// Strips the log level, date, and time from the start of a log line.
144144
///
145145
/// # Examples
146-
/// ```
147146
/// let line = "INFO 05-06 09:38:50 [async_llm.py:252] Added request 1";
148147
/// assert_eq!(strip_log_prefix(line), "[async_llm.py:252] Added request 1");
149148
///
150149
/// let line_no_prefix = "This is a normal line.";
151150
/// assert_eq!(strip_log_prefix(line_no_prefix), "This is a normal line.");
152-
/// ```
153151
fn strip_log_prefix(line: &str) -> Cow<'_, str> {
154152
if let Some(captures) = LOG_PREFIX_RE.captures(line) {
155153
// `captures.get(0)` would be the entire matched prefix + message.

lib/bindings/python/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ repository = "https://github.com/ai-dynamo/dynamo.git"
3030
path = "rust/lib.rs"
3131
name = "_core"
3232
# "cdylib" is necessary to produce a shared library for Python to import from.
33-
crate-type = ["cdylib"]
34-
33+
# "rlib" is necessary to support doctests.
34+
crate-type = ["cdylib", "rlib"]
3535

3636
[dependencies]
3737

lib/runtime/examples/service_metrics/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ This example extends the hello_world example by calling the `scrape_service` met
44
with the service name for the request response the client just issued a request.
55

66
```bash
7-
DYN_LOG=debug cargo run --bin server
7+
DYN_LOG=debug cargo run --bin service_server
88
```
99

1010
The client can now observe some basic statistics about each instance of the service
1111
begin hosted.
1212

1313
```bash
14-
DYN_LOG=info cargo run --bin client
14+
DYN_LOG=info cargo run --bin service_client
1515
```
1616

1717
## Example Output

0 commit comments

Comments
 (0)