From e8058541d1c747a43f40fe6cdfe276790998c894 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Thu, 15 May 2025 04:27:18 +0000 Subject: [PATCH] Fix incorrect args in rust-sdk --- .github/workflows/rust.yml | 2 +- run-tests.sh | 21 +++++++++++++++++++++ sdk/rust/src/dstack_client.rs | 7 ++++--- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100755 run-tests.sh diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 70bb868a..4cc352d6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,4 +27,4 @@ jobs: run: cargo fmt --check --all - name: Run tests - run: cargo test + run: ./run-tests.sh diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 00000000..fba2ad9b --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -e + +(cd sdk/simulator && ./build.sh) + +pushd sdk/simulator +./dstack-simulator & +SIMULATOR_PID=$! +echo "Simulator process (PID: $SIMULATOR_PID) started." +popd + +export DSTACK_SIMULATOR_ENDPOINT=$(realpath sdk/simulator/dstack.sock) + +echo "DSTACK_SIMULATOR_ENDPOINT: $DSTACK_SIMULATOR_ENDPOINT" + +# Run the tests +cargo test + +# Kill the simulator after tests finish +kill $SIMULATOR_PID +echo "Simulator process (PID: $SIMULATOR_PID) terminated." diff --git a/sdk/rust/src/dstack_client.rs b/sdk/rust/src/dstack_client.rs index 48af3bc9..51f8fea5 100644 --- a/sdk/rust/src/dstack_client.rs +++ b/sdk/rust/src/dstack_client.rs @@ -53,9 +53,10 @@ pub struct EventLog { #[derive(bon::Builder, Serialize)] pub struct TlsKeyConfig { - #[builder(into)] - pub subject: Option, - pub alt_names: Option>, + #[builder(into, default = String::new())] + pub subject: String, + #[builder(default = Vec::new())] + pub alt_names: Vec, #[builder(default = false)] pub usage_ra_tls: bool, #[builder(default = true)]