Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
34f3fc6d
Unverified
Commit
34f3fc6d
authored
May 16, 2025
by
Ryan McCormick
Committed by
GitHub
May 16, 2025
Browse files
test: Add doc tests to Rust CI (#1102)
parent
75a69cd3
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
6 deletions
+8
-6
.github/workflows/pre-merge-rust.yml
.github/workflows/pre-merge-rust.yml
+4
-0
launch/dynamo-run/src/subprocess.rs
launch/dynamo-run/src/subprocess.rs
+0
-2
lib/bindings/python/Cargo.toml
lib/bindings/python/Cargo.toml
+2
-2
lib/runtime/examples/service_metrics/README.md
lib/runtime/examples/service_metrics/README.md
+2
-2
lib/runtime/examples/service_metrics/src/bin/service_client.rs
...untime/examples/service_metrics/src/bin/service_client.rs
+0
-0
lib/runtime/examples/service_metrics/src/bin/service_server.rs
...untime/examples/service_metrics/src/bin/service_server.rs
+0
-0
No files found.
.github/workflows/pre-merge-rust.yml
View file @
34f3fc6d
...
@@ -83,6 +83,10 @@ jobs:
...
@@ -83,6 +83,10 @@ jobs:
run
:
|
run
:
|
cargo-deny --version || cargo install cargo-deny@0.16.4
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
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
-
name
:
Run Unit Tests
working-directory
:
${{ matrix.dir }}
working-directory
:
${{ matrix.dir }}
# NOTE: --all-targets doesn't run doc tests
run
:
cargo test --locked --all-targets
run
:
cargo test --locked --all-targets
launch/dynamo-run/src/subprocess.rs
View file @
34f3fc6d
...
@@ -143,13 +143,11 @@ static LOG_PREFIX_RE: LazyLock<Regex> = LazyLock::new(|| {
...
@@ -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.
/// Strips the log level, date, and time from the start of a log line.
///
///
/// # Examples
/// # Examples
/// ```
/// let line = "INFO 05-06 09:38:50 [async_llm.py:252] Added request 1";
/// 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");
/// assert_eq!(strip_log_prefix(line), "[async_llm.py:252] Added request 1");
///
///
/// let line_no_prefix = "This is a normal line.";
/// let line_no_prefix = "This is a normal line.";
/// assert_eq!(strip_log_prefix(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
>
{
fn
strip_log_prefix
(
line
:
&
str
)
->
Cow
<
'_
,
str
>
{
if
let
Some
(
captures
)
=
LOG_PREFIX_RE
.captures
(
line
)
{
if
let
Some
(
captures
)
=
LOG_PREFIX_RE
.captures
(
line
)
{
// `captures.get(0)` would be the entire matched prefix + message.
// `captures.get(0)` would be the entire matched prefix + message.
...
...
lib/bindings/python/Cargo.toml
View file @
34f3fc6d
...
@@ -30,8 +30,8 @@ repository = "https://github.com/ai-dynamo/dynamo.git"
...
@@ -30,8 +30,8 @@ repository = "https://github.com/ai-dynamo/dynamo.git"
path
=
"rust/lib.rs"
path
=
"rust/lib.rs"
name
=
"_core"
name
=
"_core"
# "cdylib" is necessary to produce a shared library for Python to import from.
# "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]
[dependencies]
...
...
lib/runtime/examples/service_metrics/README.md
View file @
34f3fc6d
...
@@ -4,14 +4,14 @@ This example extends the hello_world example by calling the `scrape_service` met
...
@@ -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.
with the service name for the request response the client just issued a request.
```
bash
```
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
The client can now observe some basic statistics about each instance of the service
begin hosted.
begin hosted.
```
bash
```
bash
DYN_LOG
=
info cargo run
--bin
client
DYN_LOG
=
info cargo run
--bin
service_
client
```
```
## Example Output
## Example Output
...
...
lib/runtime/examples/service_metrics/src/bin/client.rs
→
lib/runtime/examples/service_metrics/src/bin/
service_
client.rs
View file @
34f3fc6d
File moved
lib/runtime/examples/service_metrics/src/bin/server.rs
→
lib/runtime/examples/service_metrics/src/bin/
service_
server.rs
View file @
34f3fc6d
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment