Skip to content

Commit ecaf5a4

Browse files
committed
ci: integration test improvements
1 parent 5baf642 commit ecaf5a4

File tree

3 files changed

+7
-57
lines changed

3 files changed

+7
-57
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,12 @@ jobs:
270270
271271
- name: Run Ledger integration tests
272272
env:
273-
RUN_LEDGER_INTEGRATION_TESTS: "1"
274273
LEDGER_ENDPOINT: "http://localhost:50052"
275-
LEDGER_NAMESPACE_ID: "1"
276274
RUST_BACKTRACE: "1"
277275
run: |
278276
cargo nextest run \
279277
--package inferadb-control-storage \
278+
--features integration \
280279
--test ledger_integration_tests \
281280
--profile ci \
282281
--no-fail-fast

crates/storage/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ tokio = { workspace = true, features = ["rt-multi-thread", "macros", "time"] }
2727

2828
[features]
2929
default = []
30+
integration = []
3031

3132
[lints]
3233
workspace = true
3334

3435
[[test]]
3536
name = "ledger_integration_tests"
3637
path = "tests/ledger_integration_tests.rs"
38+
required-features = ["integration"]

crates/storage/tests/ledger_integration_tests.rs

Lines changed: 4 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
//! Integration tests for Ledger storage backend in Control
22
//!
3-
//! These tests require a running Ledger server. They are skipped unless the
4-
//! `RUN_LEDGER_INTEGRATION_TESTS` environment variable is set.
3+
//! These tests require a running Ledger server. They are gated behind the
4+
//! `integration` feature flag and excluded from default `cargo nextest run`.
55
//!
6-
//! Run with: cargo test --test ledger_integration_tests
7-
//!
8-
//! Or using Docker Compose:
6+
//! Run with:
97
//! ```bash
10-
//! cd docker/ledger-integration-tests && ./run-tests.sh
8+
//! cargo nextest run -p inferadb-control-storage --features integration --test ledger_integration_tests
119
//! ```
1210
1311
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
@@ -45,10 +43,6 @@ static VAULT_COUNTER: LazyLock<AtomicU64> = LazyLock::new(|| {
4543
/// Organization slug created once per process via the Ledger admin API.
4644
static TEST_ORG: OnceCell<OrganizationSlug> = OnceCell::const_new();
4745

48-
fn should_run() -> bool {
49-
env::var("RUN_LEDGER_INTEGRATION_TESTS").is_ok()
50-
}
51-
5246
fn ledger_endpoint() -> String {
5347
env::var("LEDGER_ENDPOINT").unwrap_or_else(|_| "http://localhost:50051".to_string())
5448
}
@@ -99,11 +93,6 @@ async fn create_ledger_backend() -> LedgerBackend {
9993

10094
#[tokio::test]
10195
async fn test_ledger_basic_operations() {
102-
if !should_run() {
103-
eprintln!("Skipping Ledger integration test (RUN_LEDGER_INTEGRATION_TESTS not set)");
104-
return;
105-
}
106-
10796
let backend = create_ledger_backend().await;
10897

10998
// Test set and get
@@ -126,11 +115,6 @@ async fn test_ledger_basic_operations() {
126115

127116
#[tokio::test]
128117
async fn test_ledger_range_operations() {
129-
if !should_run() {
130-
eprintln!("Skipping Ledger integration test (RUN_LEDGER_INTEGRATION_TESTS not set)");
131-
return;
132-
}
133-
134118
let backend = create_ledger_backend().await;
135119

136120
// Insert test data
@@ -169,11 +153,6 @@ async fn test_ledger_range_operations() {
169153

170154
#[tokio::test]
171155
async fn test_ledger_ttl_expiration() {
172-
if !should_run() {
173-
eprintln!("Skipping Ledger integration test (RUN_LEDGER_INTEGRATION_TESTS not set)");
174-
return;
175-
}
176-
177156
let backend = create_ledger_backend().await;
178157

179158
// Set a key with 2 second TTL
@@ -198,11 +177,6 @@ async fn test_ledger_ttl_expiration() {
198177

199178
#[tokio::test]
200179
async fn test_ledger_transaction() {
201-
if !should_run() {
202-
eprintln!("Skipping Ledger integration test (RUN_LEDGER_INTEGRATION_TESTS not set)");
203-
return;
204-
}
205-
206180
let backend = create_ledger_backend().await;
207181

208182
// Start a transaction
@@ -226,11 +200,6 @@ async fn test_ledger_transaction() {
226200

227201
#[tokio::test]
228202
async fn test_ledger_transaction_delete() {
229-
if !should_run() {
230-
eprintln!("Skipping Ledger integration test (RUN_LEDGER_INTEGRATION_TESTS not set)");
231-
return;
232-
}
233-
234203
let backend = create_ledger_backend().await;
235204

236205
// Pre-populate
@@ -251,11 +220,6 @@ async fn test_ledger_transaction_delete() {
251220

252221
#[tokio::test]
253222
async fn test_ledger_health_check() {
254-
if !should_run() {
255-
eprintln!("Skipping Ledger integration test (RUN_LEDGER_INTEGRATION_TESTS not set)");
256-
return;
257-
}
258-
259223
let backend = create_ledger_backend().await;
260224

261225
let result =
@@ -269,11 +233,6 @@ async fn test_ledger_health_check() {
269233

270234
#[tokio::test]
271235
async fn test_ledger_concurrent_writes() {
272-
if !should_run() {
273-
eprintln!("Skipping Ledger integration test (RUN_LEDGER_INTEGRATION_TESTS not set)");
274-
return;
275-
}
276-
277236
// Spawn concurrent writers (each gets its own backend with unique vault)
278237
let org = ensure_organization().await;
279238
let mut handles = Vec::new();
@@ -313,11 +272,6 @@ async fn test_ledger_concurrent_writes() {
313272

314273
#[tokio::test]
315274
async fn test_ledger_vault_isolation() {
316-
if !should_run() {
317-
eprintln!("Skipping Ledger integration test (RUN_LEDGER_INTEGRATION_TESTS not set)");
318-
return;
319-
}
320-
321275
let vault_a = unique_vault();
322276
let vault_b = unique_vault();
323277
let org = ensure_organization().await;
@@ -375,11 +329,6 @@ async fn test_ledger_vault_isolation() {
375329

376330
#[tokio::test]
377331
async fn test_ledger_reconnection_after_idle() {
378-
if !should_run() {
379-
eprintln!("Skipping Ledger integration test (RUN_LEDGER_INTEGRATION_TESTS not set)");
380-
return;
381-
}
382-
383332
let backend = create_ledger_backend().await;
384333

385334
// First operation

0 commit comments

Comments
 (0)