From 13e7ab4ae47e5cc9ff1daca527c60c094eab1ac5 Mon Sep 17 00:00:00 2001 From: Roman Valls Guimera Date: Tue, 31 Jan 2023 16:43:54 +1100 Subject: [PATCH 01/10] Cherry-pick from remove-s3-server branch --- Cargo.lock | 1290 +++++++++++++++--------------- htsget-search/Cargo.toml | 19 +- htsget-search/src/storage/aws.rs | 79 +- 3 files changed, 688 insertions(+), 700 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d709ae6c8..bdee81c04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,7 +180,7 @@ dependencies = [ "serde_urlencoded", "smallvec", "socket2", - "time 0.3.17", + "time", "url", ] @@ -196,15 +196,6 @@ dependencies = [ "syn", ] -[[package]] -name = "addr2line" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli", -] - [[package]] name = "adler" version = "1.0.2" @@ -268,14 +259,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" [[package]] -name = "async-channel" -version = "1.8.0" +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "ascii" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" + +[[package]] +name = "assert-json-diff" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "4259cbe96513d2f1073027a259fc2ca917feb3026a5a8d984e3628e490255cc0" dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", + "extend", + "serde", + "serde_json", ] [[package]] @@ -291,28 +294,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "async-fs" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" -dependencies = [ - "async-lock", - "autocfg", - "blocking", - "futures-lite", -] - -[[package]] -name = "async-lock" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" -dependencies = [ - "event-listener", - "futures-lite", -] - [[package]] name = "async-stream" version = "0.3.3" @@ -334,23 +315,26 @@ dependencies = [ "syn", ] -[[package]] -name = "async-task" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" - [[package]] name = "async-trait" -version = "0.1.60" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + [[package]] name = "atomic" version = "0.5.1" @@ -360,12 +344,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "atomic-waker" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" - [[package]] name = "atty" version = "0.2.14" @@ -385,41 +363,82 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "aws-config" -version = "0.52.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7688e1dfbb9f7804fab0a830820d7e827b8d973906763cf1a855ce4719292f5" +checksum = "3c3d1e2a1f1ab3ac6c4b884e37413eaa03eb9d901e4fc68ee8f5c1d49721680e" dependencies = [ - "aws-http", + "aws-credential-types 0.54.1", + "aws-http 0.54.1", "aws-sdk-sso", "aws-sdk-sts", - "aws-smithy-async", - "aws-smithy-client", - "aws-smithy-http", - "aws-smithy-http-tower", - "aws-smithy-json", - "aws-smithy-types", - "aws-types", + "aws-smithy-async 0.54.1", + "aws-smithy-client 0.54.1", + "aws-smithy-http 0.54.1", + "aws-smithy-http-tower 0.54.1", + "aws-smithy-json 0.54.1", + "aws-smithy-types 0.54.1", + "aws-types 0.54.1", "bytes", "hex", "http", "hyper", "ring", - "time 0.3.17", + "time", "tokio", "tower", "tracing", "zeroize", ] +[[package]] +name = "aws-credential-types" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f99dd587a46af58f8cf37773687ecec19d0373a5954942d7e0f405751fe2369" +dependencies = [ + "aws-smithy-async 0.53.1", + "aws-smithy-types 0.53.1", + "tokio", + "tracing", + "zeroize", +] + +[[package]] +name = "aws-credential-types" +version = "0.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0696a0523a39a19087747e4dafda0362dc867531e3d72a3f195564c84e5e08" +dependencies = [ + "aws-smithy-async 0.54.1", + "aws-smithy-types 0.54.1", + "tokio", + "tracing", + "zeroize", +] + +[[package]] +name = "aws-endpoint" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13fdfc00c57d95e10bcf83d2331c4ae9ca460ca84dc983b2cdd692de87640389" +dependencies = [ + "aws-smithy-http 0.53.1", + "aws-smithy-types 0.53.1", + "aws-types 0.53.0", + "http", + "regex", + "tracing", +] + [[package]] name = "aws-endpoint" -version = "0.52.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "253d7cd480bfa59a5323390e9e91885a8f06a275e0517d81eeb1070b6aa7d271" +checksum = "80a4f935ab6a1919fbfd6102a80c4fccd9ff5f47f94ba154074afe1051903261" dependencies = [ - "aws-smithy-http", - "aws-smithy-types", - "aws-types", + "aws-smithy-http 0.54.1", + "aws-smithy-types 0.54.1", + "aws-types 0.54.1", "http", "regex", "tracing", @@ -427,13 +446,33 @@ dependencies = [ [[package]] name = "aws-http" -version = "0.52.0" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74cdac70481d144bf7001c27884b95ee12c8f62e61db90320d59b673ae121cb8" +dependencies = [ + "aws-credential-types 0.53.0", + "aws-smithy-http 0.53.1", + "aws-smithy-types 0.53.1", + "aws-types 0.53.0", + "bytes", + "http", + "http-body", + "lazy_static", + "percent-encoding", + "pin-project-lite", + "tracing", +] + +[[package]] +name = "aws-http" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd1b83859383e46ea8fda633378f9f3f02e6e3a446fd89f0240b5c3662716c9" +checksum = "82976ca4e426ee9ca3ffcf919d9b2c8d14d0cd80d43cc02173737a8f07f28d4d" dependencies = [ - "aws-smithy-http", - "aws-smithy-types", - "aws-types", + "aws-credential-types 0.54.1", + "aws-smithy-http 0.54.1", + "aws-smithy-types 0.54.1", + "aws-types 0.54.1", "bytes", "http", "http-body", @@ -445,118 +484,213 @@ dependencies = [ [[package]] name = "aws-sdk-s3" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d240ff751efc65099d18f6b0fb80360b31a298cec7b392c511692bec4a6e21" -dependencies = [ - "aws-endpoint", - "aws-http", - "aws-sig-auth", - "aws-sigv4", - "aws-smithy-async", - "aws-smithy-checksums", - "aws-smithy-client", - "aws-smithy-eventstream", - "aws-smithy-http", - "aws-smithy-http-tower", - "aws-smithy-types", - "aws-smithy-xml", - "aws-types", +checksum = "5ae411cb03ea6df0d4c4340a0d3c15cab7b19715d091f76c5629f31acd6403f3" +dependencies = [ + "aws-credential-types 0.53.0", + "aws-endpoint 0.53.0", + "aws-http 0.53.0", + "aws-sig-auth 0.53.0", + "aws-sigv4 0.53.0", + "aws-smithy-async 0.53.1", + "aws-smithy-checksums 0.53.1", + "aws-smithy-client 0.53.1", + "aws-smithy-eventstream 0.53.1", + "aws-smithy-http 0.53.1", + "aws-smithy-http-tower 0.53.1", + "aws-smithy-json 0.53.1", + "aws-smithy-types 0.53.1", + "aws-smithy-xml 0.53.1", + "aws-types 0.53.0", + "bytes", + "bytes-utils", + "fastrand", + "http", + "http-body", + "once_cell", + "percent-encoding", + "regex", + "tokio-stream", + "tower", + "tracing", + "url", +] + +[[package]] +name = "aws-sdk-s3" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1533be023eeac69668eb718b1c48af7bd5e26305ed770553d2877ab1f7507b68" +dependencies = [ + "aws-credential-types 0.54.1", + "aws-endpoint 0.54.1", + "aws-http 0.54.1", + "aws-sig-auth 0.54.1", + "aws-sigv4 0.54.1", + "aws-smithy-async 0.54.1", + "aws-smithy-checksums 0.54.1", + "aws-smithy-client 0.54.1", + "aws-smithy-eventstream 0.54.1", + "aws-smithy-http 0.54.1", + "aws-smithy-http-tower 0.54.1", + "aws-smithy-json 0.54.1", + "aws-smithy-types 0.54.1", + "aws-smithy-xml 0.54.1", + "aws-types 0.54.1", "bytes", "bytes-utils", "fastrand", "http", "http-body", + "once_cell", + "percent-encoding", + "regex", "tokio-stream", "tower", "tracing", + "url", ] [[package]] name = "aws-sdk-sso" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf03342c2b3f52b180f484e60586500765474f2bfc7dcd4ffe893a7a1929db1d" -dependencies = [ - "aws-endpoint", - "aws-http", - "aws-sig-auth", - "aws-smithy-async", - "aws-smithy-client", - "aws-smithy-http", - "aws-smithy-http-tower", - "aws-smithy-json", - "aws-smithy-types", - "aws-types", +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca0119bacf0c42f587506769390983223ba834e605f049babe514b2bd646dbb2" +dependencies = [ + "aws-credential-types 0.54.1", + "aws-endpoint 0.54.1", + "aws-http 0.54.1", + "aws-sig-auth 0.54.1", + "aws-smithy-async 0.54.1", + "aws-smithy-client 0.54.1", + "aws-smithy-http 0.54.1", + "aws-smithy-http-tower 0.54.1", + "aws-smithy-json 0.54.1", + "aws-smithy-types 0.54.1", + "aws-types 0.54.1", "bytes", "http", + "regex", "tokio-stream", "tower", ] [[package]] name = "aws-sdk-sts" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa1de4e07ea87a30a317c7b563b3a40fd18a843ad794216dda81672b6e174bce" -dependencies = [ - "aws-endpoint", - "aws-http", - "aws-sig-auth", - "aws-smithy-async", - "aws-smithy-client", - "aws-smithy-http", - "aws-smithy-http-tower", +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "270b6a33969ebfcb193512fbd5e8ee5306888ad6c6d5d775cdbfb2d50d94de26" +dependencies = [ + "aws-credential-types 0.54.1", + "aws-endpoint 0.54.1", + "aws-http 0.54.1", + "aws-sig-auth 0.54.1", + "aws-smithy-async 0.54.1", + "aws-smithy-client 0.54.1", + "aws-smithy-http 0.54.1", + "aws-smithy-http-tower 0.54.1", + "aws-smithy-json 0.54.1", "aws-smithy-query", - "aws-smithy-types", - "aws-smithy-xml", - "aws-types", + "aws-smithy-types 0.54.1", + "aws-smithy-xml 0.54.1", + "aws-types 0.54.1", "bytes", "http", + "regex", "tower", "tracing", ] [[package]] name = "aws-sig-auth" -version = "0.52.0" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22af7f6515f8b51dabef87df1d901c9734e4e367791c6d0e1082f9f31528120e" +dependencies = [ + "aws-credential-types 0.53.0", + "aws-sigv4 0.53.0", + "aws-smithy-eventstream 0.53.1", + "aws-smithy-http 0.53.1", + "aws-types 0.53.0", + "http", + "tracing", +] + +[[package]] +name = "aws-sig-auth" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6126c4ff918e35fb9ae1bf2de71157fad36f0cc6a2b1d0f7197ee711713700fc" +checksum = "660a02a98ab1af83bd8d714afbab2d502ba9b18c49e7e4cddd6bf8837ff778cb" dependencies = [ - "aws-sigv4", - "aws-smithy-eventstream", - "aws-smithy-http", - "aws-types", + "aws-credential-types 0.54.1", + "aws-sigv4 0.54.1", + "aws-smithy-eventstream 0.54.1", + "aws-smithy-http 0.54.1", + "aws-types 0.54.1", "http", "tracing", ] [[package]] name = "aws-sigv4" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c7f88d7395f5411c6eef5889b6cd577ce6b677af461356cbfc20176c26c160" +checksum = "eee0d796882321e91ca7b991ab6193864e04b605be3a6c18adb9134a90d5a860" dependencies = [ - "aws-smithy-eventstream", - "aws-smithy-http", + "aws-smithy-eventstream 0.53.1", + "aws-smithy-http 0.53.1", "bytes", "form_urlencoded", "hex", - "hmac 0.12.1", + "hmac", "http", "once_cell", "percent-encoding", "regex", - "sha2 0.10.6", - "time 0.3.17", + "sha2", + "time", "tracing", ] +[[package]] +name = "aws-sigv4" +version = "0.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdaf11005b7444e6cd66f600d09861a3aeb6eb89a0f003c7c9820dbab2d15297" +dependencies = [ + "aws-smithy-eventstream 0.54.1", + "aws-smithy-http 0.54.1", + "bytes", + "form_urlencoded", + "hex", + "hmac", + "http", + "once_cell", + "percent-encoding", + "regex", + "sha2", + "time", + "tracing", +] + +[[package]] +name = "aws-smithy-async" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b9900be224962d65a626072d8777f847ae5406c07547f0dc14c60048978c4b" +dependencies = [ + "futures-util", + "pin-project-lite", + "tokio", + "tokio-stream", +] + [[package]] name = "aws-smithy-async" -version = "0.52.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e6a895d68852dd1564328e63ef1583e5eb307dd2a5ebf35d862a5c402957d5e" +checksum = "075d87b46420b28b64140f2ba88fa6b158c2877466a2acdbeaf396c25e4b9b33" dependencies = [ "futures-util", "pin-project-lite", @@ -566,35 +700,80 @@ dependencies = [ [[package]] name = "aws-smithy-checksums" -version = "0.52.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b847d960abc993319d77b52e82971e2bbdce94f6192df42142e14ed5c9c917" +checksum = "85e9e4d3c2296bcec2c03f9f769ac9b2424d972c2fe7afc0b59235447ac3a5c3" dependencies = [ - "aws-smithy-http", - "aws-smithy-types", + "aws-smithy-http 0.53.1", + "aws-smithy-types 0.53.1", "bytes", "crc32c", "crc32fast", "hex", "http", "http-body", - "md-5 0.10.5", + "md-5", "pin-project-lite", "sha1", - "sha2 0.10.6", + "sha2", + "tracing", +] + +[[package]] +name = "aws-smithy-checksums" +version = "0.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55fe82d7463becdd632f8c6446cbdb2cbe34ad42a7d92c480d8fca08749d07a4" +dependencies = [ + "aws-smithy-http 0.54.1", + "aws-smithy-types 0.54.1", + "bytes", + "crc32c", + "crc32fast", + "hex", + "http", + "http-body", + "md-5", + "pin-project-lite", + "sha1", + "sha2", + "tracing", +] + +[[package]] +name = "aws-smithy-client" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710ca0f8dacddda5fbcaf5c3cd9d02da7913fd463a2ee9555b617bf168bedacb" +dependencies = [ + "aws-smithy-async 0.53.1", + "aws-smithy-http 0.53.1", + "aws-smithy-http-tower 0.53.1", + "aws-smithy-types 0.53.1", + "bytes", + "fastrand", + "http", + "http-body", + "hyper", + "hyper-rustls", + "lazy_static", + "pin-project-lite", + "tokio", + "tower", "tracing", ] [[package]] name = "aws-smithy-client" -version = "0.52.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f505bf793eb3e6d7c166ef1275c27b4b2cd5361173fe950ac8e2cfc08c29a7ef" +checksum = "17d44078855a64d757e5c1727df29ffa6679022c38cfc4ba4e63ee9567133141" dependencies = [ - "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-http-tower", - "aws-smithy-types", + "aws-smithy-async 0.54.1", + "aws-smithy-http 0.54.1", + "aws-smithy-http-tower 0.54.1", + "aws-smithy-protocol-test", + "aws-smithy-types 0.54.1", "bytes", "fastrand", "http", @@ -603,6 +782,7 @@ dependencies = [ "hyper-rustls", "lazy_static", "pin-project-lite", + "serde", "tokio", "tower", "tracing", @@ -610,23 +790,57 @@ dependencies = [ [[package]] name = "aws-smithy-eventstream" -version = "0.52.0" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d1ff11ee22de3581114b60d4ae8e700638dacb5b5bbe6769726e251e6c3f20a" +dependencies = [ + "aws-smithy-types 0.53.1", + "bytes", + "crc32fast", +] + +[[package]] +name = "aws-smithy-eventstream" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d751c99da757aecc1408ab6b2d65e9493220a5e7a68bcafa4f07b6fd1bc473f1" +checksum = "652a99272024770cbe33579dc0016914a09922b27f9a4d12f37472aacbbe71c1" dependencies = [ - "aws-smithy-types", + "aws-smithy-types 0.54.1", "bytes", "crc32fast", ] [[package]] name = "aws-smithy-http" -version = "0.52.0" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29dcab29afbea7726f5c10c7be0c38666d7eb07db551580b3b26ed7cfb5d1935" +dependencies = [ + "aws-smithy-eventstream 0.53.1", + "aws-smithy-types 0.53.1", + "bytes", + "bytes-utils", + "futures-core", + "http", + "http-body", + "hyper", + "once_cell", + "percent-encoding", + "pin-project-lite", + "pin-utils", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "aws-smithy-http" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e4b4304b7ea4af1af3e08535100eb7b6459d5a6264b92078bf85176d04ab85" +checksum = "b5bd86f48d7e36fb24ee922d04d79c8353e01724b1c38757ed92593179223aa7" dependencies = [ - "aws-smithy-eventstream", - "aws-smithy-types", + "aws-smithy-eventstream 0.54.1", + "aws-smithy-types 0.54.1", "bytes", "bytes-utils", "futures-core", @@ -644,12 +858,28 @@ dependencies = [ [[package]] name = "aws-smithy-http-tower" -version = "0.52.0" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5856d2f1063c0f726a85f32dcd2a9f5a1d994eb27b156abccafc7260f3f471d" +dependencies = [ + "aws-smithy-http 0.53.1", + "aws-smithy-types 0.53.1", + "bytes", + "http", + "http-body", + "pin-project-lite", + "tower", + "tracing", +] + +[[package]] +name = "aws-smithy-http-tower" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86072ecc4dc4faf3e2071144285cfd539263fe7102b701d54fb991eafb04af8" +checksum = "c8972d1b4ae3aba1a10e7106fed53a5a36bc8ef86170a84f6ddd33d36fac12ad" dependencies = [ - "aws-smithy-http", - "aws-smithy-types", + "aws-smithy-http 0.54.1", + "aws-smithy-types 0.54.1", "bytes", "http", "http-body", @@ -660,59 +890,131 @@ dependencies = [ [[package]] name = "aws-smithy-json" -version = "0.52.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3ddd9275b167bc59e9446469eca56177ec0b51225632f90aaa2cd5f41c940e" +checksum = "dfb33659b68480495b5f906b946c8642928440118b1d7e26a25a067303ca01a5" dependencies = [ - "aws-smithy-types", + "aws-smithy-types 0.53.1", +] + +[[package]] +name = "aws-smithy-json" +version = "0.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18973f12721e27b54891386497a57e1ba09975df1c6cfeccafaf541198962aef" +dependencies = [ + "aws-smithy-types 0.54.1", +] + +[[package]] +name = "aws-smithy-protocol-test" +version = "0.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b72e9ac0818d0016ced540ba0d06975299d27684ff514173b21c9976fd72062b" +dependencies = [ + "assert-json-diff", + "http", + "pretty_assertions", + "regex", + "roxmltree", + "serde_json", + "thiserror", ] [[package]] name = "aws-smithy-query" -version = "0.52.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b19d2e0b3ce20e460bad0d0d974238673100edebba6978c2c1aadd925602f7" +checksum = "2881effde104a2b0619badaad9f30ae67805e86fbbdb99e5fcc176e8bfbc1a85" dependencies = [ - "aws-smithy-types", + "aws-smithy-types 0.54.1", "urlencoding", ] [[package]] name = "aws-smithy-types" -version = "0.52.0" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2013465a070decdeb3e85ceb3370ae85ba05f56f914abfd89858d7281c4f12c3" +dependencies = [ + "base64-simd 0.7.0", + "itoa", + "num-integer", + "ryu", + "time", +] + +[[package]] +name = "aws-smithy-types" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "987b1e37febb9bd409ca0846e82d35299e572ad8279bc404778caeb5fc05ad56" +checksum = "da7e499c4b15bab8eb6b234df31833cc83a1bdaa691ba72d5d81efc109d9d705" dependencies = [ - "base64-simd", + "base64-simd 0.7.0", "itoa", "num-integer", "ryu", - "time 0.3.17", + "time", +] + +[[package]] +name = "aws-smithy-types-convert" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d57b2ac4dc27cfa3671cc8aa7ab5eaff3ef98f87dfa699f33dd556506fd8edc" +dependencies = [ + "aws-smithy-types 0.53.1", + "time", +] + +[[package]] +name = "aws-smithy-xml" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d27bfaa164aa94aac721726a83aa78abe708a275e88a573e103b4961c5f0ede" +dependencies = [ + "xmlparser", ] [[package]] name = "aws-smithy-xml" -version = "0.52.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ce3791e14eec75ffac851a5a559f1ce6b31843297f42cc8bfba82714a6a5d8" +checksum = "9a73082f023f4a361fe811954da0061076709198792a3d2ad3a7498e10b606a0" dependencies = [ "xmlparser", ] [[package]] name = "aws-types" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c05adca3e2bcf686dd2c47836f216ab52ed7845c177d180c84b08522c1166a3" +checksum = "61f00f4b0cdd345686e6389f3343a3020f93232d20040802b87673ddc2d02956" dependencies = [ - "aws-smithy-async", - "aws-smithy-client", - "aws-smithy-http", - "aws-smithy-types", + "aws-credential-types 0.53.0", + "aws-smithy-async 0.53.1", + "aws-smithy-client 0.53.1", + "aws-smithy-http 0.53.1", + "aws-smithy-types 0.53.1", + "http", + "rustc_version", + "tracing", +] + +[[package]] +name = "aws-types" +version = "0.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8f15b34253b68cde08e39b0627cc6101bcca64351229484b4743392c035d057" +dependencies = [ + "aws-credential-types 0.54.1", + "aws-smithy-async 0.54.1", + "aws-smithy-client 0.54.1", + "aws-smithy-http 0.54.1", + "aws-smithy-types 0.54.1", "http", "rustc_version", "tracing", - "zeroize", ] [[package]] @@ -802,21 +1104,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "backtrace" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.13.1" @@ -829,13 +1116,29 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + [[package]] name = "base64-simd" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" dependencies = [ - "simd-abstraction 0.7.1", + "simd-abstraction", +] + +[[package]] +name = "base64-simd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" +dependencies = [ + "outref 0.5.1", + "vsimd", ] [[package]] @@ -850,15 +1153,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - [[package]] name = "block-buffer" version = "0.10.3" @@ -868,20 +1162,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "blocking" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" -dependencies = [ - "async-channel", - "async-lock", - "async-task", - "atomic-waker", - "fastrand", - "futures-lite", -] - [[package]] name = "brotli" version = "3.3.4" @@ -992,12 +1272,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", - "js-sys", "num-integer", "num-traits", "serde", - "time 0.1.45", - "wasm-bindgen", "winapi", ] @@ -1096,36 +1373,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "concurrent-queue" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "const-str" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21077772762a1002bb421c3af42ac1725fa56066bfc53d9a55bb79905df2aaf3" -dependencies = [ - "const-str-proc-macro", -] - -[[package]] -name = "const-str-proc-macro" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1e0fdd2e5d3041e530e1b21158aeeef8b5d0e306bc5c1e3d6cf0930d10e25a" -dependencies = [ - "proc-macro2", - "quote", - "regex", - "syn", -] - [[package]] name = "convert_case" version = "0.4.0" @@ -1139,7 +1386,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time 0.3.17", + "time", "version_check", ] @@ -1278,13 +1525,13 @@ dependencies = [ ] [[package]] -name = "crypto-mac" -version = "0.11.1" +name = "ctor" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ - "generic-array", - "subtle", + "quote", + "syn", ] [[package]] @@ -1386,13 +1633,10 @@ dependencies = [ ] [[package]] -name = "digest" -version = "0.9.0" +name = "diff" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] name = "digest" @@ -1400,32 +1644,11 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ - "block-buffer 0.10.3", + "block-buffer", "crypto-common", "subtle", ] -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "either" version = "1.8.0" @@ -1472,10 +1695,16 @@ dependencies = [ ] [[package]] -name = "event-listener" -version = "2.5.3" +name = "extend" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +checksum = "f47da3a72ec598d9c8937a7ebca8962a5c7a1f28444e38c2b33c771ba3f55f05" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] [[package]] name = "fastrand" @@ -1518,21 +1747,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.1.0" @@ -1590,21 +1804,6 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" -[[package]] -name = "futures-lite" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-macro" version = "0.3.25" @@ -1664,15 +1863,9 @@ checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] -[[package]] -name = "gimli" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" - [[package]] name = "h2" version = "0.3.15" @@ -1735,22 +1928,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hex-simd" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f677fe87e39e644d153887514393a22641085927cae26d28bcc8b34235a3f586" -dependencies = [ - "simd-abstraction 0.5.1", -] - -[[package]] -name = "hmac" -version = "0.11.0" +name = "hex-simd" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +checksum = "1f7685beb53fc20efc2605f32f5d51e9ba18b8ef237961d1760169d2290d3bee" dependencies = [ - "crypto-mac", - "digest 0.9.0", + "outref 0.5.1", + "vsimd", ] [[package]] @@ -1759,7 +1943,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest", ] [[package]] @@ -1850,11 +2034,12 @@ dependencies = [ "anyhow", "async-trait", "aws-config", - "aws-sdk-s3", - "aws-types", + "aws-credential-types 0.54.1", + "aws-sdk-s3 0.24.0", + "aws-types 0.54.1", "axum", "axum-extra", - "base64 0.20.0", + "base64 0.21.0", "bytes", "criterion", "data-url", @@ -1869,9 +2054,12 @@ dependencies = [ "noodles-bcf", "noodles-cram", "noodles-vcf", + "once_cell", "reqwest", "rustls-pemfile", - "s3-server", + "s3s", + "s3s-aws", + "s3s-fs", "serde", "tempfile", "thiserror", @@ -1991,20 +2179,6 @@ dependencies = [ "rustls-native-certs", "tokio", "tokio-rustls", - "webpki-roots", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", ] [[package]] @@ -2348,24 +2522,13 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" -[[package]] -name = "md-5" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug", -] - [[package]] name = "md-5" version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" dependencies = [ - "digest 0.10.6", + "digest", ] [[package]] @@ -2422,33 +2585,15 @@ checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.42.0", ] -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nom" -version = "7.1.2" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5507769c4919c998e69e49c839d9dc6e693ede4cc4290d6ad8b41d4f09c548c" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -2541,7 +2686,7 @@ dependencies = [ "bzip2", "flate2", "futures", - "md-5 0.10.5", + "md-5", "noodles-bam", "noodles-core", "noodles-fasta", @@ -2666,13 +2811,10 @@ dependencies = [ ] [[package]] -name = "object" -version = "0.30.1" +name = "numeric_cast" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d864c91689fdc196779b98dba0aceac6118594c2df6ee5d943eb6a8df4d107a" -dependencies = [ - "memchr", -] +checksum = "cf70ee2d9b1737d1836c20d9f8f96ec3901b2bf92128439db13237ddce9173a5" [[package]] name = "once_cell" @@ -2686,63 +2828,27 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "openssl" -version = "0.10.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-sys" -version = "0.9.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "os_str_bytes" version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +[[package]] +name = "output_vt100" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" +dependencies = [ + "winapi", +] + [[package]] name = "outref" version = "0.1.0" @@ -2750,16 +2856,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" [[package]] -name = "overload" -version = "0.1.1" +name = "outref" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" [[package]] -name = "parking" -version = "2.0.0" +name = "overload" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parking_lot" @@ -2918,6 +3024,18 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "pretty_assertions" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a25e9bcb20aa780fd0bb16b72403a9064d6b3f22f026946029acb941a50af755" +dependencies = [ + "ctor", + "diff", + "output_vt100", + "yansi", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -2977,9 +3095,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.22.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b" +checksum = "ffc053f057dd768a56f62cd7e434c42c831d296968997e9ac1f76ea7c2d14c41" dependencies = [ "memchr", "serde", @@ -3054,7 +3172,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", "ring", - "time 0.3.17", + "time", "yasna", ] @@ -3067,17 +3185,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", -] - [[package]] name = "regex" version = "1.7.0" @@ -3168,93 +3275,14 @@ dependencies = [ ] [[package]] -name = "rusoto_core" -version = "0.47.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b4f000e8934c1b4f70adde180056812e7ea6b1a247952db8ee98c94cd3116cc" -dependencies = [ - "async-trait", - "base64 0.13.1", - "bytes", - "crc32fast", - "futures", - "http", - "hyper", - "hyper-tls", - "lazy_static", - "log", - "rusoto_credential", - "rusoto_signature", - "rustc_version", - "serde", - "serde_json", - "tokio", - "xml-rs", -] - -[[package]] -name = "rusoto_credential" -version = "0.47.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a46b67db7bb66f5541e44db22b0a02fed59c9603e146db3a9e633272d3bac2f" -dependencies = [ - "async-trait", - "chrono", - "dirs-next", - "futures", - "hyper", - "serde", - "serde_json", - "shlex", - "tokio", - "zeroize", -] - -[[package]] -name = "rusoto_s3" -version = "0.47.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048c2fe811a823ad5a9acc976e8bf4f1d910df719dcf44b15c3e96c5b7a51027" -dependencies = [ - "async-trait", - "bytes", - "futures", - "rusoto_core", - "xml-rs", -] - -[[package]] -name = "rusoto_signature" -version = "0.47.0" +name = "roxmltree" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6264e93384b90a747758bcc82079711eacf2e755c3a8b5091687b5349d870bcc" +checksum = "921904a62e410e37e215c40381b7117f830d9d89ba60ab5236170541dd25646b" dependencies = [ - "base64 0.13.1", - "bytes", - "chrono", - "digest 0.9.0", - "futures", - "hex", - "hmac 0.11.0", - "http", - "hyper", - "log", - "md-5 0.9.1", - "percent-encoding", - "pin-project-lite", - "rusoto_credential", - "rustc_version", - "serde", - "sha2 0.9.9", - "tokio", + "xmlparser", ] -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - [[package]] name = "rustc-hash" version = "1.1.0" @@ -3330,45 +3358,84 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] -name = "s3-server" +name = "s3s" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d631a04555d2450ff36691d504a8229d04db8492d8a2cace3e999849fa4afa" +checksum = "b1490e3d6b7f9446b23870e0c485b17e73716f4b3060494dbeae0c542dd2e8e5" dependencies = [ - "async-fs", + "arrayvec", + "ascii", "async-trait", - "backtrace", - "base64 0.13.1", + "atoi", + "base64-simd 0.8.0", + "bytes", "chrono", - "const-str", "futures", "hex-simd", - "hmac 0.12.1", + "hmac", + "http-body", "httparse", "hyper", - "md-5 0.10.5", "memchr", "mime", "nom", - "once_cell", - "path-absolutize", "pin-project-lite", "quick-xml", - "regex", - "rusoto_core", - "rusoto_s3", "serde", - "serde_json", "serde_urlencoded", - "sha2 0.10.6", + "sha2", "smallvec", "thiserror", + "time", + "tracing", + "transform-stream", + "urlencoding", +] + +[[package]] +name = "s3s-aws" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "305f723fb3361c41de794595211ed4eb38b36d7ca5a814268ad6a323f6ea9969" +dependencies = [ + "async-trait", + "aws-sdk-s3 0.23.0", + "aws-smithy-http 0.53.1", + "aws-smithy-types 0.53.1", + "aws-smithy-types-convert", + "bytes", + "futures", + "hyper", + "s3s", + "tracing", +] + +[[package]] +name = "s3s-fs" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d345eb5e48cfb6b97fd549c4b22bcbadf6fe8bdec68d12ff8b780842d9df3c5" +dependencies = [ + "async-trait", + "base64-simd 0.8.0", + "bytes", + "chrono", + "futures", + "hex-simd", + "md-5", + "mime", + "numeric_cast", + "path-absolutize", + "s3s", + "serde_json", + "thiserror", + "time", + "tokio", + "tokio-util", "tracing", "tracing-error", - "tracing-futures", "transform-stream", - "uuid 0.8.2", - "xml-rs", + "uuid", ] [[package]] @@ -3516,7 +3583,7 @@ dependencies = [ "serde", "serde_json", "serde_with_macros", - "time 0.3.17", + "time", ] [[package]] @@ -3539,20 +3606,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", + "digest", ] [[package]] @@ -3563,7 +3617,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest", ] [[package]] @@ -3575,12 +3629,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shlex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" - [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -3590,19 +3638,13 @@ dependencies = [ "libc", ] -[[package]] -name = "simd-abstraction" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acaf60982756ce96a00bc9c5b351f14ca2d23e7dc13c10df0a0d9cc036094e3" - [[package]] name = "simd-abstraction" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" dependencies = [ - "outref", + "outref 0.1.0", ] [[package]] @@ -3729,17 +3771,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - [[package]] name = "time" version = "0.3.17" @@ -3794,9 +3825,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.24.0" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7125661431c26622a80ca5051a2f936c9a678318e0351007b0cc313143024e5c" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg", "bytes", @@ -3823,16 +3854,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.23.4" @@ -3955,7 +3976,7 @@ dependencies = [ "actix-web", "pin-project", "tracing", - "uuid 1.2.2", + "uuid", ] [[package]] @@ -3989,16 +4010,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "tracing-log" version = "0.1.3" @@ -4117,15 +4128,6 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom", -] - [[package]] name = "uuid" version = "1.2.2" @@ -4141,12 +4143,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" @@ -4154,10 +4150,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "waker-fn" -version = "1.1.0" +name = "vsimd" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" +checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" [[package]] name = "walkdir" @@ -4180,12 +4176,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -4427,12 +4417,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "xml-rs" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" - [[package]] name = "xmlparser" version = "0.13.5" @@ -4460,7 +4444,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aed2e7a52e3744ab4d0c05c20aa065258e84c49fd4226f5191b2ed29712710b4" dependencies = [ - "time 0.3.17", + "time", ] [[package]] diff --git a/htsget-search/Cargo.toml b/htsget-search/Cargo.toml index c2eefdb85..033b80982 100644 --- a/htsget-search/Cargo.toml +++ b/htsget-search/Cargo.toml @@ -41,27 +41,32 @@ noodles-vcf = { version = "0.23", features = ["async"] } # Amazon S3 bytes = { version = "1.2", optional = true } -aws-sdk-s3 = { version = "0.22", optional = true } -aws-config = { version = "0.52", optional = true } +aws-sdk-s3 = { version = "0.24", optional = true, features = ["test-util"] } +aws-config = { version = "0.54", optional = true } # Error control, tracing, config thiserror = "1.0" htsget-config = { version = "0.1.1", path = "../htsget-config", default-features = false } tracing = "0.1" -base64 = "0.20" +base64 = "0.21" serde = "1.0" +aws-credential-types = "0.54.1" [dev-dependencies] htsget-test = { version = "0.1.1", path = "../htsget-test", features = ["cors-tests"], default-features = false } tempfile = "3.3" data-url = "0.2" +once_cell = "1.17" -# Aws S3 storage dependencies. +# Aws S3 storage. anyhow = "1.0" -s3-server = "0.2" -aws-types = { version = "0.52", features = ["hardcoded-credentials"] } +aws-types = { version = "0.54" } +aws-credential-types = { version = "0.54", features = ["test-util"] } +s3s = "0.2.0" +s3s-fs = { version = "0.2" } +s3s-aws = { version = "0.2" } -# Axum server dependencies +# Axum server reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] } criterion = { version = "0.4", features = ["async_tokio"] } diff --git a/htsget-search/src/storage/aws.rs b/htsget-search/src/storage/aws.rs index a764260c7..44e0dc21e 100644 --- a/htsget-search/src/storage/aws.rs +++ b/htsget-search/src/storage/aws.rs @@ -219,19 +219,20 @@ impl Storage for AwsS3Storage { #[cfg(test)] mod tests { + use std::env; + use std::fs; use std::future::Future; use std::net::TcpListener; use std::path::Path; + use once_cell::sync::Lazy; - use aws_sdk_s3::{Client, Endpoint}; - use aws_types::credentials::SharedCredentialsProvider; - use aws_types::region::Region; - use aws_types::{Credentials, SdkConfig}; - use futures::future; - use hyper::service::make_service_fn; - use hyper::Server; - use s3_server::storages::fs::FileSystem; - use s3_server::{S3Service, SimpleAuth}; + use s3s_aws; + use s3s::service::S3Service; + + use aws_credential_types::provider::SharedCredentialsProvider; + use aws_sdk_s3::{Client, Credentials}; + use aws_config::SdkConfig; + use aws_sdk_s3::Region; use crate::htsget::Headers; use crate::storage::aws::AwsS3Storage; @@ -239,42 +240,40 @@ mod tests { use crate::storage::StorageError; use crate::storage::{BytesPosition, GetOptions, RangeUrlOptions, Storage}; + const FS_ROOT: &str = concat!(env!("CARGO_TARGET_TMPDIR"), "/s3s-fs-tests-aws"); + const DOMAIN_NAME: &str = "localhost:8014"; + const REGION: &str = "us-west-2"; + async fn with_s3_test_server(server_base_path: &Path, test: F) where F: FnOnce(Client) -> Fut, Fut: Future, { - // Setup s3-server. - let fs = FileSystem::new(server_base_path).unwrap(); - let mut auth = SimpleAuth::new(); - auth.register(String::from("access_key"), String::from("secret_key")); - let mut service = S3Service::new(fs); - service.set_auth(auth); - - // Spawn hyper Server instance. - let service = service.into_shared(); - let listener = TcpListener::bind(("localhost", 0)).unwrap(); - let bound_addr = format!("http://localhost:{}", listener.local_addr().unwrap().port()); - let make_service: _ = - make_service_fn(move |_| future::ready(Ok::<_, anyhow::Error>(service.clone()))); - tokio::spawn(Server::from_tcp(listener).unwrap().serve(make_service)); - - // Create S3Config. - let config = SdkConfig::builder() - .region(Region::new("ap-southeast-2")) - .credentials_provider(SharedCredentialsProvider::new(Credentials::from_keys( - "access_key", - "secret_key", - None, - ))) - .build(); - let ep = Endpoint::immutable(bound_addr).unwrap(); - let s3_conf = aws_sdk_s3::config::Builder::from(&config) - .endpoint_resolver(ep) - .build(); - - test(Client::from_conf(s3_conf)); - } + static CONFIG: Lazy = Lazy::new(|| { + let cred = Credentials::for_tests(); + + let conn = { + fs::create_dir_all(FS_ROOT).unwrap(); + let fs = s3s_fs::FileSystem::new(FS_ROOT).unwrap(); + + let auth = s3s::SimpleAuth::from_single(cred.access_key_id(), cred.secret_access_key()); + + let mut service = S3Service::new(Box::new(fs)); + service.set_auth(Box::new(auth)); + service.set_base_domain(DOMAIN_NAME); + + s3s_aws::Connector::from(service.into_shared()) + }; + + SdkConfig::builder() + .credentials_provider(SharedCredentialsProvider::new(cred)) + .http_connector(conn) + .region(Region::new(REGION)) + .endpoint_url(format!("http://{DOMAIN_NAME}")) + .build() + }); + &CONFIG + } async fn with_aws_s3_storage(test: F) where From 7c45b1f93301c75c40150382f012e93a7c716eb4 Mon Sep 17 00:00:00 2001 From: Roman Valls Guimera Date: Wed, 1 Feb 2023 17:01:46 +1100 Subject: [PATCH 02/10] Why are tests passing locally?? :thinking_face: /cc @mmalenic --- Cargo.lock | 473 +++++++------------------------ htsget-search/Cargo.toml | 9 +- htsget-search/src/storage/aws.rs | 18 +- 3 files changed, 110 insertions(+), 390 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bdee81c04..75e0588de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -367,17 +367,17 @@ version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c3d1e2a1f1ab3ac6c4b884e37413eaa03eb9d901e4fc68ee8f5c1d49721680e" dependencies = [ - "aws-credential-types 0.54.1", - "aws-http 0.54.1", + "aws-credential-types", + "aws-http", "aws-sdk-sso", "aws-sdk-sts", - "aws-smithy-async 0.54.1", - "aws-smithy-client 0.54.1", - "aws-smithy-http 0.54.1", - "aws-smithy-http-tower 0.54.1", - "aws-smithy-json 0.54.1", - "aws-smithy-types 0.54.1", - "aws-types 0.54.1", + "aws-smithy-async", + "aws-smithy-client", + "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-json", + "aws-smithy-types", + "aws-types", "bytes", "hex", "http", @@ -390,89 +390,43 @@ dependencies = [ "zeroize", ] -[[package]] -name = "aws-credential-types" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f99dd587a46af58f8cf37773687ecec19d0373a5954942d7e0f405751fe2369" -dependencies = [ - "aws-smithy-async 0.53.1", - "aws-smithy-types 0.53.1", - "tokio", - "tracing", - "zeroize", -] - [[package]] name = "aws-credential-types" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0696a0523a39a19087747e4dafda0362dc867531e3d72a3f195564c84e5e08" dependencies = [ - "aws-smithy-async 0.54.1", - "aws-smithy-types 0.54.1", + "aws-smithy-async", + "aws-smithy-types", "tokio", "tracing", "zeroize", ] -[[package]] -name = "aws-endpoint" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fdfc00c57d95e10bcf83d2331c4ae9ca460ca84dc983b2cdd692de87640389" -dependencies = [ - "aws-smithy-http 0.53.1", - "aws-smithy-types 0.53.1", - "aws-types 0.53.0", - "http", - "regex", - "tracing", -] - [[package]] name = "aws-endpoint" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80a4f935ab6a1919fbfd6102a80c4fccd9ff5f47f94ba154074afe1051903261" dependencies = [ - "aws-smithy-http 0.54.1", - "aws-smithy-types 0.54.1", - "aws-types 0.54.1", + "aws-smithy-http", + "aws-smithy-types", + "aws-types", "http", "regex", "tracing", ] -[[package]] -name = "aws-http" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74cdac70481d144bf7001c27884b95ee12c8f62e61db90320d59b673ae121cb8" -dependencies = [ - "aws-credential-types 0.53.0", - "aws-smithy-http 0.53.1", - "aws-smithy-types 0.53.1", - "aws-types 0.53.0", - "bytes", - "http", - "http-body", - "lazy_static", - "percent-encoding", - "pin-project-lite", - "tracing", -] - [[package]] name = "aws-http" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82976ca4e426ee9ca3ffcf919d9b2c8d14d0cd80d43cc02173737a8f07f28d4d" dependencies = [ - "aws-credential-types 0.54.1", - "aws-smithy-http 0.54.1", - "aws-smithy-types 0.54.1", - "aws-types 0.54.1", + "aws-credential-types", + "aws-smithy-http", + "aws-smithy-types", + "aws-types", "bytes", "http", "http-body", @@ -482,62 +436,27 @@ dependencies = [ "tracing", ] -[[package]] -name = "aws-sdk-s3" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ae411cb03ea6df0d4c4340a0d3c15cab7b19715d091f76c5629f31acd6403f3" -dependencies = [ - "aws-credential-types 0.53.0", - "aws-endpoint 0.53.0", - "aws-http 0.53.0", - "aws-sig-auth 0.53.0", - "aws-sigv4 0.53.0", - "aws-smithy-async 0.53.1", - "aws-smithy-checksums 0.53.1", - "aws-smithy-client 0.53.1", - "aws-smithy-eventstream 0.53.1", - "aws-smithy-http 0.53.1", - "aws-smithy-http-tower 0.53.1", - "aws-smithy-json 0.53.1", - "aws-smithy-types 0.53.1", - "aws-smithy-xml 0.53.1", - "aws-types 0.53.0", - "bytes", - "bytes-utils", - "fastrand", - "http", - "http-body", - "once_cell", - "percent-encoding", - "regex", - "tokio-stream", - "tower", - "tracing", - "url", -] - [[package]] name = "aws-sdk-s3" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1533be023eeac69668eb718b1c48af7bd5e26305ed770553d2877ab1f7507b68" dependencies = [ - "aws-credential-types 0.54.1", - "aws-endpoint 0.54.1", - "aws-http 0.54.1", - "aws-sig-auth 0.54.1", - "aws-sigv4 0.54.1", - "aws-smithy-async 0.54.1", - "aws-smithy-checksums 0.54.1", - "aws-smithy-client 0.54.1", - "aws-smithy-eventstream 0.54.1", - "aws-smithy-http 0.54.1", - "aws-smithy-http-tower 0.54.1", - "aws-smithy-json 0.54.1", - "aws-smithy-types 0.54.1", - "aws-smithy-xml 0.54.1", - "aws-types 0.54.1", + "aws-credential-types", + "aws-endpoint", + "aws-http", + "aws-sig-auth", + "aws-sigv4", + "aws-smithy-async", + "aws-smithy-checksums", + "aws-smithy-client", + "aws-smithy-eventstream", + "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-json", + "aws-smithy-types", + "aws-smithy-xml", + "aws-types", "bytes", "bytes-utils", "fastrand", @@ -558,17 +477,17 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca0119bacf0c42f587506769390983223ba834e605f049babe514b2bd646dbb2" dependencies = [ - "aws-credential-types 0.54.1", - "aws-endpoint 0.54.1", - "aws-http 0.54.1", - "aws-sig-auth 0.54.1", - "aws-smithy-async 0.54.1", - "aws-smithy-client 0.54.1", - "aws-smithy-http 0.54.1", - "aws-smithy-http-tower 0.54.1", - "aws-smithy-json 0.54.1", - "aws-smithy-types 0.54.1", - "aws-types 0.54.1", + "aws-credential-types", + "aws-endpoint", + "aws-http", + "aws-sig-auth", + "aws-smithy-async", + "aws-smithy-client", + "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-json", + "aws-smithy-types", + "aws-types", "bytes", "http", "regex", @@ -582,19 +501,19 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "270b6a33969ebfcb193512fbd5e8ee5306888ad6c6d5d775cdbfb2d50d94de26" dependencies = [ - "aws-credential-types 0.54.1", - "aws-endpoint 0.54.1", - "aws-http 0.54.1", - "aws-sig-auth 0.54.1", - "aws-smithy-async 0.54.1", - "aws-smithy-client 0.54.1", - "aws-smithy-http 0.54.1", - "aws-smithy-http-tower 0.54.1", - "aws-smithy-json 0.54.1", + "aws-credential-types", + "aws-endpoint", + "aws-http", + "aws-sig-auth", + "aws-smithy-async", + "aws-smithy-client", + "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-json", "aws-smithy-query", - "aws-smithy-types 0.54.1", - "aws-smithy-xml 0.54.1", - "aws-types 0.54.1", + "aws-smithy-types", + "aws-smithy-xml", + "aws-types", "bytes", "http", "regex", @@ -602,65 +521,29 @@ dependencies = [ "tracing", ] -[[package]] -name = "aws-sig-auth" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22af7f6515f8b51dabef87df1d901c9734e4e367791c6d0e1082f9f31528120e" -dependencies = [ - "aws-credential-types 0.53.0", - "aws-sigv4 0.53.0", - "aws-smithy-eventstream 0.53.1", - "aws-smithy-http 0.53.1", - "aws-types 0.53.0", - "http", - "tracing", -] - [[package]] name = "aws-sig-auth" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "660a02a98ab1af83bd8d714afbab2d502ba9b18c49e7e4cddd6bf8837ff778cb" dependencies = [ - "aws-credential-types 0.54.1", - "aws-sigv4 0.54.1", - "aws-smithy-eventstream 0.54.1", - "aws-smithy-http 0.54.1", - "aws-types 0.54.1", + "aws-credential-types", + "aws-sigv4", + "aws-smithy-eventstream", + "aws-smithy-http", + "aws-types", "http", "tracing", ] -[[package]] -name = "aws-sigv4" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee0d796882321e91ca7b991ab6193864e04b605be3a6c18adb9134a90d5a860" -dependencies = [ - "aws-smithy-eventstream 0.53.1", - "aws-smithy-http 0.53.1", - "bytes", - "form_urlencoded", - "hex", - "hmac", - "http", - "once_cell", - "percent-encoding", - "regex", - "sha2", - "time", - "tracing", -] - [[package]] name = "aws-sigv4" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdaf11005b7444e6cd66f600d09861a3aeb6eb89a0f003c7c9820dbab2d15297" dependencies = [ - "aws-smithy-eventstream 0.54.1", - "aws-smithy-http 0.54.1", + "aws-smithy-eventstream", + "aws-smithy-http", "bytes", "form_urlencoded", "hex", @@ -674,18 +557,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "aws-smithy-async" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b9900be224962d65a626072d8777f847ae5406c07547f0dc14c60048978c4b" -dependencies = [ - "futures-util", - "pin-project-lite", - "tokio", - "tokio-stream", -] - [[package]] name = "aws-smithy-async" version = "0.54.1" @@ -698,35 +569,14 @@ dependencies = [ "tokio-stream", ] -[[package]] -name = "aws-smithy-checksums" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e9e4d3c2296bcec2c03f9f769ac9b2424d972c2fe7afc0b59235447ac3a5c3" -dependencies = [ - "aws-smithy-http 0.53.1", - "aws-smithy-types 0.53.1", - "bytes", - "crc32c", - "crc32fast", - "hex", - "http", - "http-body", - "md-5", - "pin-project-lite", - "sha1", - "sha2", - "tracing", -] - [[package]] name = "aws-smithy-checksums" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55fe82d7463becdd632f8c6446cbdb2cbe34ad42a7d92c480d8fca08749d07a4" dependencies = [ - "aws-smithy-http 0.54.1", - "aws-smithy-types 0.54.1", + "aws-smithy-http", + "aws-smithy-types", "bytes", "crc32c", "crc32fast", @@ -740,40 +590,17 @@ dependencies = [ "tracing", ] -[[package]] -name = "aws-smithy-client" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710ca0f8dacddda5fbcaf5c3cd9d02da7913fd463a2ee9555b617bf168bedacb" -dependencies = [ - "aws-smithy-async 0.53.1", - "aws-smithy-http 0.53.1", - "aws-smithy-http-tower 0.53.1", - "aws-smithy-types 0.53.1", - "bytes", - "fastrand", - "http", - "http-body", - "hyper", - "hyper-rustls", - "lazy_static", - "pin-project-lite", - "tokio", - "tower", - "tracing", -] - [[package]] name = "aws-smithy-client" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17d44078855a64d757e5c1727df29ffa6679022c38cfc4ba4e63ee9567133141" dependencies = [ - "aws-smithy-async 0.54.1", - "aws-smithy-http 0.54.1", - "aws-smithy-http-tower 0.54.1", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-http-tower", "aws-smithy-protocol-test", - "aws-smithy-types 0.54.1", + "aws-smithy-types", "bytes", "fastrand", "http", @@ -788,59 +615,25 @@ dependencies = [ "tracing", ] -[[package]] -name = "aws-smithy-eventstream" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d1ff11ee22de3581114b60d4ae8e700638dacb5b5bbe6769726e251e6c3f20a" -dependencies = [ - "aws-smithy-types 0.53.1", - "bytes", - "crc32fast", -] - [[package]] name = "aws-smithy-eventstream" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "652a99272024770cbe33579dc0016914a09922b27f9a4d12f37472aacbbe71c1" dependencies = [ - "aws-smithy-types 0.54.1", + "aws-smithy-types", "bytes", "crc32fast", ] -[[package]] -name = "aws-smithy-http" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29dcab29afbea7726f5c10c7be0c38666d7eb07db551580b3b26ed7cfb5d1935" -dependencies = [ - "aws-smithy-eventstream 0.53.1", - "aws-smithy-types 0.53.1", - "bytes", - "bytes-utils", - "futures-core", - "http", - "http-body", - "hyper", - "once_cell", - "percent-encoding", - "pin-project-lite", - "pin-utils", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "aws-smithy-http" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5bd86f48d7e36fb24ee922d04d79c8353e01724b1c38757ed92593179223aa7" dependencies = [ - "aws-smithy-eventstream 0.54.1", - "aws-smithy-types 0.54.1", + "aws-smithy-eventstream", + "aws-smithy-types", "bytes", "bytes-utils", "futures-core", @@ -856,30 +649,14 @@ dependencies = [ "tracing", ] -[[package]] -name = "aws-smithy-http-tower" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5856d2f1063c0f726a85f32dcd2a9f5a1d994eb27b156abccafc7260f3f471d" -dependencies = [ - "aws-smithy-http 0.53.1", - "aws-smithy-types 0.53.1", - "bytes", - "http", - "http-body", - "pin-project-lite", - "tower", - "tracing", -] - [[package]] name = "aws-smithy-http-tower" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8972d1b4ae3aba1a10e7106fed53a5a36bc8ef86170a84f6ddd33d36fac12ad" dependencies = [ - "aws-smithy-http 0.54.1", - "aws-smithy-types 0.54.1", + "aws-smithy-http", + "aws-smithy-types", "bytes", "http", "http-body", @@ -888,22 +665,13 @@ dependencies = [ "tracing", ] -[[package]] -name = "aws-smithy-json" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb33659b68480495b5f906b946c8642928440118b1d7e26a25a067303ca01a5" -dependencies = [ - "aws-smithy-types 0.53.1", -] - [[package]] name = "aws-smithy-json" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18973f12721e27b54891386497a57e1ba09975df1c6cfeccafaf541198962aef" dependencies = [ - "aws-smithy-types 0.54.1", + "aws-smithy-types", ] [[package]] @@ -927,23 +695,10 @@ version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2881effde104a2b0619badaad9f30ae67805e86fbbdb99e5fcc176e8bfbc1a85" dependencies = [ - "aws-smithy-types 0.54.1", + "aws-smithy-types", "urlencoding", ] -[[package]] -name = "aws-smithy-types" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2013465a070decdeb3e85ceb3370ae85ba05f56f914abfd89858d7281c4f12c3" -dependencies = [ - "base64-simd 0.7.0", - "itoa", - "num-integer", - "ryu", - "time", -] - [[package]] name = "aws-smithy-types" version = "0.54.1" @@ -959,23 +714,14 @@ dependencies = [ [[package]] name = "aws-smithy-types-convert" -version = "0.53.1" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d57b2ac4dc27cfa3671cc8aa7ab5eaff3ef98f87dfa699f33dd556506fd8edc" +checksum = "6bbb74aa6624efd9c6d1a2c6e1740ea52d4ff57a3f1ab55c5e1f7015ebbe6298" dependencies = [ - "aws-smithy-types 0.53.1", + "aws-smithy-types", "time", ] -[[package]] -name = "aws-smithy-xml" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d27bfaa164aa94aac721726a83aa78abe708a275e88a573e103b4961c5f0ede" -dependencies = [ - "xmlparser", -] - [[package]] name = "aws-smithy-xml" version = "0.54.1" @@ -985,33 +731,17 @@ dependencies = [ "xmlparser", ] -[[package]] -name = "aws-types" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f00f4b0cdd345686e6389f3343a3020f93232d20040802b87673ddc2d02956" -dependencies = [ - "aws-credential-types 0.53.0", - "aws-smithy-async 0.53.1", - "aws-smithy-client 0.53.1", - "aws-smithy-http 0.53.1", - "aws-smithy-types 0.53.1", - "http", - "rustc_version", - "tracing", -] - [[package]] name = "aws-types" version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8f15b34253b68cde08e39b0627cc6101bcca64351229484b4743392c035d057" dependencies = [ - "aws-credential-types 0.54.1", - "aws-smithy-async 0.54.1", - "aws-smithy-client 0.54.1", - "aws-smithy-http 0.54.1", - "aws-smithy-types 0.54.1", + "aws-credential-types", + "aws-smithy-async", + "aws-smithy-client", + "aws-smithy-http", + "aws-smithy-types", "http", "rustc_version", "tracing", @@ -1116,12 +846,6 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" -[[package]] -name = "base64" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" - [[package]] name = "base64-simd" version = "0.7.0" @@ -2034,12 +1758,12 @@ dependencies = [ "anyhow", "async-trait", "aws-config", - "aws-credential-types 0.54.1", - "aws-sdk-s3 0.24.0", - "aws-types 0.54.1", + "aws-credential-types", + "aws-sdk-s3", + "aws-types", "axum", "axum-extra", - "base64 0.21.0", + "base64 0.20.0", "bytes", "criterion", "data-url", @@ -3359,9 +3083,8 @@ checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "s3s" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1490e3d6b7f9446b23870e0c485b17e73716f4b3060494dbeae0c542dd2e8e5" +version = "0.2.1-dev" +source = "git+https://github.com/Nugine/s3s#9ad83025580bf1880527c6b2f09195b0550245b0" dependencies = [ "arrayvec", "ascii", @@ -3394,14 +3117,13 @@ dependencies = [ [[package]] name = "s3s-aws" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305f723fb3361c41de794595211ed4eb38b36d7ca5a814268ad6a323f6ea9969" +version = "0.2.1-dev" +source = "git+https://github.com/Nugine/s3s#9ad83025580bf1880527c6b2f09195b0550245b0" dependencies = [ "async-trait", - "aws-sdk-s3 0.23.0", - "aws-smithy-http 0.53.1", - "aws-smithy-types 0.53.1", + "aws-sdk-s3", + "aws-smithy-http", + "aws-smithy-types", "aws-smithy-types-convert", "bytes", "futures", @@ -3412,9 +3134,8 @@ dependencies = [ [[package]] name = "s3s-fs" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d345eb5e48cfb6b97fd549c4b22bcbadf6fe8bdec68d12ff8b780842d9df3c5" +version = "0.2.1-dev" +source = "git+https://github.com/Nugine/s3s#9ad83025580bf1880527c6b2f09195b0550245b0" dependencies = [ "async-trait", "base64-simd 0.8.0", diff --git a/htsget-search/Cargo.toml b/htsget-search/Cargo.toml index 033b80982..6460e7e3d 100644 --- a/htsget-search/Cargo.toml +++ b/htsget-search/Cargo.toml @@ -48,9 +48,8 @@ aws-config = { version = "0.54", optional = true } thiserror = "1.0" htsget-config = { version = "0.1.1", path = "../htsget-config", default-features = false } tracing = "0.1" -base64 = "0.21" +base64 = "0.20" serde = "1.0" -aws-credential-types = "0.54.1" [dev-dependencies] htsget-test = { version = "0.1.1", path = "../htsget-test", features = ["cors-tests"], default-features = false } @@ -62,9 +61,9 @@ once_cell = "1.17" anyhow = "1.0" aws-types = { version = "0.54" } aws-credential-types = { version = "0.54", features = ["test-util"] } -s3s = "0.2.0" -s3s-fs = { version = "0.2" } -s3s-aws = { version = "0.2" } +s3s = { version = "0.2.1-dev", git = "https://github.com/Nugine/s3s" } +s3s-fs = { version = "0.2.1-dev", git = "https://github.com/Nugine/s3s" } +s3s-aws = { version = "0.2.1-dev", git = "https://github.com/Nugine/s3s" } # Axum server reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] } diff --git a/htsget-search/src/storage/aws.rs b/htsget-search/src/storage/aws.rs index 44e0dc21e..2c66d69a4 100644 --- a/htsget-search/src/storage/aws.rs +++ b/htsget-search/src/storage/aws.rs @@ -222,7 +222,6 @@ mod tests { use std::env; use std::fs; use std::future::Future; - use std::net::TcpListener; use std::path::Path; use once_cell::sync::Lazy; @@ -230,9 +229,8 @@ mod tests { use s3s::service::S3Service; use aws_credential_types::provider::SharedCredentialsProvider; - use aws_sdk_s3::{Client, Credentials}; + use aws_sdk_s3::{Region, Client, Credentials}; use aws_config::SdkConfig; - use aws_sdk_s3::Region; use crate::htsget::Headers; use crate::storage::aws::AwsS3Storage; @@ -240,15 +238,16 @@ mod tests { use crate::storage::StorageError; use crate::storage::{BytesPosition, GetOptions, RangeUrlOptions, Storage}; - const FS_ROOT: &str = concat!(env!("CARGO_TARGET_TMPDIR"), "/s3s-fs-tests-aws"); - const DOMAIN_NAME: &str = "localhost:8014"; - const REGION: &str = "us-west-2"; - async fn with_s3_test_server(server_base_path: &Path, test: F) + async fn with_s3_test_server(_server_base_path: &Path, _test: F) where F: FnOnce(Client) -> Fut, Fut: Future, { + const FS_ROOT: &str = concat!(env!("CARGO_TARGET_TMPDIR"), "/s3s-fs-tests-aws"); + const DOMAIN_NAME: &str = "localhost:8014"; + const REGION: &str = "ap-southeast-2"; + static CONFIG: Lazy = Lazy::new(|| { let cred = Credentials::for_tests(); @@ -272,8 +271,9 @@ mod tests { .endpoint_url(format!("http://{DOMAIN_NAME}")) .build() }); - &CONFIG - } + //&CONFIG + () + } async fn with_aws_s3_storage(test: F) where From 0c7af54f12b389c29ce0ef9e578975a1b0b9c3f5 Mon Sep 17 00:00:00 2001 From: Roman Valls Guimera Date: Thu, 2 Feb 2023 16:54:25 +1100 Subject: [PATCH 03/10] Apply suggestions from @mmalenic on PR review --- htsget-search/src/storage/aws.rs | 38 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htsget-search/src/storage/aws.rs b/htsget-search/src/storage/aws.rs index 2c66d69a4..cde3339d5 100644 --- a/htsget-search/src/storage/aws.rs +++ b/htsget-search/src/storage/aws.rs @@ -239,7 +239,7 @@ mod tests { use crate::storage::{BytesPosition, GetOptions, RangeUrlOptions, Storage}; - async fn with_s3_test_server(_server_base_path: &Path, _test: F) + async fn with_s3_test_server(server_base_path: &Path, test: F) where F: FnOnce(Client) -> Fut, Fut: Future, @@ -248,29 +248,29 @@ mod tests { const DOMAIN_NAME: &str = "localhost:8014"; const REGION: &str = "ap-southeast-2"; - static CONFIG: Lazy = Lazy::new(|| { - let cred = Credentials::for_tests(); + let cred = Credentials::for_tests(); - let conn = { - fs::create_dir_all(FS_ROOT).unwrap(); - let fs = s3s_fs::FileSystem::new(FS_ROOT).unwrap(); + let conn = { + fs::create_dir_all(FS_ROOT).unwrap(); + let fs = s3s_fs::FileSystem::new(FS_ROOT).unwrap(); - let auth = s3s::SimpleAuth::from_single(cred.access_key_id(), cred.secret_access_key()); + let auth = s3s::SimpleAuth::from_single(cred.access_key_id(), cred.secret_access_key()); - let mut service = S3Service::new(Box::new(fs)); - service.set_auth(Box::new(auth)); - service.set_base_domain(DOMAIN_NAME); + let mut service = S3Service::new(Box::new(fs)); + service.set_auth(Box::new(auth)); + service.set_base_domain(DOMAIN_NAME); - s3s_aws::Connector::from(service.into_shared()) - }; + s3s_aws::Connector::from(service.into_shared()) + }; + + let sdk_config = SdkConfig::builder() + .credentials_provider(SharedCredentialsProvider::new(cred)) + .http_connector(conn) + .region(Region::new(REGION)) + .endpoint_url(format!("http://{DOMAIN_NAME}")) + .build(); + test(Client::new(&sdk_config)).await; - SdkConfig::builder() - .credentials_provider(SharedCredentialsProvider::new(cred)) - .http_connector(conn) - .region(Region::new(REGION)) - .endpoint_url(format!("http://{DOMAIN_NAME}")) - .build() - }); //&CONFIG () } From a851a03fce4ade0bc96d8ea3b0ab2039d866cd35 Mon Sep 17 00:00:00 2001 From: Roman Valls Guimera Date: Thu, 2 Feb 2023 16:58:59 +1100 Subject: [PATCH 04/10] Bump up s3s-* crates as suggested in https://github.com/umccr/htsget-rs/issues/131#issuecomment-1413125841 --- Cargo.lock | 40 ++++++++++++++++++++++++++++------------ htsget-search/Cargo.toml | 6 +++--- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 75e0588de..36b91a15f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1507,9 +1507,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" @@ -3083,8 +3083,9 @@ checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "s3s" -version = "0.2.1-dev" -source = "git+https://github.com/Nugine/s3s#9ad83025580bf1880527c6b2f09195b0550245b0" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6596d170fa7fcd45c5ebe610071ef4216fd3947a94be34e26326a78dde00e01" dependencies = [ "arrayvec", "ascii", @@ -3092,7 +3093,9 @@ dependencies = [ "atoi", "base64-simd 0.8.0", "bytes", + "bytestring", "chrono", + "crc32fast", "futures", "hex-simd", "hmac", @@ -3111,14 +3114,15 @@ dependencies = [ "thiserror", "time", "tracing", - "transform-stream", + "transform-stream 0.3.0", "urlencoding", ] [[package]] name = "s3s-aws" -version = "0.2.1-dev" -source = "git+https://github.com/Nugine/s3s#9ad83025580bf1880527c6b2f09195b0550245b0" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24a13a8b28804752bba22abf0ea9372e994738d955596233c58fbc05947c43a0" dependencies = [ "async-trait", "aws-sdk-s3", @@ -3129,13 +3133,16 @@ dependencies = [ "futures", "hyper", "s3s", + "sync_wrapper", "tracing", + "transform-stream 0.3.0", ] [[package]] name = "s3s-fs" -version = "0.2.1-dev" -source = "git+https://github.com/Nugine/s3s#9ad83025580bf1880527c6b2f09195b0550245b0" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81932e78cde8e00a1f4a9c2258132c6aac49c4d137210fb77d2ab2bf9eeafab" dependencies = [ "async-trait", "base64-simd 0.8.0", @@ -3155,7 +3162,7 @@ dependencies = [ "tokio-util", "tracing", "tracing-error", - "transform-stream", + "transform-stream 0.2.0", "uuid", ] @@ -3430,9 +3437,9 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "tempfile" @@ -3769,6 +3776,15 @@ dependencies = [ "futures-core", ] +[[package]] +name = "transform-stream" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05034de7a8fcb11796a36478a2a8b16dca6772644dec5f49f709d5c66a38d359" +dependencies = [ + "futures-core", +] + [[package]] name = "try-lock" version = "0.2.3" diff --git a/htsget-search/Cargo.toml b/htsget-search/Cargo.toml index 6460e7e3d..3f60d6261 100644 --- a/htsget-search/Cargo.toml +++ b/htsget-search/Cargo.toml @@ -61,9 +61,9 @@ once_cell = "1.17" anyhow = "1.0" aws-types = { version = "0.54" } aws-credential-types = { version = "0.54", features = ["test-util"] } -s3s = { version = "0.2.1-dev", git = "https://github.com/Nugine/s3s" } -s3s-fs = { version = "0.2.1-dev", git = "https://github.com/Nugine/s3s" } -s3s-aws = { version = "0.2.1-dev", git = "https://github.com/Nugine/s3s" } +s3s = { version = "0.3" } +s3s-fs = { version = "0.3" } +s3s-aws = { version = "0.3" } # Axum server reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] } From 7e3feb81889858d2248493a05e2648f587daeb15 Mon Sep 17 00:00:00 2001 From: Marko Malenic Date: Fri, 3 Feb 2023 08:54:18 +1100 Subject: [PATCH 05/10] test(search): fix tests related to improperly formatted `folder` in URLs for S3 mock filesystem --- htsget-search/src/storage/aws.rs | 58 ++++++++++++-------------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/htsget-search/src/storage/aws.rs b/htsget-search/src/storage/aws.rs index cde3339d5..42f071e53 100644 --- a/htsget-search/src/storage/aws.rs +++ b/htsget-search/src/storage/aws.rs @@ -219,18 +219,15 @@ impl Storage for AwsS3Storage { #[cfg(test)] mod tests { - use std::env; - use std::fs; use std::future::Future; use std::path::Path; - use once_cell::sync::Lazy; - use s3s_aws; use s3s::service::S3Service; + use s3s_aws; - use aws_credential_types::provider::SharedCredentialsProvider; - use aws_sdk_s3::{Region, Client, Credentials}; use aws_config::SdkConfig; + use aws_credential_types::provider::SharedCredentialsProvider; + use aws_sdk_s3::{Client, Credentials, Region}; use crate::htsget::Headers; use crate::storage::aws::AwsS3Storage; @@ -238,41 +235,36 @@ mod tests { use crate::storage::StorageError; use crate::storage::{BytesPosition, GetOptions, RangeUrlOptions, Storage}; - async fn with_s3_test_server(server_base_path: &Path, test: F) where F: FnOnce(Client) -> Fut, Fut: Future, { - const FS_ROOT: &str = concat!(env!("CARGO_TARGET_TMPDIR"), "/s3s-fs-tests-aws"); const DOMAIN_NAME: &str = "localhost:8014"; const REGION: &str = "ap-southeast-2"; - + let cred = Credentials::for_tests(); let conn = { - fs::create_dir_all(FS_ROOT).unwrap(); - let fs = s3s_fs::FileSystem::new(FS_ROOT).unwrap(); + let fs = s3s_fs::FileSystem::new(server_base_path).unwrap(); - let auth = s3s::SimpleAuth::from_single(cred.access_key_id(), cred.secret_access_key()); + let auth = s3s::SimpleAuth::from_single(cred.access_key_id(), cred.secret_access_key()); - let mut service = S3Service::new(Box::new(fs)); - service.set_auth(Box::new(auth)); - service.set_base_domain(DOMAIN_NAME); + let mut service = S3Service::new(Box::new(fs)); + service.set_auth(Box::new(auth)); + service.set_base_domain(DOMAIN_NAME); - s3s_aws::Connector::from(service.into_shared()) + s3s_aws::Connector::from(service.into_shared()) }; let sdk_config = SdkConfig::builder() - .credentials_provider(SharedCredentialsProvider::new(cred)) - .http_connector(conn) - .region(Region::new(REGION)) - .endpoint_url(format!("http://{DOMAIN_NAME}")) - .build(); - test(Client::new(&sdk_config)).await; - - //&CONFIG - () + .credentials_provider(SharedCredentialsProvider::new(cred)) + .http_connector(conn) + .region(Region::new(REGION)) + .endpoint_url(format!("http://{DOMAIN_NAME}")) + .build(); + + test(Client::new(&sdk_config)).await; } async fn with_aws_s3_storage(test: F) @@ -282,7 +274,7 @@ mod tests { { let (folder_name, base_path) = create_local_test_files().await; with_s3_test_server(base_path.path(), |client| async move { - test(AwsS3Storage::new(client, folder_name)); + test(AwsS3Storage::new(client, folder_name)).await; }) .await; } @@ -323,9 +315,7 @@ mod tests { .range_url("key2", RangeUrlOptions::default()) .await .unwrap(); - assert!(result - .url - .starts_with(&format!("http://localhost:8014/{}/{}", "folder", "key2"))); + assert!(result.url.starts_with("http://folder.localhost:8014/key2")); assert!(result.url.contains(&format!( "Amz-Expires={}", AwsS3Storage::PRESIGNED_REQUEST_EXPIRY @@ -344,9 +334,7 @@ mod tests { ) .await .unwrap(); - assert!(result - .url - .starts_with(&format!("http://localhost:8014/{}/{}", "folder", "key2"))); + assert!(result.url.starts_with("http://folder.localhost:8014/key2")); assert!(result.url.contains(&format!( "Amz-Expires={}", AwsS3Storage::PRESIGNED_REQUEST_EXPIRY @@ -354,7 +342,7 @@ mod tests { assert!(result.url.contains("range")); assert_eq!( result.headers, - Some(Headers::default().with_header("Range", "bytes=7-9")) + Some(Headers::default().with_header("Range", "bytes=7-8")) ); }) .await; @@ -370,9 +358,7 @@ mod tests { ) .await .unwrap(); - assert!(result - .url - .starts_with(&format!("http://localhost:8014/{}/{}", "folder", "key2"))); + assert!(result.url.starts_with("http://folder.localhost:8014/key2")); assert!(result.url.contains(&format!( "Amz-Expires={}", AwsS3Storage::PRESIGNED_REQUEST_EXPIRY From 2b10b770b82503b455e377a19e0ff5f14be5ebb3 Mon Sep 17 00:00:00 2001 From: Marko Malenic Date: Fri, 3 Feb 2023 09:50:09 +1100 Subject: [PATCH 06/10] fix(search): check that a key exists before formatting a URL, ensuring that pre-signed URLs are not generated for non-existent keys --- htsget-search/src/htsget/search.rs | 9 +++++++++ htsget-search/src/storage/aws.rs | 17 +++++------------ htsget-search/src/storage/mod.rs | 3 ++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/htsget-search/src/htsget/search.rs b/htsget-search/src/htsget/search.rs index fe3f275aa..1513bf90e 100644 --- a/htsget-search/src/htsget/search.rs +++ b/htsget-search/src/htsget/search.rs @@ -269,6 +269,12 @@ where self.build_response(&query, blocks).await } Class::Header => { + // Check to see if the key exists. + self + .get_storage() + .head(query.format().fmt_file(query.id())) + .await?; + let index = self.read_index(&query).await?; let header_byte_ranges = self.get_byte_ranges_for_header(&index).await?; @@ -292,6 +298,7 @@ where DataBlock::Range(range) => { let storage = self.get_storage(); let query_owned = query.clone(); + storage_futures.push_back(tokio::spawn(async move { storage .range_url( @@ -306,6 +313,7 @@ where } } } + let mut urls = Vec::new(); loop { select! { @@ -313,6 +321,7 @@ where else => break } } + return Ok(Response::new(query.format(), urls)); } diff --git a/htsget-search/src/storage/aws.rs b/htsget-search/src/storage/aws.rs index 42f071e53..4926d7028 100644 --- a/htsget-search/src/storage/aws.rs +++ b/htsget-search/src/storage/aws.rs @@ -53,6 +53,8 @@ impl AwsS3Storage { AwsS3Storage::new(Client::new(&aws_config::load_from_env().await), bucket) } + /// Return an S3 pre-signed URL of the key. This function does not check that the key exists, + /// so this should be checked before calling it. pub async fn s3_presign_url + Send>( &self, key: K, @@ -130,6 +132,7 @@ impl AwsS3Storage { } } + /// Get the key from S3 storage as a `ByteStream`. pub async fn get_content + Send>( &self, key: K, @@ -184,7 +187,8 @@ impl Storage for AwsS3Storage { self.create_stream_reader(key, options).await } - /// Returns a S3-presigned htsget URL + /// Return an S3 pre-signed htsget URL. This function does not check that the key exists, so this + /// should be checked before calling it. #[instrument(level = "trace", skip(self))] async fn range_url + Send + Debug>( &self, @@ -297,17 +301,6 @@ mod tests { .await; } - #[tokio::test] - async fn url_of_non_existing_key() { - with_aws_s3_storage(|storage| async move { - let result = storage - .range_url("non-existing-key", RangeUrlOptions::default()) - .await; - assert!(matches!(result, Err(StorageError::AwsS3Error(_, _)))); - }) - .await; - } - #[tokio::test] async fn url_of_existing_key() { with_aws_s3_storage(|storage| async move { diff --git a/htsget-search/src/storage/mod.rs b/htsget-search/src/storage/mod.rs index b8d61e71c..7510bfdc5 100644 --- a/htsget-search/src/storage/mod.rs +++ b/htsget-search/src/storage/mod.rs @@ -40,7 +40,8 @@ pub trait Storage { options: GetOptions, ) -> Result; - /// Get the url of the object represented by the key using a bytes range. + /// Get the url of the object represented by the key using a bytes range. It is not required for + /// this function to check for the existent of the key, so this should be ensured beforehand. async fn range_url + Send + Debug>( &self, key: K, From b5b4284154cda38c547536207dcc944354f03b3d Mon Sep 17 00:00:00 2001 From: Marko Malenic Date: Fri, 3 Feb 2023 13:15:16 +1100 Subject: [PATCH 07/10] fix(search): use KeyNotFound error when a key is not found --- htsget-search/src/htsget/bam_search.rs | 2 +- htsget-search/src/htsget/cram_search.rs | 3 ++- htsget-search/src/htsget/from_storage.rs | 5 +++-- htsget-search/src/htsget/mod.rs | 17 ++++++++++------- htsget-search/src/storage/aws.rs | 15 +++++++++++---- htsget-search/src/storage/data_server.rs | 5 +++-- htsget-search/src/storage/local.rs | 20 ++++++++++++++------ htsget-search/src/storage/mod.rs | 7 ++++--- 8 files changed, 48 insertions(+), 26 deletions(-) diff --git a/htsget-search/src/htsget/bam_search.rs b/htsget-search/src/htsget/bam_search.rs index c1bd7f883..b1b95a678 100644 --- a/htsget-search/src/htsget/bam_search.rs +++ b/htsget-search/src/htsget/bam_search.rs @@ -182,7 +182,7 @@ pub(crate) mod tests { with_local_storage as with_local_storage_path, with_local_storage_tmp as with_local_storage_tmp_path, }; - use crate::htsget::{Class::Body, Class::Header, Headers, Response, Url}; + use crate::htsget::{Class::Body, Class::Header, Headers, HtsGetError::NotFound, Response, Url}; use crate::storage::data_server::HttpTicketFormatter; use crate::storage::local::LocalStorage; diff --git a/htsget-search/src/htsget/cram_search.rs b/htsget-search/src/htsget/cram_search.rs index 91cd39074..bf1e73136 100644 --- a/htsget-search/src/htsget/cram_search.rs +++ b/htsget-search/src/htsget/cram_search.rs @@ -7,7 +7,6 @@ use std::sync::Arc; use async_trait::async_trait; use futures::StreamExt; use futures_util::stream::FuturesOrdered; -use htsget_config::Interval; use noodles::core::Position; use noodles::cram; use noodles::cram::crai; @@ -17,6 +16,8 @@ use tokio::io::{AsyncRead, BufReader}; use tokio::{io, select}; use tracing::{instrument, trace}; +use htsget_config::Interval; + use crate::htsget::search::{Search, SearchAll, SearchReads}; use crate::htsget::Class::Body; use crate::htsget::{Format, HtsGetError, Query, Result}; diff --git a/htsget-search/src/htsget/from_storage.rs b/htsget-search/src/htsget/from_storage.rs index fb7fdc214..18a35d7e2 100644 --- a/htsget-search/src/htsget/from_storage.rs +++ b/htsget-search/src/htsget/from_storage.rs @@ -5,11 +5,12 @@ use std::path::Path; use std::sync::Arc; use async_trait::async_trait; -use htsget_config::regex_resolver::{Resolver, StorageType}; use tokio::io::AsyncRead; use tracing::debug; use tracing::instrument; +use htsget_config::regex_resolver::{Resolver, StorageType}; + use crate::htsget::search::Search; use crate::htsget::{Format, HtsGetError}; #[cfg(feature = "s3-storage")] @@ -114,9 +115,9 @@ pub(crate) mod tests { use std::future::Future; use std::path::PathBuf; - use htsget_config::config::cors::CorsConfig; use tempfile::TempDir; + use htsget_config::config::cors::CorsConfig; use htsget_test::util::expected_bgzf_eof_data_url; use crate::htsget::bam_search::tests::{ diff --git a/htsget-search/src/htsget/mod.rs b/htsget-search/src/htsget/mod.rs index 842142ea7..fe6b54fb0 100644 --- a/htsget-search/src/htsget/mod.rs +++ b/htsget-search/src/htsget/mod.rs @@ -8,11 +8,12 @@ use std::io; use std::io::ErrorKind; use async_trait::async_trait; -use htsget_config::{Class, Format, Query}; use serde::{Deserialize, Serialize}; use thiserror::Error; use tokio::task::JoinError; +use htsget_config::{Class, Format, Query}; + use crate::storage::StorageError; pub mod bam_search; @@ -105,10 +106,10 @@ impl From for io::Error { impl From for HtsGetError { fn from(err: StorageError) -> Self { match err { - err @ (StorageError::InvalidKey(_) | StorageError::InvalidInput(_)) => { - Self::InvalidInput(err.to_string()) + err @ StorageError::InvalidInput(_) => Self::InvalidInput(err.to_string()), + err @ (StorageError::KeyNotFound(_) | StorageError::InvalidKey(_)) => { + Self::NotFound(err.to_string()) } - err @ StorageError::KeyNotFound(_) => Self::NotFound(err.to_string()), err @ StorageError::IoError(_, _) => Self::IoError(err.to_string()), err @ (StorageError::DataServerError(_) | StorageError::InvalidUri(_) @@ -230,10 +231,12 @@ impl Response { #[cfg(test)] mod tests { - use super::*; - use htsget_config::{Fields, NoTags, TaggedTypeAll, Tags}; use std::collections::HashSet; + use htsget_config::{Fields, NoTags, TaggedTypeAll, Tags}; + + use super::*; + #[test] fn htsget_error_not_found() { let result = HtsGetError::not_found("error"); @@ -285,7 +288,7 @@ mod tests { #[test] fn htsget_error_from_storage_invalid_key() { let result = HtsGetError::from(StorageError::InvalidKey("error".to_string())); - assert!(matches!(result, HtsGetError::InvalidInput(_))); + assert!(matches!(result, HtsGetError::NotFound(_))); } #[test] diff --git a/htsget-search/src/storage/aws.rs b/htsget-search/src/storage/aws.rs index 4926d7028..16c7b6a66 100644 --- a/htsget-search/src/storage/aws.rs +++ b/htsget-search/src/storage/aws.rs @@ -6,6 +6,7 @@ use std::time::Duration; use async_trait::async_trait; use aws_sdk_s3::client::fluent_builders; +use aws_sdk_s3::error::GetObjectErrorKind; use aws_sdk_s3::model::StorageClass; use aws_sdk_s3::output::HeadObjectOutput; use aws_sdk_s3::presigning::config::PresigningConfig; @@ -73,7 +74,14 @@ impl AwsS3Storage { .map_err(|err| AwsS3Error(err.to_string(), key.as_ref().to_string()))?, ) .await - .map_err(|err| AwsS3Error(err.to_string(), key.as_ref().to_string()))? + .map_err(|err| { + let err = err.into_service_error(); + if let GetObjectErrorKind::NoSuchKey(_) = err.kind { + StorageError::KeyNotFound(key.as_ref().to_string()) + } else { + AwsS3Error(err.to_string(), key.as_ref().to_string()) + } + })? .uri() .to_string(), ) @@ -226,12 +234,11 @@ mod tests { use std::future::Future; use std::path::Path; - use s3s::service::S3Service; - use s3s_aws; - use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; use aws_sdk_s3::{Client, Credentials, Region}; + use s3s::service::S3Service; + use s3s_aws; use crate::htsget::Headers; use crate::storage::aws::AwsS3Storage; diff --git a/htsget-search/src/storage/data_server.rs b/htsget-search/src/storage/data_server.rs index 62c85a41a..e94952120 100644 --- a/htsget-search/src/storage/data_server.rs +++ b/htsget-search/src/storage/data_server.rs @@ -15,8 +15,6 @@ use axum::http; use axum::Router; use axum_extra::routing::SpaRouter; use futures_util::future::poll_fn; -use htsget_config::config::cors::CorsConfig; -use htsget_config::config::DataServerConfig; use http::uri::Scheme; use hyper::server::accept::Accept; use hyper::server::conn::{AddrIncoming, Http}; @@ -29,6 +27,9 @@ use tower_http::trace::TraceLayer; use tracing::instrument; use tracing::{info, trace}; +use htsget_config::config::cors::CorsConfig; +use htsget_config::config::DataServerConfig; + use crate::storage::StorageError::{DataServerError, IoError}; use crate::storage::{configure_cors, UrlFormatter}; diff --git a/htsget-search/src/storage/local.rs b/htsget-search/src/storage/local.rs index e92cb6c7d..214c476b1 100644 --- a/htsget-search/src/storage/local.rs +++ b/htsget-search/src/storage/local.rs @@ -2,6 +2,7 @@ //! use std::fmt::Debug; +use std::io::ErrorKind; use std::path::{Path, PathBuf}; use async_trait::async_trait; @@ -45,7 +46,13 @@ impl LocalStorage { .base_path .join(key) .canonicalize() - .map_err(|_| StorageError::InvalidKey(key.to_string())) + .map_err(|err| { + if let ErrorKind::NotFound = err.kind() { + StorageError::KeyNotFound(key.to_string()) + } else { + StorageError::InvalidKey(key.to_string()) + } + }) .and_then(|path| { path .starts_with(&self.base_path) @@ -118,11 +125,12 @@ pub(crate) mod tests { use std::future::Future; use std::matches; - use htsget_config::config::cors::CorsConfig; use tempfile::TempDir; use tokio::fs::{create_dir, File}; use tokio::io::AsyncWriteExt; + use htsget_config::config::cors::CorsConfig; + use crate::htsget::{Headers, Url}; use crate::storage::data_server::HttpTicketFormatter; use crate::storage::{BytesPosition, GetOptions, RangeUrlOptions, StorageError}; @@ -133,7 +141,7 @@ pub(crate) mod tests { async fn get_non_existing_key() { with_local_storage(|storage| async move { let result = storage.get("non-existing-key").await; - assert!(matches!(result, Err(StorageError::InvalidKey(msg)) if msg == "non-existing-key")); + assert!(matches!(result, Err(StorageError::KeyNotFound(msg)) if msg == "non-existing-key")); }) .await; } @@ -152,7 +160,7 @@ pub(crate) mod tests { with_local_storage(|storage| async move { let result = Storage::get(&storage, "folder/../../passwords", GetOptions::default()).await; assert!( - matches!(result, Err(StorageError::InvalidKey(msg)) if msg == "folder/../../passwords") + matches!(result, Err(StorageError::KeyNotFound(msg)) if msg == "folder/../../passwords") ); }) .await; @@ -172,7 +180,7 @@ pub(crate) mod tests { with_local_storage(|storage| async move { let result = Storage::range_url(&storage, "non-existing-key", RangeUrlOptions::default()).await; - assert!(matches!(result, Err(StorageError::InvalidKey(msg)) if msg == "non-existing-key")); + assert!(matches!(result, Err(StorageError::KeyNotFound(msg)) if msg == "non-existing-key")); }) .await; } @@ -196,7 +204,7 @@ pub(crate) mod tests { ) .await; assert!( - matches!(result, Err(StorageError::InvalidKey(msg)) if msg == "folder/../../passwords") + matches!(result, Err(StorageError::KeyNotFound(msg)) if msg == "folder/../../passwords") ); }) .await; diff --git a/htsget-search/src/storage/mod.rs b/htsget-search/src/storage/mod.rs index 7510bfdc5..e8034d6ce 100644 --- a/htsget-search/src/storage/mod.rs +++ b/htsget-search/src/storage/mod.rs @@ -9,15 +9,16 @@ use std::time::Duration; use async_trait::async_trait; use base64::encode; -use htsget_config::config::cors::CorsConfig; -use htsget_config::regex_resolver::{LocalResolver, Scheme}; -use htsget_config::Class; use http::{uri, HeaderValue}; use thiserror::Error; use tokio::io::AsyncRead; use tower_http::cors::{AllowHeaders, AllowMethods, AllowOrigin, CorsLayer, ExposeHeaders}; use tracing::instrument; +use htsget_config::config::cors::CorsConfig; +use htsget_config::regex_resolver::{LocalResolver, Scheme}; +use htsget_config::Class; + use crate::htsget::{Headers, Url}; #[cfg(feature = "s3-storage")] From 313fe2c7ab615b1480383e6a3d4eca0c69825e59 Mon Sep 17 00:00:00 2001 From: Marko Malenic Date: Fri, 3 Feb 2023 16:32:08 +1100 Subject: [PATCH 08/10] fix(search): use KeyNotFound for head and get object in AwsS3Storage --- htsget-search/src/storage/aws.rs | 61 +++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/htsget-search/src/storage/aws.rs b/htsget-search/src/storage/aws.rs index 16c7b6a66..fc623e4d2 100644 --- a/htsget-search/src/storage/aws.rs +++ b/htsget-search/src/storage/aws.rs @@ -6,11 +6,11 @@ use std::time::Duration; use async_trait::async_trait; use aws_sdk_s3::client::fluent_builders; -use aws_sdk_s3::error::GetObjectErrorKind; +use aws_sdk_s3::error::{GetObjectError, GetObjectErrorKind, HeadObjectErrorKind}; use aws_sdk_s3::model::StorageClass; use aws_sdk_s3::output::HeadObjectOutput; use aws_sdk_s3::presigning::config::PresigningConfig; -use aws_sdk_s3::types::ByteStream; +use aws_sdk_s3::types::{ByteStream, SdkError}; use aws_sdk_s3::Client; use bytes::Bytes; use fluent_builders::GetObject; @@ -20,7 +20,7 @@ use tracing::instrument; use crate::htsget::Url; use crate::storage::aws::Retrieval::{Delayed, Immediate}; -use crate::storage::StorageError::AwsS3Error; +use crate::storage::StorageError::{AwsS3Error, KeyNotFound}; use crate::storage::{BytesPosition, StorageError}; use crate::storage::{BytesRange, Storage}; @@ -74,14 +74,7 @@ impl AwsS3Storage { .map_err(|err| AwsS3Error(err.to_string(), key.as_ref().to_string()))?, ) .await - .map_err(|err| { - let err = err.into_service_error(); - if let GetObjectErrorKind::NoSuchKey(_) = err.kind { - StorageError::KeyNotFound(key.as_ref().to_string()) - } else { - AwsS3Error(err.to_string(), key.as_ref().to_string()) - } - })? + .map_err(|err| Self::map_get_error(key, err))? .uri() .to_string(), ) @@ -95,7 +88,14 @@ impl AwsS3Storage { .key(key.as_ref()) .send() .await - .map_err(|err| AwsS3Error(err.to_string(), key.as_ref().to_string())) + .map_err(|err| { + let err = err.into_service_error(); + if let HeadObjectErrorKind::NotFound(_) = err.kind { + KeyNotFound(key.as_ref().to_string()) + } else { + AwsS3Error(err.to_string(), key.as_ref().to_string()) + } + }) } /// Returns the retrieval type of the object stored with the key. @@ -163,7 +163,7 @@ impl AwsS3Storage { response .send() .await - .map_err(|err| AwsS3Error(err.to_string(), key.as_ref().to_string()))? + .map_err(|err| Self::map_get_error(key, err))? .body, ) } @@ -176,6 +176,18 @@ impl AwsS3Storage { let response = self.get_content(key, options).await?; Ok(StreamReader::new(response)) } + + fn map_get_error(key: K, error: SdkError) -> StorageError + where + K: AsRef + Send, + { + let error = error.into_service_error(); + if let GetObjectErrorKind::NoSuchKey(_) = error.kind { + KeyNotFound(key.as_ref().to_string()) + } else { + AwsS3Error(error.to_string(), key.as_ref().to_string()) + } + } } #[async_trait] @@ -230,9 +242,10 @@ impl Storage for AwsS3Storage { } #[cfg(test)] -mod tests { +pub(crate) mod tests { use std::future::Future; use std::path::Path; + use std::sync::Arc; use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; @@ -246,7 +259,7 @@ mod tests { use crate::storage::StorageError; use crate::storage::{BytesPosition, GetOptions, RangeUrlOptions, Storage}; - async fn with_s3_test_server(server_base_path: &Path, test: F) + pub(crate) async fn with_s3_test_server(server_base_path: &Path, test: F) where F: FnOnce(Client) -> Fut, Fut: Future, @@ -278,18 +291,26 @@ mod tests { test(Client::new(&sdk_config)).await; } - async fn with_aws_s3_storage(test: F) + pub(crate) async fn with_aws_s3_storage_fn(test: F, folder_name: String, base_path: &Path) where - F: FnOnce(AwsS3Storage) -> Fut, + F: FnOnce(Arc) -> Fut, Fut: Future, { - let (folder_name, base_path) = create_local_test_files().await; - with_s3_test_server(base_path.path(), |client| async move { - test(AwsS3Storage::new(client, folder_name)).await; + with_s3_test_server(base_path, |client| async move { + test(Arc::new(AwsS3Storage::new(client, folder_name))).await; }) .await; } + async fn with_aws_s3_storage(test: F) + where + F: FnOnce(Arc) -> Fut, + Fut: Future, + { + let (folder_name, base_path) = create_local_test_files().await; + with_aws_s3_storage_fn(test, folder_name, base_path.path()).await; + } + #[tokio::test] async fn existing_key() { with_aws_s3_storage(|storage| async move { From f16a1e75b753a945aad1dadffcc1cc141ef19226 Mon Sep 17 00:00:00 2001 From: Marko Malenic Date: Mon, 6 Feb 2023 17:52:35 +1100 Subject: [PATCH 09/10] test(search): add set of tests targeting non-existent keys --- htsget-search/src/htsget/bam_search.rs | 166 +++++++++++++++++------ htsget-search/src/htsget/bcf_search.rs | 166 +++++++++++++++++------ htsget-search/src/htsget/cram_search.rs | 104 +++++++++++++- htsget-search/src/htsget/from_storage.rs | 52 ++++--- htsget-search/src/htsget/vcf_search.rs | 134 ++++++++++++++---- htsget-search/src/storage/aws.rs | 3 + 6 files changed, 494 insertions(+), 131 deletions(-) diff --git a/htsget-search/src/htsget/bam_search.rs b/htsget-search/src/htsget/bam_search.rs index b1b95a678..3a9b9e552 100644 --- a/htsget-search/src/htsget/bam_search.rs +++ b/htsget-search/src/htsget/bam_search.rs @@ -178,16 +178,18 @@ pub(crate) mod tests { use htsget_test::util::expected_bgzf_eof_data_url; - use crate::htsget::from_storage::tests::{ - with_local_storage as with_local_storage_path, - with_local_storage_tmp as with_local_storage_tmp_path, - }; + #[cfg(feature = "s3-storage")] + use crate::htsget::from_storage::tests::with_aws_storage_fn; + use crate::htsget::from_storage::tests::with_local_storage_fn; use crate::htsget::{Class::Body, Class::Header, Headers, HtsGetError::NotFound, Response, Url}; use crate::storage::data_server::HttpTicketFormatter; use crate::storage::local::LocalStorage; use super::*; + const DATA_LOCATION: &str = "data/bam"; + const INDEX_FILE_LOCATION: &str = "htsnexus_test_NA12878.bam.bai"; + #[tokio::test] async fn search_all_reads() { with_local_storage(|storage| async move { @@ -354,29 +356,33 @@ pub(crate) mod tests { #[tokio::test] async fn search_no_gzi() { - with_local_storage_tmp(|storage| async move { - let search = BamSearch::new(storage.clone()); - let query = Query::new("htsnexus_test_NA12878", Format::Bam) - .with_reference_name("11") - .with_start(5015000) - .with_end(5050000); - let response = search.search(query).await; - println!("{response:#?}"); - - let expected_response = Ok(Response::new( - Format::Bam, - vec![ - Url::new(expected_url()) - .with_headers(Headers::default().with_header("Range", "bytes=0-4667")) - .with_class(Header), - Url::new(expected_url()) - .with_headers(Headers::default().with_header("Range", "bytes=256721-1065951")) - .with_class(Body), - Url::new(expected_bgzf_eof_data_url()).with_class(Body), - ], - )); - assert_eq!(response, expected_response) - }) + with_local_storage_fn( + |storage| async move { + let search = BamSearch::new(storage.clone()); + let query = Query::new("htsnexus_test_NA12878", Format::Bam) + .with_reference_name("11") + .with_start(5015000) + .with_end(5050000); + let response = search.search(query).await; + println!("{response:#?}"); + + let expected_response = Ok(Response::new( + Format::Bam, + vec![ + Url::new(expected_url()) + .with_headers(Headers::default().with_header("Range", "bytes=0-4667")) + .with_class(Header), + Url::new(expected_url()) + .with_headers(Headers::default().with_header("Range", "bytes=256721-1065951")) + .with_class(Body), + Url::new(expected_bgzf_eof_data_url()).with_class(Body), + ], + )); + assert_eq!(response, expected_response) + }, + DATA_LOCATION, + &["htsnexus_test_NA12878.bam", INDEX_FILE_LOCATION], + ) .await } @@ -399,25 +405,105 @@ pub(crate) mod tests { .await; } - pub(crate) async fn with_local_storage(test: F) - where - F: FnOnce(Arc>) -> Fut, - Fut: Future, - { - with_local_storage_path(test, "data/bam").await + #[tokio::test] + async fn search_non_existent_id_reference_name() { + with_local_storage_fn( + |storage| async move { + let search = BamSearch::new(storage.clone()); + let query = Query::new("htsnexus_test_NA12878", Format::Bam); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[tokio::test] + async fn search_non_existent_id_all_reads() { + with_local_storage_fn( + |storage| async move { + let search = BamSearch::new(storage.clone()); + let query = Query::new("htsnexus_test_NA12878", Format::Bam).with_reference_name("20"); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await } - async fn with_local_storage_tmp(test: F) + #[tokio::test] + async fn search_non_existent_id_header() { + with_local_storage_fn( + |storage| async move { + let search = BamSearch::new(storage.clone()); + let query = Query::new("htsnexus_test_NA12878", Format::Bam).with_class(Header); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_reference_name_aws() { + with_aws_storage_fn( + |storage| async move { + let search = BamSearch::new(storage); + let query = Query::new("htsnexus_test_NA12878", Format::Bam); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_all_reads_aws() { + with_aws_storage_fn( + |storage| async move { + let search = BamSearch::new(storage); + let query = Query::new("htsnexus_test_NA12878", Format::Bam).with_reference_name("20"); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_header_aws() { + with_aws_storage_fn( + |storage| async move { + let search = BamSearch::new(storage); + let query = Query::new("htsnexus_test_NA12878", Format::Bam).with_class(Header); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + pub(crate) async fn with_local_storage(test: F) where F: FnOnce(Arc>) -> Fut, Fut: Future, { - with_local_storage_tmp_path( - test, - "data/bam", - &["htsnexus_test_NA12878.bam", "htsnexus_test_NA12878.bam.bai"], - ) - .await + with_local_storage_fn(test, DATA_LOCATION, &[]).await } pub(crate) fn expected_url() -> String { diff --git a/htsget-search/src/htsget/bcf_search.rs b/htsget-search/src/htsget/bcf_search.rs index ae2c103bf..90bd157a5 100644 --- a/htsget-search/src/htsget/bcf_search.rs +++ b/htsget-search/src/htsget/bcf_search.rs @@ -132,16 +132,18 @@ mod tests { use htsget_test::util::expected_bgzf_eof_data_url; - use crate::htsget::from_storage::tests::{ - with_local_storage as with_local_storage_path, - with_local_storage_tmp as with_local_storage_tmp_path, - }; - use crate::htsget::{Class, Headers, Response, Url}; + #[cfg(feature = "s3-storage")] + use crate::htsget::from_storage::tests::with_aws_storage_fn; + use crate::htsget::from_storage::tests::with_local_storage_fn; + use crate::htsget::{Class::Header, Headers, HtsGetError::NotFound, Response, Url}; use crate::storage::data_server::HttpTicketFormatter; use crate::storage::local::LocalStorage; use super::*; + const DATA_LOCATION: &str = "data/bcf"; + const INDEX_FILE_LOCATION: &str = "vcf-spec-v4.3.bcf.csi"; + #[tokio::test] async fn search_all_variants() { with_local_storage(|storage| async move { @@ -206,12 +208,127 @@ mod tests { #[tokio::test] async fn search_no_gzi() { - with_local_storage_tmp(|storage| async move { - test_reference_sequence_with_seq_range(storage).await + with_local_storage_fn( + |storage| async move { test_reference_sequence_with_seq_range(storage).await }, + DATA_LOCATION, + &["sample1-bcbio-cancer.bcf", "sample1-bcbio-cancer.bcf.csi"], + ) + .await + } + + #[tokio::test] + async fn search_header() { + with_local_storage(|storage| async move { + let search = BcfSearch::new(storage.clone()); + let filename = "vcf-spec-v4.3"; + let query = Query::new(filename, Format::Bcf).with_class(Header); + let response = search.search(query).await; + println!("{response:#?}"); + + let expected_response = Ok(Response::new( + Format::Bcf, + vec![Url::new(expected_url(filename)) + .with_headers(Headers::default().with_header("Range", "bytes=0-949")) + .with_class(Header)], + )); + assert_eq!(response, expected_response) }) .await } + #[tokio::test] + async fn search_non_existent_id_reference_name() { + with_local_storage_fn( + |storage| async move { + let search = BcfSearch::new(storage.clone()); + let query = Query::new("vcf-spec-v4.3", Format::Bcf); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[tokio::test] + async fn search_non_existent_id_all_reads() { + with_local_storage_fn( + |storage| async move { + let search = BcfSearch::new(storage.clone()); + let query = Query::new("vcf-spec-v4.3", Format::Bcf).with_reference_name("chrM"); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[tokio::test] + async fn search_non_existent_id_header() { + with_local_storage_fn( + |storage| async move { + let search = BcfSearch::new(storage.clone()); + let query = Query::new("vcf-spec-v4.3", Format::Bcf).with_class(Header); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_reference_name_aws() { + with_aws_storage_fn( + |storage| async move { + let search = BcfSearch::new(storage); + let query = Query::new("vcf-spec-v4.3", Format::Bcf); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_all_reads_aws() { + with_aws_storage_fn( + |storage| async move { + let search = BcfSearch::new(storage); + let query = Query::new("vcf-spec-v4.3", Format::Bcf).with_reference_name("chrM"); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_header_aws() { + with_aws_storage_fn( + |storage| async move { + let search = BcfSearch::new(storage); + let query = Query::new("vcf-spec-v4.3", Format::Bcf).with_class(Header); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + async fn test_reference_sequence_with_seq_range(storage: Arc>) { let search = BcfSearch::new(storage.clone()); let filename = "sample1-bcbio-cancer"; @@ -237,45 +354,12 @@ mod tests { ) } - #[tokio::test] - async fn search_header() { - with_local_storage(|storage| async move { - let search = BcfSearch::new(storage.clone()); - let filename = "vcf-spec-v4.3"; - let query = Query::new(filename, Format::Bcf).with_class(Class::Header); - let response = search.search(query).await; - println!("{response:#?}"); - - let expected_response = Ok(Response::new( - Format::Bcf, - vec![Url::new(expected_url(filename)) - .with_headers(Headers::default().with_header("Range", "bytes=0-949")) - .with_class(Class::Header)], - )); - assert_eq!(response, expected_response) - }) - .await - } - async fn with_local_storage(test: F) where F: FnOnce(Arc>) -> Fut, Fut: Future, { - with_local_storage_path(test, "data/bcf").await - } - - async fn with_local_storage_tmp(test: F) - where - F: FnOnce(Arc>) -> Fut, - Fut: Future, - { - with_local_storage_tmp_path( - test, - "data/bcf", - &["sample1-bcbio-cancer.bcf", "sample1-bcbio-cancer.bcf.csi"], - ) - .await + with_local_storage_fn(test, "data/bcf", &[]).await } fn expected_url(name: &str) -> String { diff --git a/htsget-search/src/htsget/cram_search.rs b/htsget-search/src/htsget/cram_search.rs index bf1e73136..d1bd1265b 100644 --- a/htsget-search/src/htsget/cram_search.rs +++ b/htsget-search/src/htsget/cram_search.rs @@ -270,13 +270,18 @@ mod tests { use htsget_test::util::expected_cram_eof_data_url; - use crate::htsget::from_storage::tests::with_local_storage as with_local_storage_path; - use crate::htsget::{Class::Body, Class::Header, Headers, Response, Url}; + #[cfg(feature = "s3-storage")] + use crate::htsget::from_storage::tests::with_aws_storage_fn; + use crate::htsget::from_storage::tests::with_local_storage_fn; + use crate::htsget::{Class::Header, Headers, HtsGetError::NotFound, Response, Url}; use crate::storage::data_server::HttpTicketFormatter; use crate::storage::local::LocalStorage; use super::*; + const DATA_LOCATION: &str = "data/cram"; + const INDEX_FILE_LOCATION: &str = "htsnexus_test_NA12878.cram.crai"; + #[tokio::test] async fn search_all_reads() { with_local_storage(|storage| async move { @@ -435,12 +440,105 @@ mod tests { .await; } + #[tokio::test] + async fn search_non_existent_id_reference_name() { + with_local_storage_fn( + |storage| async move { + let search = CramSearch::new(storage.clone()); + let query = Query::new("htsnexus_test_NA12878", Format::Cram); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[tokio::test] + async fn search_non_existent_id_all_reads() { + with_local_storage_fn( + |storage| async move { + let search = CramSearch::new(storage.clone()); + let query = Query::new("htsnexus_test_NA12878", Format::Cram).with_reference_name("20"); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[tokio::test] + async fn search_non_existent_id_header() { + with_local_storage_fn( + |storage| async move { + let search = CramSearch::new(storage.clone()); + let query = Query::new("htsnexus_test_NA12878", Format::Cram).with_class(Header); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_reference_name_aws() { + with_aws_storage_fn( + |storage| async move { + let search = CramSearch::new(storage); + let query = Query::new("htsnexus_test_NA12878", Format::Cram); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_all_reads_aws() { + with_aws_storage_fn( + |storage| async move { + let search = CramSearch::new(storage); + let query = Query::new("htsnexus_test_NA12878", Format::Cram).with_reference_name("20"); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_header_aws() { + with_aws_storage_fn( + |storage| async move { + let search = CramSearch::new(storage); + let query = Query::new("htsnexus_test_NA12878", Format::Cram).with_class(Header); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + DATA_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + async fn with_local_storage(test: F) where F: FnOnce(Arc>) -> Fut, Fut: Future, { - with_local_storage_path(test, "data/cram").await + with_local_storage_fn(test, "data/cram", &[]).await } fn expected_url() -> String { diff --git a/htsget-search/src/htsget/from_storage.rs b/htsget-search/src/htsget/from_storage.rs index 18a35d7e2..b432dc210 100644 --- a/htsget-search/src/htsget/from_storage.rs +++ b/htsget-search/src/htsget/from_storage.rs @@ -112,6 +112,7 @@ impl HtsGetFromStorage> { #[cfg(test)] pub(crate) mod tests { use std::fs; + use std::fs::create_dir; use std::future::Future; use std::path::PathBuf; @@ -127,6 +128,8 @@ pub(crate) mod tests { expected_url as vcf_expected_url, with_local_storage as with_vcf_local_storage, }; use crate::htsget::{Headers, Url}; + #[cfg(feature = "s3-storage")] + use crate::storage::aws::tests::with_aws_s3_storage_fn; use crate::storage::data_server::HttpTicketFormatter; use super::*; @@ -174,24 +177,30 @@ pub(crate) mod tests { .await; } - async fn with_local_storage_fn(test: F, path: &str, file_names: Option<&[&str]>) - where - F: FnOnce(Arc>) -> Fut, - Fut: Future, - { + async fn copy_files(from_path: &str, to_path: &Path, file_names: &[&str]) -> PathBuf { let mut base_path = std::env::current_dir() .unwrap() .parent() .unwrap() - .join(path); + .join(from_path); - let tmp_dir = TempDir::new().unwrap(); - if let Some(file_names) = file_names { - for file_name in file_names { - fs::copy(base_path.join(file_name), tmp_dir.path().join(file_name)).unwrap(); - } - base_path = PathBuf::from(tmp_dir.path()); + for file_name in file_names { + fs::copy(base_path.join(file_name), to_path.join(file_name)).unwrap(); } + if !file_names.is_empty() { + base_path = PathBuf::from(to_path); + } + + base_path + } + + pub(crate) async fn with_local_storage_fn(test: F, path: &str, file_names: &[&str]) + where + F: FnOnce(Arc>) -> Fut, + Fut: Future, + { + let tmp_dir = TempDir::new().unwrap(); + let base_path = copy_files(path, tmp_dir.path(), file_names).await; test(Arc::new( LocalStorage::new( @@ -203,19 +212,18 @@ pub(crate) mod tests { .await } - pub(crate) async fn with_local_storage(test: F, path: &str) + #[cfg(feature = "s3-storage")] + pub(crate) async fn with_aws_storage_fn(test: F, path: &str, file_names: &[&str]) where - F: FnOnce(Arc>) -> Fut, + F: FnOnce(Arc) -> Fut, Fut: Future, { - with_local_storage_fn(test, path, None).await; - } + let tmp_dir = TempDir::new().unwrap(); + let to_path = tmp_dir.into_path().join("folder"); + create_dir(&to_path).unwrap(); - pub(crate) async fn with_local_storage_tmp(test: F, path: &str, file_names: &[&str]) - where - F: FnOnce(Arc>) -> Fut, - Fut: Future, - { - with_local_storage_fn(test, path, Some(file_names)).await; + let base_path = copy_files(path, &to_path, file_names).await; + + with_aws_s3_storage_fn(test, "folder".to_string(), base_path.parent().unwrap()).await; } } diff --git a/htsget-search/src/htsget/vcf_search.rs b/htsget-search/src/htsget/vcf_search.rs index 3317f7aa7..99278171c 100644 --- a/htsget-search/src/htsget/vcf_search.rs +++ b/htsget-search/src/htsget/vcf_search.rs @@ -134,16 +134,18 @@ pub(crate) mod tests { use htsget_test::util::expected_bgzf_eof_data_url; - use crate::htsget::from_storage::tests::{ - with_local_storage as with_local_storage_path, - with_local_storage_tmp as with_local_storage_tmp_path, - }; - use crate::htsget::{Class, Headers, Response, Url}; + #[cfg(feature = "s3-storage")] + use crate::htsget::from_storage::tests::with_aws_storage_fn; + use crate::htsget::from_storage::tests::with_local_storage_fn; + use crate::htsget::{Class::Header, Headers, HtsGetError::NotFound, Response, Url}; use crate::storage::data_server::HttpTicketFormatter; use crate::storage::local::LocalStorage; use super::*; + const VCF_LOCATION: &str = "data/vcf"; + const INDEX_FILE_LOCATION: &str = "spec-v4.3.vcf.gz.tbi"; + #[tokio::test] async fn search_all_variants() { with_local_storage(|storage| async move { @@ -207,8 +209,13 @@ pub(crate) mod tests { #[tokio::test] async fn search_no_gzi() { - with_local_storage_tmp( + with_local_storage_fn( |storage| async move { test_reference_name_with_seq_range(storage).await }, + VCF_LOCATION, + &[ + "sample1-bcbio-cancer.vcf.gz", + "sample1-bcbio-cancer.vcf.gz.tbi", + ], ) .await; } @@ -218,7 +225,7 @@ pub(crate) mod tests { with_local_storage(|storage| async move { let search = VcfSearch::new(storage.clone()); let filename = "spec-v4.3"; - let query = Query::new(filename, Format::Vcf).with_class(Class::Header); + let query = Query::new(filename, Format::Vcf).with_class(Header); let response = search.search(query).await; println!("{response:#?}"); @@ -226,13 +233,106 @@ pub(crate) mod tests { Format::Vcf, vec![Url::new(expected_url(filename)) .with_headers(Headers::default().with_header("Range", "bytes=0-822")) - .with_class(Class::Header)], + .with_class(Header)], )); assert_eq!(response, expected_response) }) .await; } + #[tokio::test] + async fn search_non_existent_id_reference_name() { + with_local_storage_fn( + |storage| async move { + let search = VcfSearch::new(storage.clone()); + let query = Query::new("vcf-spec-v4.3", Format::Vcf); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + VCF_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[tokio::test] + async fn search_non_existent_id_all_reads() { + with_local_storage_fn( + |storage| async move { + let search = VcfSearch::new(storage.clone()); + let query = Query::new("vcf-spec-v4.3", Format::Vcf).with_reference_name("chrM"); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + VCF_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[tokio::test] + async fn search_non_existent_id_header() { + with_local_storage_fn( + |storage| async move { + let search = VcfSearch::new(storage.clone()); + let query = Query::new("vcf-spec-v4.3", Format::Vcf).with_class(Header); + let response = search.search(query).await; + assert!(matches!(response, Err(NotFound(_)))); + }, + VCF_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_reference_name_aws() { + with_aws_storage_fn( + |storage| async move { + let search = VcfSearch::new(storage); + let query = Query::new("vcf-spec-v4.3", Format::Vcf); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + VCF_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_all_reads_aws() { + with_aws_storage_fn( + |storage| async move { + let search = VcfSearch::new(storage); + let query = Query::new("vcf-spec-v4.3", Format::Vcf).with_reference_name("chrM"); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + VCF_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + + #[cfg(feature = "s3-storage")] + #[tokio::test] + async fn search_non_existent_id_header_aws() { + with_aws_storage_fn( + |storage| async move { + let search = VcfSearch::new(storage); + let query = Query::new("vcf-spec-v4.3", Format::Vcf).with_class(Header); + let response = search.search(query).await; + assert!(matches!(response, Err(_))); + }, + VCF_LOCATION, + &[INDEX_FILE_LOCATION], + ) + .await + } + async fn test_reference_name_with_seq_range(storage: Arc>) { let search = VcfSearch::new(storage.clone()); let filename = "sample1-bcbio-cancer"; @@ -263,23 +363,7 @@ pub(crate) mod tests { F: FnOnce(Arc>) -> Fut, Fut: Future, { - with_local_storage_path(test, "data/vcf").await - } - - async fn with_local_storage_tmp(test: F) - where - F: FnOnce(Arc>) -> Fut, - Fut: Future, - { - with_local_storage_tmp_path( - test, - "data/vcf", - &[ - "sample1-bcbio-cancer.vcf.gz", - "sample1-bcbio-cancer.vcf.gz.tbi", - ], - ) - .await + with_local_storage_fn(test, "data/vcf", &[]).await } pub(crate) fn expected_url(name: &str) -> String { diff --git a/htsget-search/src/storage/aws.rs b/htsget-search/src/storage/aws.rs index fc623e4d2..57f62a3a0 100644 --- a/htsget-search/src/storage/aws.rs +++ b/htsget-search/src/storage/aws.rs @@ -1,4 +1,6 @@ //! Module providing an implementation for the [Storage] trait using Amazon's S3 object storage service. +//! + use std::fmt::Debug; use std::io; use std::io::ErrorKind::Other; @@ -81,6 +83,7 @@ impl AwsS3Storage { } async fn s3_head + Send>(&self, key: K) -> Result { + println!("{:#?}", self.client.list_buckets().send().await.unwrap()); self .client .head_object() From 492e20ec732100584f7a9785ba9d7e580d8b6681 Mon Sep 17 00:00:00 2001 From: Marko Malenic Date: Mon, 6 Feb 2023 18:30:33 +1100 Subject: [PATCH 10/10] build: remove unused dependencies --- Cargo.lock | 11 ----------- htsget-lambda/Cargo.toml | 1 - htsget-search/Cargo.toml | 1 - 3 files changed, 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 36b91a15f..13783adaa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1388,15 +1388,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "envy" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" -dependencies = [ - "serde", -] - [[package]] name = "errno" version = "0.2.8" @@ -1732,7 +1723,6 @@ version = "0.1.1" dependencies = [ "async-trait", "bytes", - "envy", "htsget-config", "htsget-http", "htsget-search", @@ -1760,7 +1750,6 @@ dependencies = [ "aws-config", "aws-credential-types", "aws-sdk-s3", - "aws-types", "axum", "axum-extra", "base64 0.20.0", diff --git a/htsget-lambda/Cargo.toml b/htsget-lambda/Cargo.toml index f17b1f300..8bebb9474 100644 --- a/htsget-lambda/Cargo.toml +++ b/htsget-lambda/Cargo.toml @@ -15,7 +15,6 @@ s3-storage = ["htsget-config/s3-storage", "htsget-search/s3-storage", "htsget-ht default = ["s3-storage"] [dependencies] -envy = "0.4" tokio = { version = "1.21", features = ["macros", "rt-multi-thread"] } tower-http = { version = "0.3", features = ["cors"] } lambda_http = { version = "0.7" } diff --git a/htsget-search/Cargo.toml b/htsget-search/Cargo.toml index 3f60d6261..ae1a2aeb8 100644 --- a/htsget-search/Cargo.toml +++ b/htsget-search/Cargo.toml @@ -59,7 +59,6 @@ once_cell = "1.17" # Aws S3 storage. anyhow = "1.0" -aws-types = { version = "0.54" } aws-credential-types = { version = "0.54", features = ["test-util"] } s3s = { version = "0.3" } s3s-fs = { version = "0.3" }