Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lun4m committed Jul 2, 2024
1 parent f0e4a6d commit ea7a91a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
6 changes: 3 additions & 3 deletions integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
## End-to-end

1. Each test is defined inside a wrapper function (`e2e_test_wrapper`) that spawns separate tasks for the ingestor, the API server,
and a Postgres client used to clean up the database after the test is completed.
and a Postgres client that cleans up the database after the test is completed.

1. Each test defines a `TestData` struct (or an array of structs) that contains the metadata
required to build a timeseries. The data is formatted into an Obsinn message,
which is sent via a POST request to the ingestor.

1. Finally, the data is retrived and checked by sending a GET request to one of the API endpoints.

If you have Docker installed, you can test locally by using the provided `Makefile`:
If you have Docker installed, you can run the tests locally using the provided `Makefile`:

```terminal
# Run all integration tests
Expand All @@ -20,6 +20,6 @@ make end_to_end
# Debug a specific test (does not clean up the DB)
TEST=my_test_name make debug_test
# If any error occurs, you might need to delete the DB container manually
# If any error occurs, you might need to reset the DB container manually
make clean
```
8 changes: 2 additions & 6 deletions integration_tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ async fn main() {

let schemas = ["db/public.sql", "db/labels.sql"];
for schema in schemas {
if let Err(e) = insert_schema(&client, schema).await {
eprintln!("Error: {e} ({schema})")
}
insert_schema(&client, schema).await.unwrap();
}

if let Err(e) = create_data_partition(&client).await {
eprintln!("connection error: {e}");
}
create_data_partition(&client).await.unwrap();
}
6 changes: 3 additions & 3 deletions integration_tests/tests/end_to_end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ use std::{

use chrono::{DateTime, Duration, DurationRound, TimeDelta, TimeZone, Utc};
use futures::{Future, FutureExt};
use lard_api::timeseries::Timeseries;
use lard_api::{LatestResp, TimeseriesResp, TimesliceResp};
use lard_ingestion::KldataResp;
use test_case::test_case;
use tokio_postgres::NoTls;

use lard_api::timeseries::Timeseries;
use lard_api::{LatestResp, TimeseriesResp, TimesliceResp};
use lard_ingestion::permissions::{
timeseries_is_open, ParamPermit, ParamPermitTable, StationPermitTable,
};
use lard_ingestion::KldataResp;

const CONNECT_STRING: &str = "host=localhost user=postgres dbname=postgres password=postgres";
const PARAMCONV_CSV: &str = "../ingestion/resources/paramconversions.csv";
Expand Down

0 comments on commit ea7a91a

Please sign in to comment.