Skip to content

Commit dd5bf2f

Browse files
committed
test: add more server tests and fix Dockerfile.dockerignore
1 parent e6f73a3 commit dd5bf2f

File tree

10 files changed

+86
-39
lines changed

10 files changed

+86
-39
lines changed

Cargo.lock

Lines changed: 27 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/Dockerfile.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
*
22

33
!/htsget-actix
4+
!/htsget-axum
45
!/htsget-config
56
!/htsget-http
67
!/htsget-lambda
78
!/htsget-search
9+
!/htsget-storage
810
!/htsget-test
911
!/Cargo.toml
1012
!/Cargo.lock

htsget-axum/src/server/ticket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ mod tests {
306306
}
307307

308308
#[tokio::test]
309-
async fn get_route_invalid_method() {
309+
async fn test_errors() {
310310
server::test_errors(&AxumTestServer::default()).await;
311311
}
312312
}

htsget-config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ default = []
1818
[dependencies]
1919
thiserror = "1"
2020
async-trait = "0.1"
21-
noodles = { version = "0.78", features = ["core"] }
21+
noodles = { version = "0.80", features = ["core"] }
2222
serde = { version = "1", features = ["derive"] }
2323
serde_with = "3"
2424
serde_regex = "1"

htsget-lambda/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ See [htsget-search] for details on how to structure files.
3838

3939
### As a library
4040

41-
There shouldn't be any need to interact with this crate as a library, however some functions which deal with
42-
routing queries are exposed in the public API.
41+
There is no need to interact with this crate as a library. Note that the Lambda function itself doesn't have any
42+
library code, and it instead uses `htsget-axum`. Please use that crate for functionality related to routing.
4343

4444
#### Feature flags
4545

htsget-lambda/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! htsget-lambda no longer has any library functions. Please use `htsget-axum` for similar
2+
//! functionality on routers and logic.
3+
//!

htsget-search/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ futures-util = "0.3"
3232
async-trait = "0.1"
3333

3434
# Noodles
35-
noodles = { version = "0.78", features = ["async", "core", "bgzf", "bam", "bcf", "cram", "csi", "sam", "tabix", "vcf"] }
35+
noodles = { version = "0.80", features = ["async", "core", "bgzf", "bam", "bcf", "cram", "csi", "sam", "tabix", "vcf"] }
3636

3737
# Error control, tracing, config
3838
thiserror = "1"

htsget-test/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ default = []
4242
# Server tests dependencies
4343
htsget-config = { version = "0.10.1", path = "../htsget-config", default-features = false, optional = true }
4444

45-
noodles = { version = "0.78", optional = true, features = ["async", "bgzf", "vcf", "cram", "bcf", "bam", "fasta"] }
45+
noodles = { version = "0.80", optional = true, features = ["async", "bgzf", "vcf", "cram", "bcf", "bam", "fasta"] }
4646

4747
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"], optional = true }
4848
tokio = { version = "1", features = ["rt-multi-thread", "fs"], optional = true }

htsget-test/src/http/concat.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use futures::future::join_all;
66
use futures::{Stream, TryStreamExt};
77
use htsget_config::types::{Class, Format, Response, Url};
88
use http::{HeaderMap, HeaderName, HeaderValue};
9-
use noodles::{bam, bcf, bgzf, cram, fasta, vcf};
9+
use noodles::{bam, bcf, bgzf, cram, vcf};
1010
use reqwest::Client;
1111
use std::future::Future;
1212
use std::io;
@@ -199,7 +199,6 @@ impl ReadRecords {
199199
.read_file_definition()
200200
.await
201201
.map_err(TestError::read_record)?;
202-
let repository = fasta::Repository::default();
203202
let header = reader
204203
.read_file_header()
205204
.await
@@ -208,9 +207,7 @@ impl ReadRecords {
208207
.map_err(TestError::read_record)?;
209208
println!("{:#?}", header);
210209

211-
self
212-
.iterate_records(reader.records(&repository, &header))
213-
.await
210+
self.iterate_records(reader.records(&header)).await
214211
}
215212
Format::Vcf => {
216213
let mut reader =

htsget-test/src/http/server.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,52 @@ where
290290
StatusCode::NOT_FOUND,
291291
)
292292
.await;
293+
294+
test_error_response(
295+
tester,
296+
tester
297+
.request()
298+
.method(Method::GET)
299+
.uri("/variants/1-vcf/sample1-bcbio-cancer?format=BED"),
300+
StatusCode::BAD_REQUEST,
301+
)
302+
.await;
303+
test_error_response(
304+
tester,
305+
tester
306+
.request()
307+
.method(Method::GET)
308+
.uri("/variants/1-vcf/sample1-bcbio-cancer?class=header&start=1"),
309+
StatusCode::BAD_REQUEST,
310+
)
311+
.await;
312+
test_error_response(
313+
tester,
314+
tester
315+
.request()
316+
.method(Method::GET)
317+
.uri("/variants/1-vcf/sample1-bcbio-cancer?referenceName=*&start=1"),
318+
StatusCode::BAD_REQUEST,
319+
)
320+
.await;
321+
test_error_response(
322+
tester,
323+
tester
324+
.request()
325+
.method(Method::GET)
326+
.uri("/variants/1-vcf/sample1-bcbio-cancer?referenceName=chr1&start=2&end=1"),
327+
StatusCode::BAD_REQUEST,
328+
)
329+
.await;
330+
test_error_response(
331+
tester,
332+
tester
333+
.request()
334+
.method(Method::GET)
335+
.uri("/variants/1-vcf/sample1-bcbio-cancer?referenceName=*&end=1"),
336+
StatusCode::BAD_REQUEST,
337+
)
338+
.await;
293339
}
294340

295341
/// An example VCF search response.

0 commit comments

Comments
 (0)