From 628c795e4d8e50aa30dd0ff9d9d7b12a62b06601 Mon Sep 17 00:00:00 2001 From: Manuel Carrer Date: Mon, 24 Jun 2024 17:14:02 +0200 Subject: [PATCH] cfg(test) does not apply to integration tests, we specify a separate feature to make it work --- ingestion/Cargo.toml | 3 +++ ingestion/src/kldata.rs | 3 +-- ingestion/src/permissions.rs | 3 +-- integration_tests/Cargo.toml | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ingestion/Cargo.toml b/ingestion/Cargo.toml index ce9e2081..5cbfcec3 100644 --- a/ingestion/Cargo.toml +++ b/ingestion/Cargo.toml @@ -3,6 +3,9 @@ name = "lard_ingestion" version = "0.1.0" edition.workspace = true +[features] +integration_tests = [] + [dependencies] axum.workspace = true bb8.workspace = true diff --git a/ingestion/src/kldata.rs b/ingestion/src/kldata.rs index 79d52720..2659d2fc 100644 --- a/ingestion/src/kldata.rs +++ b/ingestion/src/kldata.rs @@ -213,9 +213,8 @@ pub async fn filter_and_label_kldata( param_id.to_owned(), )? { // TODO: log that the timeseries is closed? Mostly useful for tests - #[cfg(test)] + #[cfg(feature = "integration_tests")] eprintln!("station {}: timeseries is closed", chunk.station_id); - continue; } diff --git a/ingestion/src/permissions.rs b/ingestion/src/permissions.rs index e09bec34..7489bddb 100644 --- a/ingestion/src/permissions.rs +++ b/ingestion/src/permissions.rs @@ -12,8 +12,7 @@ pub struct ParamPermit { permit_id: i32, } -// Only used in tests -#[doc(hidden)] +#[cfg(feature = "integration_tests")] impl ParamPermit { pub fn new(type_id: i32, param_id: i32, permit_id: i32) -> ParamPermit { ParamPermit { diff --git a/integration_tests/Cargo.toml b/integration_tests/Cargo.toml index 4fefbd1a..6b164808 100644 --- a/integration_tests/Cargo.toml +++ b/integration_tests/Cargo.toml @@ -5,7 +5,7 @@ edition.workspace = true [dependencies] lard_api = { path = "../api" } -lard_ingestion = { path = "../ingestion" } +lard_ingestion = { path = "../ingestion", features = ["integration_tests"] } chrono.workspace = true tokio.workspace = true tokio-postgres.workspace = true