diff --git a/Cargo.lock b/Cargo.lock index 78f5e41450..c86b162762 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,7 +41,7 @@ dependencies = [ "rsa", "serde", "serde_json", - "sha2", + "sha2 0.10.9", "thiserror 2.0.18", "tokio", "tracing", @@ -329,18 +329,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.4" @@ -562,6 +550,18 @@ version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" +[[package]] +name = "bb8" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89aabfae550a5c44b43ab941844ffcd2e993cb6900b342debf59e9ea74acdb8" +dependencies = [ + "async-trait", + "futures-util", + "parking_lot", + "tokio", +] + [[package]] name = "bcrypt" version = "0.19.0" @@ -635,6 +635,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-buffer" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be" +dependencies = [ + "hybrid-array", +] + [[package]] name = "blowfish" version = "0.9.1" @@ -783,14 +792,14 @@ dependencies = [ "serde_json", "syn 2.0.117", "tempfile", - "toml 0.9.12+spec-1.1.0", + "toml", ] [[package]] name = "cc" -version = "1.2.57" +version = "1.2.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423" +checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1" dependencies = [ "find-msvc-tools", "jobserver", @@ -846,23 +855,13 @@ dependencies = [ "windows-link", ] -[[package]] -name = "chumsky" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eebd66744a15ded14960ab4ccdbfb51ad3b81f51f3f04a80adac98c985396c9" -dependencies = [ - "hashbrown 0.14.5", - "stacker", -] - [[package]] name = "cipher" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "crypto-common", + "crypto-common 0.1.7", "inout", ] @@ -929,6 +928,12 @@ dependencies = [ "chrono", ] +[[package]] +name = "cmov" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0758edba32d61d1fd9f4d69491b47604b91ee2f7e6b33de7e54ca4ebe55dc3" + [[package]] name = "cobs" version = "0.3.0" @@ -986,6 +991,12 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + [[package]] name = "const_format" version = "0.2.35" @@ -1093,36 +1104,36 @@ dependencies = [ [[package]] name = "cranelift-assembler-x64" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b27381757f9295b67e558f4c64a83bfe7c6e82daad1ba4f8a948482c5de56ee9" +checksum = "50a04121a197fde2fe896f8e7cac9812fc41ed6ee9c63e1906090f9f497845f6" dependencies = [ "cranelift-assembler-x64-meta", ] [[package]] name = "cranelift-assembler-x64-meta" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e2ef32a4dbf1b380632a889995156080ecc0f1e07ac8eaa3f6325e4bd14ad8a" +checksum = "a09e699a94f477303820fb2167024f091543d6240783a2d3b01a3f21c42bc744" dependencies = [ "cranelift-srcgen", ] [[package]] name = "cranelift-bforest" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b71c01a8007dd54330c8d73edeb82a8fc1a7143884af2f319e97340e290939b" +checksum = "f07732c662a9755529e332d86f8c5842171f6e98ba4d5976a178043dad838654" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-bitset" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19fef6b39515a0ecfbb9954ab3d2d6740a459a11bef3d0536ef48460e6f6deb5" +checksum = "18391da761cf362a06def7a7cf11474d79e55801dd34c2e9ba105b33dc0aef88" dependencies = [ "serde", "serde_derive", @@ -1130,9 +1141,9 @@ dependencies = [ [[package]] name = "cranelift-codegen" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2060d8c75772e5208a9d3b766d9eb975bfc18ac459b75a0a2b2a72769a2f6da6" +checksum = "0b3a09b3042c69810d255aef59ddc3b3e4c0644d1d90ecfd6e3837798cc88a3c" dependencies = [ "bumpalo", "cranelift-assembler-x64", @@ -1157,9 +1168,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "887e3ab41a8a75cb6b68c5fc686158b6083f1ad49cf52f2da7538fba17ff0be6" +checksum = "75817926ec812241889208d1b190cadb7fedded4592a4bb01b8524babb9e4849" dependencies = [ "cranelift-assembler-x64-meta", "cranelift-codegen-shared", @@ -1170,24 +1181,24 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b187cbec77058579b47e8f75b1ce430b0d110df9c38d0fee2f8bd9801fd673" +checksum = "859158f87a59476476eda3884d883c32e08a143cf3d315095533b362a3250a63" [[package]] name = "cranelift-control" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b421ad1fefa33a1bb278d761d8ad7d49e17b7089f652fc2a1536435c75ff8def" +checksum = "03b65a9aec442d715cbf54d14548b8f395476c09cef7abe03e104a378291ab88" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46e3a650a696c3f4c93bb869e7d219ba3abf6e247164aaf7f12dc918a1d52772" +checksum = "8334c99a7e86060c24028732efd23bac84585770dcb752329c69f135d64f2fc1" dependencies = [ "cranelift-bitset", "serde", @@ -1196,9 +1207,9 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d48f516c004656a85747f6f8ccf6e23d8ec0a0a6dcf75ec85d6f2fa7e12c91" +checksum = "43ac6c095aa5b3e845d7ca3461e67e2b65249eb5401477a5ff9100369b745111" dependencies = [ "cranelift-codegen", "log", @@ -1208,15 +1219,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce7761455ec4977010db897e9ad925200f08e435b9fa17575bd269ba174f33b" +checksum = "69d3d992870ed4f0f2e82e2175275cb3a123a46e9660c6558c46417b822c91fa" [[package]] name = "cranelift-native" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42be1df38c4db6e19ba19d5ab8e65950c2865da0ad9e972a99ef224f1f77b8af" +checksum = "ee32e36beaf80f309edb535274cfe0349e1c5cf5799ba2d9f42e828285c6b52e" dependencies = [ "cranelift-codegen", "libc", @@ -1225,9 +1236,9 @@ dependencies = [ [[package]] name = "cranelift-srcgen" -version = "0.124.3" +version = "0.128.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fee765d14f3f91dcba44c0e4b0eaece5f89024539b620af15a6aeec485b1170" +checksum = "903adeaf4938e60209a97b53a2e4326cd2d356aab9764a1934630204bae381c9" [[package]] name = "crc32fast" @@ -1294,6 +1305,24 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-common" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "ctutils" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1005a6d4446f5120ef475ad3d2af2b30c49c2c9c6904258e3bb30219bebed5e4" +dependencies = [ + "cmov", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -1303,7 +1332,7 @@ dependencies = [ "cfg-if", "cpufeatures 0.2.17", "curve25519-dalek-derive", - "digest", + "digest 0.10.7", "fiat-crypto", "rustc_version", "subtle", @@ -1474,6 +1503,24 @@ dependencies = [ "parking_lot_core", ] +[[package]] +name = "db-pool" +version = "0.6.0" +source = "git+https://github.com/momentary-lapse/db-pool.git?branch=edition2021-superuser-config#8e0460fecfb165aeb481f623823cd8b15b9b8fd5" +dependencies = [ + "async-trait", + "bb8", + "deadpool", + "diesel", + "diesel-async", + "futures", + "parking_lot", + "tokio", + "url", + "urlencoding", + "uuid", +] + [[package]] name = "deadpool" version = "0.13.0" @@ -1512,7 +1559,7 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ - "const-oid", + "const-oid 0.9.6", "der_derive", "flagset", "pem-rfc7468", @@ -1759,12 +1806,24 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", + "block-buffer 0.10.4", + "const-oid 0.9.6", + "crypto-common 0.1.7", "subtle", ] +[[package]] +name = "digest" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c" +dependencies = [ + "block-buffer 0.12.0", + "const-oid 0.10.2", + "crypto-common 0.2.1", + "ctutils", +] + [[package]] name = "diligent-date-parser" version = "0.1.5" @@ -1875,7 +1934,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", @@ -1901,7 +1960,7 @@ dependencies = [ "curve25519-dalek", "ed25519", "serde", - "sha2", + "sha2 0.10.9", "subtle", "zeroize", ] @@ -1932,7 +1991,7 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", @@ -2071,11 +2130,12 @@ dependencies = [ [[package]] name = "extism" -version = "1.20.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "491d31da92442abcbbbf6c1e3074abb308925a2384a615c79ac76420e4f790fc" +checksum = "ed8c5859bdab81d2eb4cd963eeacd8031d353b1ffb2fde43ee9179a0d6295120" dependencies = [ "anyhow", + "async-trait", "cbindgen", "extism-convert", "extism-manifest", @@ -2083,8 +2143,8 @@ dependencies = [ "libc", "serde", "serde_json", - "sha2", - "toml 0.9.12+spec-1.1.0", + "sha2 0.10.9", + "toml", "tracing", "tracing-subscriber", "ureq", @@ -2097,9 +2157,9 @@ dependencies = [ [[package]] name = "extism-convert" -version = "1.20.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6a2f8c12ab80a3f810edef0d96fe7a5ffcc9ce59a534e81f1b6bd8e977c6772" +checksum = "ec1a8eac059a1730a21aa47f99a0c2075ba0ab88fd0c4e52e35027cf99cdf3e7" dependencies = [ "anyhow", "base64 0.22.1", @@ -2113,9 +2173,9 @@ dependencies = [ [[package]] name = "extism-convert-macros" -version = "1.20.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317ea3a0ba61991baf81ed51e7a59d840952e9aacd625b4d3bef39093e7c86e7" +checksum = "848f105dd6e1af2ea4bb4a76447658e8587167df3c4e4658c4258e5b14a5b051" dependencies = [ "manyhow", "proc-macro-crate", @@ -2126,9 +2186,9 @@ dependencies = [ [[package]] name = "extism-manifest" -version = "1.20.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9af75c1bfec0592bd51be27de1506f21fb0991d7caf81e691d4298d5dc254da5" +checksum = "953a22ad322939ae4567ec73a34913a3a43dcbdfa648b8307d38fe56bb3a0acd" dependencies = [ "base64 0.22.1", "serde", @@ -2477,10 +2537,6 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", - "allocator-api2", -] [[package]] name = "hashbrown" @@ -2528,7 +2584,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ - "hmac", + "hmac 0.12.1", ] [[package]] @@ -2537,7 +2593,16 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", +] + +[[package]] +name = "hmac" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" +dependencies = [ + "digest 0.11.2", ] [[package]] @@ -2689,7 +2754,7 @@ dependencies = [ "httpdate", "reqwest 0.13.2", "reqwest-middleware", - "sha2", + "sha2 0.10.9", "tokio", ] @@ -2705,6 +2770,15 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "hybrid-array" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3944cf8cf766b40e2a1a333ee5e9b563f854d5fa49d6a8ca2764e97c6eddb214" +dependencies = [ + "typenum", +] + [[package]] name = "hyper" version = "0.14.32" @@ -2731,9 +2805,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" dependencies = [ "atomic-waker", "bytes", @@ -2744,7 +2818,6 @@ dependencies = [ "httparse", "itoa", "pin-project-lite", - "pin-utils", "smallvec", "tokio", "want", @@ -2771,7 +2844,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ "http 1.4.0", - "hyper 1.8.1", + "hyper 1.9.0", "hyper-util", "rustls 0.23.37", "rustls-pki-types", @@ -2792,7 +2865,7 @@ dependencies = [ "futures-util", "http 1.4.0", "http-body 1.0.1", - "hyper 1.8.1", + "hyper 1.9.0", "ipnet", "libc", "percent-encoding", @@ -3072,9 +3145,9 @@ checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" [[package]] name = "iri-string" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e7418f59cc01c88316161279a7f665217ae316b388e58a0d10e29f54f1e5eb" +checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" dependencies = [ "memchr", "serde", @@ -3171,10 +3244,12 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.91" +version = "0.3.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" +checksum = "797146bb2677299a1eb6b7b50a890f4c361b29ef967addf5b2fa45dae1bb6d7d" dependencies = [ + "cfg-if", + "futures-util", "once_cell", "wasm-bindgen", ] @@ -3188,7 +3263,7 @@ dependencies = [ "base64 0.22.1", "ed25519-dalek", "getrandom 0.2.17", - "hmac", + "hmac 0.12.1", "js-sys", "p256", "p384", @@ -3197,7 +3272,7 @@ dependencies = [ "rsa", "serde", "serde_json", - "sha2", + "sha2 0.10.9", "signature", "simple_asn1", ] @@ -3275,9 +3350,9 @@ dependencies = [ "regex", "serde", "serde_json", - "serial_test", "sitemap-rs", "tokio", + "tokio-shared-rt", "totp-rs", "tracing", "url", @@ -3285,20 +3360,20 @@ dependencies = [ [[package]] name = "lemmy_api_common" -version = "0.19.16" +version = "0.19.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44a90f9404d4f377cad644ddf117d4294bb9e603e3447a8722bfb65d94ca6e60" +checksum = "d873a17ab50736d1054b71169200c11332e80decf6b82276e7fdae78d42ca949" dependencies = [ "anyhow", "chrono", "enum-map", "getrandom 0.2.17", "infer 0.16.0", - "lemmy_db_schema 0.19.16", + "lemmy_db_schema 0.19.17", "lemmy_db_views", "lemmy_db_views_actor", "lemmy_db_views_moderator", - "lemmy_utils 0.19.16", + "lemmy_utils 0.19.17", "mime_guess", "moka", "regex", @@ -3397,7 +3472,7 @@ dependencies = [ "actix-web", "chrono", "lemmy_api", - "lemmy_api_common 0.19.16", + "lemmy_api_common 0.19.17", "lemmy_api_crud", "lemmy_api_utils", "lemmy_db_schema 1.0.0-alpha.18", @@ -3460,8 +3535,8 @@ dependencies = [ "reqwest-middleware", "rustls 0.23.37", "serde", - "serial_test", "tokio", + "tokio-shared-rt", "tracing", "url", "urlencoding", @@ -3494,8 +3569,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_json", - "serial_test", "tokio", + "tokio-shared-rt", "tracing", "url", ] @@ -3565,9 +3640,9 @@ dependencies = [ "serde", "serde_json", "serde_with", - "serial_test", "stringreader", "tokio", + "tokio-shared-rt", "tracing", "url", ] @@ -3600,6 +3675,7 @@ dependencies = [ "serial_test", "test-context", "tokio", + "tokio-shared-rt", "tokio-util", "tracing", "tracing-test", @@ -3609,9 +3685,9 @@ dependencies = [ [[package]] name = "lemmy_db_schema" -version = "0.19.16" +version = "0.19.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ab75cc48d2a2db143345c4faaec3ab9823b550b407971576cdaee9355da51c" +checksum = "8a39fe2af439b0ed8cd53fe480aa82545510422d723b08da19914881c7fb3f77" dependencies = [ "anyhow", "async-trait", @@ -3648,9 +3724,9 @@ dependencies = [ "serde", "serde_json", "serde_with", - "serial_test", "strum 0.28.0", "tokio", + "tokio-shared-rt", "ts-rs", "url", ] @@ -3671,24 +3747,24 @@ dependencies = [ [[package]] name = "lemmy_db_views" -version = "0.19.16" +version = "0.19.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df4de07624ba0abbdc3ad1f2603b0ed810b02697c84c14232ad5e46ccf65f4bf" +checksum = "dd7a6bdb1c59f0c39bd94ea066f2858cb9f47f5cfa7dfc8b6d2b271d5622a2cb" dependencies = [ "chrono", - "lemmy_db_schema 0.19.16", + "lemmy_db_schema 0.19.17", "serde", "serde_with", ] [[package]] name = "lemmy_db_views_actor" -version = "0.19.16" +version = "0.19.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b73cdb133d1fe12040d5c366735e539f78308071dd493d334650f7618a0bd74" +checksum = "c154c64a5613874926d09fae2fd589d7cf56a792189c749292ef59c3c2b4458b" dependencies = [ "chrono", - "lemmy_db_schema 0.19.16", + "lemmy_db_schema 0.19.17", "serde", "serde_with", "strum 0.26.3", @@ -3711,8 +3787,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -3730,8 +3806,8 @@ dependencies = [ "lemmy_utils 1.0.0-alpha.18", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -3764,8 +3840,8 @@ dependencies = [ "lemmy_utils 1.0.0-alpha.18", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -3831,18 +3907,18 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] [[package]] name = "lemmy_db_views_moderator" -version = "0.19.16" +version = "0.19.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230c15d98d67bd744c8357a3c6d12a53e74f9f96d679da6fea3a18278e51a0bc" +checksum = "f59df84dc2f3ae002e36e2088ee8010865385b1f45d575acd9a4c840303488c4" dependencies = [ - "lemmy_db_schema 0.19.16", + "lemmy_db_schema 0.19.17", "serde", "serde_with", ] @@ -3861,8 +3937,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -3886,8 +3962,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -3916,8 +3992,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -3937,8 +4013,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -3958,8 +4034,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -3979,8 +4055,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -4002,9 +4078,9 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "test-context", "tokio", + "tokio-shared-rt", "tracing", "ts-rs", "url", @@ -4053,8 +4129,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -4075,8 +4151,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -4111,8 +4187,8 @@ dependencies = [ "lemmy_utils 1.0.0-alpha.18", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", "url", ] @@ -4131,8 +4207,8 @@ dependencies = [ "pretty_assertions", "serde", "serde_with", - "serial_test", "tokio", + "tokio-shared-rt", "ts-rs", ] @@ -4144,6 +4220,7 @@ dependencies = [ "anyhow", "base64 0.22.1", "chrono", + "db-pool", "deadpool", "diesel", "diesel-async", @@ -4162,7 +4239,6 @@ dependencies = [ "serde", "serde_urlencoded", "serde_with", - "serial_test", "tokio", "tokio-postgres", "tokio-postgres-rustls", @@ -4227,9 +4303,9 @@ dependencies = [ "rosetta-i18n", "rss", "serde", - "serial_test", "strum 0.28.0", "tokio", + "tokio-shared-rt", "tracing", "ts-rs", "url", @@ -4267,9 +4343,9 @@ dependencies = [ [[package]] name = "lemmy_utils" -version = "0.19.16" +version = "0.19.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360fda2d00df95fd4e9fbd48de3985ebda8b3de2f6a6e28f9a7196467e1bce70" +checksum = "a8765ac609f1267eee6f7899b443fde42cbcb1e12ec2aa08395d4a5d3155b80c" dependencies = [ "cfg-if", "clearurls", @@ -4323,13 +4399,12 @@ dependencies = [ [[package]] name = "lettre" -version = "0.11.19" +version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e13e10e8818f8b2a60f52cb127041d388b89f3a96a62be9ceaffa22262fef7f" +checksum = "471816f3e24b85e820dee02cde962379ea1a669e5242f19c61bcbcffedf4c4fb" dependencies = [ "async-trait", "base64 0.22.1", - "chumsky", "email-encoding", "email_address", "fastrand", @@ -4373,9 +4448,9 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a" +checksum = "7ddbf48fd451246b1f8c2610bd3b4ac0cc6e149d89832867093ab69a17194f08" dependencies = [ "libc", ] @@ -4628,12 +4703,12 @@ checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" [[package]] name = "md-5" -version = "0.10.6" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98" dependencies = [ "cfg-if", - "digest", + "digest 0.11.2", ] [[package]] @@ -4669,7 +4744,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36c791ecdf977c99f45f23280405d7723727470f6689a5e6dbf513ac547ae10d" dependencies = [ "serde", - "toml 0.9.12+spec-1.1.0", + "toml", ] [[package]] @@ -4726,9 +4801,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" dependencies = [ "libc", "log", @@ -4856,9 +4931,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" +checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" [[package]] name = "num-integer" @@ -4957,7 +5032,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "primeorder", - "sha2", + "sha2 0.10.9", ] [[package]] @@ -4969,7 +5044,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "primeorder", - "sha2", + "sha2 0.10.9", ] [[package]] @@ -5181,12 +5256,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - [[package]] name = "pkcs1" version = "0.7.5" @@ -5247,27 +5316,27 @@ dependencies = [ [[package]] name = "postgres-protocol" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ee9dd5fe15055d2b6806f4736aa0c9637217074e224bbec46d4041b91bb9491" +checksum = "56201207dac53e2f38e848e31b4b91616a6bb6e0c7205b77718994a7f49e70fc" dependencies = [ "base64 0.22.1", "byteorder", "bytes", "fallible-iterator 0.2.0", - "hmac", + "hmac 0.13.0", "md-5", "memchr", - "rand 0.9.2", - "sha2", + "rand 0.10.0", + "sha2 0.11.0", "stringprep", ] [[package]] name = "postgres-types" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b858f82211e84682fecd373f68e1ceae642d8d751a1ebd13f33de6257b3e20" +checksum = "8dc729a129e682e8d24170cd30ae1aa01b336b096cbb56df6d534ffec133d186" dependencies = [ "bytes", "fallible-iterator 0.2.0", @@ -5376,7 +5445,7 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" dependencies = [ - "toml_edit 0.25.5+spec-1.1.0", + "toml_edit", ] [[package]] @@ -5472,9 +5541,9 @@ dependencies = [ [[package]] name = "pulley-interpreter" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5c8a4c6db43cd896bcc33f316c2f449a89fbec962717e9097d88c9c82547ec0" +checksum = "e9812652c1feb63cf39f8780cecac154a32b22b3665806c733cd4072547233a4" dependencies = [ "cranelift-bitset", "log", @@ -5484,9 +5553,9 @@ dependencies = [ [[package]] name = "pulley-macros" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573407df6287098f3e9ded7873a768156bc97c6939d077924d70416cb529bab6" +checksum = "56000349b6896e3d44286eb9c330891237f40b27fd43c1ccc84547d0b463cb40" dependencies = [ "proc-macro2", "quote", @@ -5789,7 +5858,7 @@ dependencies = [ "http 1.4.0", "http-body 1.0.1", "http-body-util", - "hyper 1.8.1", + "hyper 1.9.0", "hyper-rustls 0.27.7", "hyper-util", "js-sys", @@ -5853,7 +5922,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "hmac", + "hmac 0.12.1", "subtle", ] @@ -5916,8 +5985,8 @@ version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" dependencies = [ - "const-oid", - "digest", + "const-oid 0.9.6", + "digest 0.10.7", "num-bigint-dig", "num-integer", "num-traits", @@ -5950,9 +6019,9 @@ checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" [[package]] name = "rustc-hash" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" [[package]] name = "rustc_version" @@ -6251,6 +6320,10 @@ name = "semver" version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +dependencies = [ + "serde", + "serde_core", +] [[package]] name = "serde" @@ -6298,18 +6371,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_spanned" -version = "1.0.4" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" dependencies = [ "serde_core", ] @@ -6391,7 +6455,7 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures 0.2.17", - "digest", + "digest 0.10.7", ] [[package]] @@ -6402,7 +6466,18 @@ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures 0.2.17", - "digest", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "digest 0.11.2", ] [[package]] @@ -6436,15 +6511,15 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", + "digest 0.10.7", "rand_core 0.6.4", ] [[package]] name = "simd-adler32" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" [[package]] name = "simple_asn1" @@ -7044,9 +7119,9 @@ dependencies = [ [[package]] name = "tokio-postgres" -version = "0.7.16" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcea47c8f71744367793f16c2db1f11cb859d28f436bdb4ca9193eb1f787ee42" +checksum = "4dd8df5ef180f6364759a6f00f7aadda4fbbac86cdee37480826a6ff9f3574ce" dependencies = [ "async-trait", "byteorder", @@ -7061,7 +7136,7 @@ dependencies = [ "pin-project-lite", "postgres-protocol", "postgres-types", - "rand 0.9.2", + "rand 0.10.0", "socket2 0.6.3", "tokio", "tokio-util", @@ -7074,7 +7149,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27d684bad428a0f2481f42241f821db42c54e2dc81d8c00db8536c506b0a0144" dependencies = [ - "const-oid", + "const-oid 0.9.6", "ring", "rustls 0.23.37", "tokio", @@ -7103,6 +7178,28 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-shared-rt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a6bb03ec682a0bb16ce93d19301abc5b98a0d7936477175a156a213dcc47d85" +dependencies = [ + "once_cell", + "tokio", + "tokio-shared-rt-macro", +] + +[[package]] +name = "tokio-shared-rt-macro" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fe49a94e3a984b0d0ab97343dc3dcd52baae1ee13f005bfad39faea47d051dc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "tokio-util" version = "0.7.18" @@ -7116,18 +7213,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" -dependencies = [ - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.11", - "toml_edit 0.22.27", -] - [[package]] name = "toml" version = "0.9.12+spec-1.1.0" @@ -7136,22 +7221,13 @@ checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" dependencies = [ "indexmap 2.13.0", "serde_core", - "serde_spanned 1.0.4", + "serde_spanned", "toml_datetime 0.7.5+spec-1.1.0", "toml_parser", "toml_writer", "winnow 0.7.15", ] -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" -dependencies = [ - "serde", -] - [[package]] name = "toml_datetime" version = "0.7.5+spec-1.1.0" @@ -7163,59 +7239,39 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "1.0.1+spec-1.1.0" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b320e741db58cac564e26c607d3cc1fdc4a88fd36c879568c07856ed83ff3e9" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" dependencies = [ "serde_core", ] [[package]] name = "toml_edit" -version = "0.22.27" +version = "0.25.9+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +checksum = "da053d28fe57e2c9d21b48261e14e7b4c8b670b54d2c684847b91feaf4c7dac5" dependencies = [ "indexmap 2.13.0", - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.11", - "toml_write", - "winnow 0.7.15", -] - -[[package]] -name = "toml_edit" -version = "0.25.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca1a40644a28bce036923f6a431df0b34236949d111cc07cb6dca830c9ef2e1" -dependencies = [ - "indexmap 2.13.0", - "toml_datetime 1.0.1+spec-1.1.0", + "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", - "winnow 1.0.0", + "winnow 1.0.1", ] [[package]] name = "toml_parser" -version = "1.0.10+spec-1.1.0" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7df25b4befd31c4816df190124375d5a20c6b6921e2cad937316de3fccd63420" +checksum = "39ca317ebc49f06bd748bfba29533eac9485569dc9bf80b849024b025e814fb9" dependencies = [ - "winnow 1.0.0", + "winnow 1.0.1", ] -[[package]] -name = "toml_write" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" - [[package]] name = "toml_writer" -version = "1.0.7+spec-1.1.0" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17aaa1c6e3dc22b1da4b6bba97d066e354c7945cac2f7852d4e4e7ca7a6b56d" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" [[package]] name = "totp-rs" @@ -7225,10 +7281,10 @@ checksum = "a2b36a9dd327e9f401320a2cb4572cc76ff43742bcfc3291f871691050f140ba" dependencies = [ "base32", "constant_time_eq", - "hmac", + "hmac 0.12.1", "rand 0.9.2", "sha1", - "sha2", + "sha2 0.10.9", "url", "urlencoding", ] @@ -7495,9 +7551,9 @@ checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" [[package]] name = "unicode-segmentation" -version = "1.12.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" [[package]] name = "unicode-width" @@ -7606,9 +7662,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.22.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37" +checksum = "5ac8b6f42ead25368cf5b098aeb3dc8a1a2c05a3eee8a9a1a68c640edbfc79d9" dependencies = [ "getrandom 0.4.2", "js-sys", @@ -7670,11 +7726,12 @@ dependencies = [ [[package]] name = "wasi-common" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "913b688354290a2890e174c053792c7ea60c47415cef4c0b07548b7eda739c83" +checksum = "f49ffbbd04665d04028f66aee8f24ae7a1f46063f59a28fddfa52ca3091754a2" dependencies = [ "anyhow", + "async-trait", "bitflags 2.11.0", "cap-fs-ext", "cap-rand", @@ -7690,7 +7747,7 @@ dependencies = [ "tracing", "wasmtime", "wiggle", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -7722,9 +7779,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.114" +version = "0.2.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" +checksum = "7dc0882f7b5bb01ae8c5215a1230832694481c1a4be062fd410e12ea3da5b631" dependencies = [ "cfg-if", "once_cell", @@ -7735,23 +7792,19 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.64" +version = "0.4.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" +checksum = "19280959e2844181895ef62f065c63e0ca07ece4771b53d89bfdb967d97cbf05" dependencies = [ - "cfg-if", - "futures-util", "js-sys", - "once_cell", "wasm-bindgen", - "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.114" +version = "0.2.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" +checksum = "75973d3066e01d035dbedaad2864c398df42f8dd7b1ea057c35b8407c015b537" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7759,9 +7812,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.114" +version = "0.2.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" +checksum = "91af5e4be765819e0bcfee7322c14374dc821e35e72fa663a830bbc7dc199eac" dependencies = [ "bumpalo", "proc-macro2", @@ -7772,21 +7825,21 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.114" +version = "0.2.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" +checksum = "c9bf0406a78f02f336bf1e451799cca198e8acde4ffa278f0fb20487b150a633" dependencies = [ "unicode-ident", ] [[package]] name = "wasm-encoder" -version = "0.239.0" +version = "0.243.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" +checksum = "c55db9c896d70bd9fa535ce83cd4e1f2ec3726b0edd2142079f594fc3be1cb35" dependencies = [ "leb128fmt", - "wasmparser 0.239.0", + "wasmparser 0.243.0", ] [[package]] @@ -7801,12 +7854,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.245.1" +version = "0.246.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9dca005e69bf015e45577e415b9af8c67e8ee3c0e38b5b0add5aa92581ed5c" +checksum = "fd6a2708e32c89af1ec5032da7cd19e704dd3d7801614d2a7281f92ca7754350" dependencies = [ "leb128fmt", - "wasmparser 0.245.1", + "wasmparser 0.246.0", ] [[package]] @@ -7836,9 +7889,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.239.0" +version = "0.243.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +checksum = "f6d8db401b0528ec316dfbe579e6ab4152d61739cfe076706d2009127970159d" dependencies = [ "bitflags 2.11.0", "hashbrown 0.15.5", @@ -7861,9 +7914,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.245.1" +version = "0.246.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f08c9adee0428b7bddf3890fc27e015ac4b761cc608c822667102b8bfd6995e" +checksum = "f0fdf25d988bd367244498f2437b2fe78d07d7bd0c66b66d86591ac397b05677" dependencies = [ "bitflags 2.11.0", "indexmap 2.13.0", @@ -7872,20 +7925,20 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.239.0" +version = "0.243.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3981f3d51f39f24f5fc90f93049a90f08dbbca8deba602cd46bb8ca67a94718" +checksum = "eb2b6035559e146114c29a909a3232928ee488d6507a1504d8934e8607b36d7b" dependencies = [ "anyhow", "termcolor", - "wasmparser 0.239.0", + "wasmparser 0.243.0", ] [[package]] name = "wasmtime" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efcab4481a639a8f3413aa011f733db105ecccc1326a51a6f5c7d09c99314f85" +checksum = "e2a83182bf04af87571b4c642300479501684f26bab5597f68f68cded5b098fd" dependencies = [ "addr2line", "anyhow", @@ -7894,6 +7947,7 @@ dependencies = [ "bumpalo", "cc", "cfg-if", + "encoding_rs", "hashbrown 0.15.5", "indexmap 2.13.0", "libc", @@ -7906,16 +7960,17 @@ dependencies = [ "pulley-interpreter", "rayon", "rustix 1.1.4", + "semver", "serde", "serde_derive", "smallvec", "target-lexicon", - "wasm-encoder 0.239.0", - "wasmparser 0.239.0", + "wasm-encoder 0.243.0", + "wasmparser 0.243.0", "wasmtime-environ", - "wasmtime-internal-asm-macros", "wasmtime-internal-cache", "wasmtime-internal-component-macro", + "wasmtime-internal-component-util", "wasmtime-internal-cranelift", "wasmtime-internal-fiber", "wasmtime-internal-jit-debug", @@ -7926,14 +7981,14 @@ dependencies = [ "wasmtime-internal-versioned-export-macros", "wasmtime-internal-winch", "wat", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "wasmtime-environ" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5f8069e3d2a235a8d273e58fc3b2088c730477fe8d5364495d4bf20ddbc45d" +checksum = "cb201c41aa23a3642365cfb2e4a183573d85127a3c9d528f56b9997c984541ab" dependencies = [ "anyhow", "cpp_demangle", @@ -7945,31 +8000,23 @@ dependencies = [ "object", "postcard", "rustc-demangle", + "semver", "serde", "serde_derive", "smallvec", "target-lexicon", - "wasm-encoder 0.239.0", - "wasmparser 0.239.0", + "wasm-encoder 0.243.0", + "wasmparser 0.243.0", "wasmprinter", -] - -[[package]] -name = "wasmtime-internal-asm-macros" -version = "37.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5bdb85a6f168e68d3062fe38c784b2735924cb49733c3ce3e2c9679566c8894" -dependencies = [ - "cfg-if", + "wasmtime-internal-component-util", ] [[package]] name = "wasmtime-internal-cache" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca4dc44ca075a2a22e733e661413d1be5352053c11dbc01042c01a5d7d70037" +checksum = "fb5b3069d1a67ba5969d0eb1ccd7e141367d4e713f4649aa90356c98e8f19bea" dependencies = [ - "anyhow", "base64 0.22.1", "directories-next", "log", @@ -7977,17 +8024,18 @@ dependencies = [ "rustix 1.1.4", "serde", "serde_derive", - "sha2", - "toml 0.8.23", - "windows-sys 0.60.2", + "sha2 0.10.9", + "toml", + "wasmtime-environ", + "windows-sys 0.61.2", "zstd", ] [[package]] name = "wasmtime-internal-component-macro" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf8aa820447f93cfdc089d744361333f16416c1bebc33e234f4fc5d15766dfe8" +checksum = "0c924400db7b6ca996fef1b23beb0f41d5c809836b1ec60fc25b4057e2d25d9b" dependencies = [ "anyhow", "proc-macro2", @@ -7995,22 +8043,21 @@ dependencies = [ "syn 2.0.117", "wasmtime-internal-component-util", "wasmtime-internal-wit-bindgen", - "wit-parser 0.239.0", + "wit-parser 0.243.0", ] [[package]] name = "wasmtime-internal-component-util" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38171538c2612e9d07473f06fcf03d872fe1581e3f7c8587e04e2b2f8e47dcab" +checksum = "7d3f65daf4bf3d74ca2fbbe20af0589c42e2b398a073486451425d94fd4afef4" [[package]] name = "wasmtime-internal-cranelift" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4440d46baa6b12a40ba6beb1476ed023cee02e8fb45629d2666b9a852398c04b" +checksum = "633e889cdae76829738db0114ab3b02fce51ea4a1cd9675a67a65fce92e8b418" dependencies = [ - "anyhow", "cfg-if", "cranelift-codegen", "cranelift-control", @@ -8025,7 +8072,7 @@ dependencies = [ "smallvec", "target-lexicon", "thiserror 2.0.18", - "wasmparser 0.239.0", + "wasmparser 0.243.0", "wasmtime-environ", "wasmtime-internal-math", "wasmtime-internal-unwinder", @@ -8034,25 +8081,24 @@ dependencies = [ [[package]] name = "wasmtime-internal-fiber" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d776059b7f5674f2823b9d283616acfcd7e45b862bfad7c257485621099dea" +checksum = "deb126adc5d0c72695cfb77260b357f1b81705a0f8fa30b3944e7c2219c17341" dependencies = [ - "anyhow", "cc", "cfg-if", "libc", "rustix 1.1.4", - "wasmtime-internal-asm-macros", + "wasmtime-environ", "wasmtime-internal-versioned-export-macros", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "wasmtime-internal-jit-debug" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f189b670fe4e668015cace8a1df1faae03ed9f6b2b638a504204336b4b34de2" +checksum = "8e66ff7f90a8002187691ff6237ffd09f954a0ebb9de8b2ff7f5c62632134120" dependencies = [ "cc", "wasmtime-internal-versioned-export-macros", @@ -8060,49 +8106,49 @@ dependencies = [ [[package]] name = "wasmtime-internal-jit-icache-coherence" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f138fe8652acc4cf8d5de15952a6b6c4bdef10479d33199cc6d50c3fbe778cdd" +checksum = "4b96df23179ae16d54fb3a420f84ffe4383ec9dd06fad3e5bc782f85f66e8e08" dependencies = [ "anyhow", "cfg-if", "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "wasmtime-internal-math" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f9a2bff5db67f19f3d2f7b6ed4b4f67def9917111b824595eb84ef8e43c008e" +checksum = "86d1380926682b44c383e9a67f47e7a95e60c6d3fa8c072294dab2c7de6168a0" dependencies = [ "libm", ] [[package]] name = "wasmtime-internal-slab" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eafd48d67f1aae5a188c4842bee9de2c9f0e7a07626136e54223a0eb63bd4bca" +checksum = "9b63cbea1c0192c7feb7c0dfb35f47166988a3742f29f46b585ef57246c65764" [[package]] name = "wasmtime-internal-unwinder" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73cb01a1d8cd95583ac06cb82fc2ad465e893c3ed7d9765f750dfd9d2483a411" +checksum = "f25c392c7e5fb891a7416e3c34cfbd148849271e8c58744fda875dde4bec4d6a" dependencies = [ - "anyhow", "cfg-if", "cranelift-codegen", "log", "object", + "wasmtime-environ", ] [[package]] name = "wasmtime-internal-versioned-export-macros" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d46615cb9e10960b72cc6f4b2220062523c06d25fff33a4e61d525a4f73ee8c6" +checksum = "70f8b9796a3f0451a7b702508b303d654de640271ac80287176de222f187a237" dependencies = [ "proc-macro2", "quote", @@ -8111,17 +8157,16 @@ dependencies = [ [[package]] name = "wasmtime-internal-winch" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cd3b2c652e93a8b3d6499f3299e46cb58db076a4477ddef594be9089f4cac38" +checksum = "c0063e61f1d0b2c20e9cfc58361a6513d074a23c80b417aac3033724f51648a0" dependencies = [ - "anyhow", "cranelift-codegen", "gimli", "log", "object", "target-lexicon", - "wasmparser 0.239.0", + "wasmparser 0.243.0", "wasmtime-environ", "wasmtime-internal-cranelift", "winch-codegen", @@ -8129,15 +8174,15 @@ dependencies = [ [[package]] name = "wasmtime-internal-wit-bindgen" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98aaee67f9f92aa730a0e6e977474d056f7d9c15ba259494574e3c2d0b75e14" +checksum = "587699ca7cae16b4a234ffcc834f37e75675933d533809919b52975f5609e2ef" dependencies = [ "anyhow", "bitflags 2.11.0", "heck 0.5.0", "indexmap 2.13.0", - "wit-parser 0.239.0", + "wit-parser 0.243.0", ] [[package]] @@ -8151,31 +8196,31 @@ dependencies = [ [[package]] name = "wast" -version = "245.0.1" +version = "246.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cf1149285569120b8ce39db8b465e8a2b55c34cbb586bd977e43e2bc7300bf" +checksum = "d79efc79fe1c8f3aef1b8b991f26721b389be7423ce5b3a3ec0de56c97a0959a" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width", - "wasm-encoder 0.245.1", + "wasm-encoder 0.246.0", ] [[package]] name = "wat" -version = "1.245.1" +version = "1.246.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd48d1679b6858988cb96b154dda0ec5bbb09275b71db46057be37332d5477be" +checksum = "dc737e3097dfced3030dd15721711cc26781943b59e1499492f8ee1e63245126" dependencies = [ - "wast 245.0.1", + "wast 246.0.0", ] [[package]] name = "web-sys" -version = "0.3.91" +version = "0.3.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" +checksum = "749466a37ee189057f54748b200186b59a03417a117267baf3fd89cecc9fb837" dependencies = [ "js-sys", "wasm-bindgen", @@ -8260,12 +8305,11 @@ dependencies = [ [[package]] name = "wiggle" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a792fe35c2ba3092e8ed3b832a5a671f3076861628f9e9810f6ad7de802007" +checksum = "a69a60bcbe1475c5dc9ec89210ade54823d44f742e283cba64f98f89697c4cec" dependencies = [ "anyhow", - "async-trait", "bitflags 2.11.0", "thiserror 2.0.18", "tracing", @@ -8276,9 +8320,9 @@ dependencies = [ [[package]] name = "wiggle-generate" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "661421edf501b09b2ae7e2ffd234dd2947be67d4ca320c41da2325592543b181" +checksum = "21f3dc0fd4dcfc7736434bb216179a2147835309abc09bf226736a40d484548f" dependencies = [ "anyhow", "heck 0.5.0", @@ -8290,9 +8334,9 @@ dependencies = [ [[package]] name = "wiggle-macro" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e2741d47a84e93ae623216d8b6cc2b42e3b659ca987d44fffd4f020a1dc56c" +checksum = "fea2aea744eded58ae092bf57110c27517dab7d5a300513ff13897325c5c5021" dependencies = [ "proc-macro2", "quote", @@ -8333,9 +8377,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winch-codegen" -version = "37.0.3" +version = "41.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece82b2b1513521f0bf419a61b4a6151bc99ee2906f3d51a75faf92c38c9b041" +checksum = "c55de3ac5b8bd71e5f6c87a9e511dd3ceb194bdb58183c6a7bf21cd8c0e46fbc" dependencies = [ "anyhow", "cranelift-assembler-x64", @@ -8345,7 +8389,7 @@ dependencies = [ "smallvec", "target-lexicon", "thiserror 2.0.18", - "wasmparser 0.239.0", + "wasmparser 0.243.0", "wasmtime-environ", "wasmtime-internal-cranelift", "wasmtime-internal-math", @@ -8446,15 +8490,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.5", -] - [[package]] name = "windows-sys" version = "0.61.2" @@ -8503,30 +8538,13 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", + "windows_i686_gnullvm", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] -[[package]] -name = "windows-targets" -version = "0.53.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm 0.53.1", - "windows_aarch64_msvc 0.53.1", - "windows_i686_gnu 0.53.1", - "windows_i686_gnullvm 0.53.1", - "windows_i686_msvc 0.53.1", - "windows_x86_64_gnu 0.53.1", - "windows_x86_64_gnullvm 0.53.1", - "windows_x86_64_msvc 0.53.1", -] - [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -8545,12 +8563,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -8569,12 +8581,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -8593,24 +8599,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -8629,12 +8623,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -8653,12 +8641,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -8677,12 +8659,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -8701,26 +8677,17 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - [[package]] name = "winnow" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" -dependencies = [ - "memchr", -] [[package]] name = "winnow" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a90e88e4667264a994d34e6d1ab2d26d398dcdca8b7f52bec8668957517fc7d8" +checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5" dependencies = [ "memchr", ] @@ -8817,9 +8784,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.239.0" +version = "0.243.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55c92c939d667b7bf0c6bf2d1f67196529758f99a2a45a3355cc56964fd5315d" +checksum = "df983a8608e513d8997f435bb74207bf0933d0e49ca97aa9d8a6157164b9b7fc" dependencies = [ "anyhow", "id-arena", @@ -8830,7 +8797,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.239.0", + "wasmparser 0.243.0", ] [[package]] @@ -8875,7 +8842,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1301e935010a701ae5f8655edc0ad17c44bad3ac5ce8c39185f75453b720ae94" dependencies = [ - "const-oid", + "const-oid 0.9.6", "der", "spki", "tls_codec", @@ -8949,18 +8916,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.47" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.47" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index dcfda60fe4..db6efe3677 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -191,8 +191,8 @@ base64 = "0.22.1" uuid = { version = "1.22.0", features = ["serde"] } anyhow = { version = "1.0.102", features = ["backtrace"] } diesel_ltree = "0.4.0" -serial_test = "3.4.0" tokio = { version = "1.50.0", features = ["full"] } +tokio-shared-rt = "0.1.0" regex = "1.12.3" diesel-derive-newtype = "2.1.2" diesel-derive-enum = { version = "2.1.0", features = ["postgres"] } diff --git a/crates/api/api/Cargo.toml b/crates/api/api/Cargo.toml index a92ab4d516..81b7d82e9f 100644 --- a/crates/api/api/Cargo.toml +++ b/crates/api/api/Cargo.toml @@ -73,8 +73,8 @@ diesel = { workspace = true } lemmy_diesel_utils = { workspace = true } [dev-dependencies] -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } elementtree = "1.2.3" pretty_assertions = { workspace = true } lemmy_api_crud = { workspace = true } diff --git a/crates/api/api/src/federation/resolve_object.rs b/crates/api/api/src/federation/resolve_object.rs index b51e0f1dc9..7b2f770fe5 100644 --- a/crates/api/api/src/federation/resolve_object.rs +++ b/crates/api/api/src/federation/resolve_object.rs @@ -125,10 +125,8 @@ mod tests { }; use lemmy_diesel_utils::traits::Crud; use lemmy_utils::error::LemmyErrorType; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_object_visibility() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); diff --git a/crates/api/api/src/federation/user_settings_backup.rs b/crates/api/api/src/federation/user_settings_backup.rs index ab571f91e9..4dccf68931 100644 --- a/crates/api/api/src/federation/user_settings_backup.rs +++ b/crates/api/api/src/federation/user_settings_backup.rs @@ -313,12 +313,10 @@ pub(crate) mod tests { use lemmy_db_views_local_user::LocalUserView; use lemmy_diesel_utils::traits::Crud; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; - use serial_test::serial; use std::time::Duration; use tokio::time::sleep; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_settings_export_import() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); @@ -388,8 +386,7 @@ pub(crate) mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn disallow_large_backup() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); @@ -425,8 +422,7 @@ pub(crate) mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn import_partial_backup() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); diff --git a/crates/api/api/src/site/mod_log.rs b/crates/api/api/src/site/mod_log.rs index 1afdfd5020..0b5b46d05d 100644 --- a/crates/api/api/src/site/mod_log.rs +++ b/crates/api/api/src/site/mod_log.rs @@ -72,7 +72,6 @@ mod tests { use lemmy_diesel_utils::{connection::DbPool, traits::Crud}; use lemmy_utils::error::LemmyErrorType; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { instance: Instance, @@ -93,8 +92,7 @@ mod tests { local_site, }) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_mod_remove_or_restore_data() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); @@ -395,8 +393,7 @@ mod tests { /// Verifies that remove_or_restore_user_data sets bulk_action_parent_id on all child entries /// when a real parent ModlogId is provided - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_bulk_parent_id_propagated() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); diff --git a/crates/api/api/src/site/registration_applications/tests.rs b/crates/api/api/src/site/registration_applications/tests.rs index 42d99003e6..ba18af2ec7 100644 --- a/crates/api/api/src/site/registration_applications/tests.rs +++ b/crates/api/api/src/site/registration_applications/tests.rs @@ -27,7 +27,6 @@ use lemmy_db_views_registration_applications::{ use lemmy_db_views_site::api::EditSite; use lemmy_diesel_utils::{connection::DbPool, traits::Crud}; use lemmy_utils::{CACHE_DURATION_API, error::LemmyResult}; -use serial_test::serial; async fn create_test_site(context: &Data) -> LemmyResult<(TestData, LocalUserView)> { let pool = &mut context.pool(); @@ -122,8 +121,7 @@ async fn get_application_statuses( )) } -#[serial] -#[tokio::test] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] #[expect(clippy::indexing_slicing)] async fn test_application_approval() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; diff --git a/crates/api/api_utils/Cargo.toml b/crates/api/api_utils/Cargo.toml index 41c9a68138..09fc403dd6 100644 --- a/crates/api/api_utils/Cargo.toml +++ b/crates/api/api_utils/Cargo.toml @@ -81,7 +81,7 @@ lemmy_diesel_utils = { workspace = true } rustls = { workspace = true } [dev-dependencies] -serial_test = { workspace = true } pretty_assertions = { workspace = true } lemmy_db_views_notification = { workspace = true, features = ["full"] } diesel_ltree = { workspace = true } +tokio-shared-rt = { workspace = true } diff --git a/crates/api/api_utils/src/claims.rs b/crates/api/api_utils/src/claims.rs index af8c79eed8..740fb6467c 100644 --- a/crates/api/api_utils/src/claims.rs +++ b/crates/api/api_utils/src/claims.rs @@ -92,10 +92,8 @@ mod tests { use lemmy_diesel_utils::traits::Crud; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_should_not_validate_user_token_after_password_change() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); diff --git a/crates/api/api_utils/src/context.rs b/crates/api/api_utils/src/context.rs index 2eb4aed828..f1078ddd4c 100644 --- a/crates/api/api_utils/src/context.rs +++ b/crates/api/api_utils/src/context.rs @@ -1,7 +1,7 @@ use crate::request::client_builder; use activitypub_federation::config::{Data, FederationConfig}; use lemmy_db_schema::source::secret::Secret; -use lemmy_diesel_utils::connection::{ActualDbPool, DbPool, build_db_pool_for_tests}; +use lemmy_diesel_utils::connection::{DbPool, GenericDbPool, build_db_pool_for_tests}; use lemmy_utils::{ rate_limit::RateLimit, settings::{SETTINGS, structs::Settings}, @@ -11,7 +11,7 @@ use std::sync::Arc; #[derive(Clone)] pub struct LemmyContext { - pool: ActualDbPool, + pool: GenericDbPool, client: Arc, /// Pictrs requests must bypass proxy. Unfortunately no_proxy can only be set on ClientBuilder /// and not on RequestBuilder, so we need a separate client here. @@ -22,7 +22,7 @@ pub struct LemmyContext { impl LemmyContext { pub fn create( - pool: ActualDbPool, + pool: GenericDbPool, client: ClientWithMiddleware, pictrs_client: ClientWithMiddleware, secret: Secret, @@ -37,9 +37,12 @@ impl LemmyContext { } } pub fn pool(&self) -> DbPool<'_> { - DbPool::Pool(&self.pool) + match &self.pool { + GenericDbPool::Actual(pool) => DbPool::Pool(pool), + GenericDbPool::Reusable(pool) => DbPool::ReusablePool(pool), + } } - pub fn inner_pool(&self) -> &ActualDbPool { + pub fn inner_pool(&self) -> &GenericDbPool { &self.pool } pub fn client(&self) -> &ClientWithMiddleware { @@ -64,7 +67,7 @@ impl LemmyContext { #[expect(clippy::expect_used)] pub async fn init_test_federation_config() -> FederationConfig { // call this to run migrations - let pool = build_db_pool_for_tests(); + let pool = build_db_pool_for_tests().await; let client = client_builder(&SETTINGS).build().expect("build client"); @@ -77,7 +80,7 @@ impl LemmyContext { let rate_limit_cell = RateLimit::with_debug_config(); let context = LemmyContext::create( - pool, + GenericDbPool::Reusable(Arc::new(pool)), client.clone(), client, secret, diff --git a/crates/api/api_utils/src/notify.rs b/crates/api/api_utils/src/notify.rs index 007708e329..6f1fb848ba 100644 --- a/crates/api/api_utils/src/notify.rs +++ b/crates/api/api_utils/src/notify.rs @@ -400,7 +400,6 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { instance: Instance, @@ -508,8 +507,7 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn replies() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); @@ -605,10 +603,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn mentions() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -746,8 +743,7 @@ mod tests { } } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn read_private_messages() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); @@ -800,8 +796,7 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn ensure_private_message_person_block() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); @@ -842,8 +837,7 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn ensure_private_message_instance_block() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); @@ -888,8 +882,7 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn private_message_delete_by_recipient() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); diff --git a/crates/api/api_utils/src/request.rs b/crates/api/api_utils/src/request.rs index 01c7f1f7da..c1d43532d1 100644 --- a/crates/api/api_utils/src/request.rs +++ b/crates/api/api_utils/src/request.rs @@ -582,12 +582,10 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; use url::Url; // These helped with testing - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_link_metadata() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let sample_url = Url::parse("https://gitlab.com/IzzyOnDroid/repo/-/wikis/FAQ")?; diff --git a/crates/api/api_utils/src/utils.rs b/crates/api/api_utils/src/utils.rs index 912cd7755f..493ff29c82 100644 --- a/crates/api/api_utils/src/utils.rs +++ b/crates/api/api_utils/src/utils.rs @@ -1047,7 +1047,6 @@ mod tests { test_data::TestData, }; use pretty_assertions::assert_eq; - use serial_test::serial; #[test] #[rustfmt::skip] @@ -1083,8 +1082,7 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_proxy_image_link() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; diff --git a/crates/apub/apub/Cargo.toml b/crates/apub/apub/Cargo.toml index b1492fc834..0c6f70c431 100644 --- a/crates/apub/apub/Cargo.toml +++ b/crates/apub/apub/Cargo.toml @@ -49,5 +49,5 @@ either = { workspace = true } chrono = { workspace = true } [dev-dependencies] -serial_test = { workspace = true } pretty_assertions = { workspace = true } +tokio-shared-rt = { workspace = true } diff --git a/crates/apub/apub/src/collections/community_moderators.rs b/crates/apub/apub/src/collections/community_moderators.rs index 2deb5ca666..a48a0ae5a5 100644 --- a/crates/apub/apub/src/collections/community_moderators.rs +++ b/crates/apub/apub/src/collections/community_moderators.rs @@ -111,10 +111,8 @@ mod tests { test_data::TestData, }; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_parse_lemmy_community_moderators() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let data = TestData::create(&mut context.pool()).await?; diff --git a/crates/apub/apub/src/http/community.rs b/crates/apub/apub/src/http/community.rs index 4b5b4b95cd..8c38953bf1 100644 --- a/crates/apub/apub/src/http/community.rs +++ b/crates/apub/apub/src/http/community.rs @@ -243,7 +243,6 @@ pub(crate) mod tests { }; use lemmy_diesel_utils::traits::Crud; use serde::de::DeserializeOwned; - use serial_test::serial; use url::Url; async fn init( @@ -278,8 +277,7 @@ pub(crate) mod tests { Ok(serde_json::from_str(body)?) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_get_community() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let (data, community, path) = init(false, CommunityVisibility::Public, &context).await?; @@ -317,8 +315,7 @@ pub(crate) mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_get_deleted_community() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let (data, _, path) = init(true, CommunityVisibility::Public, &context).await?; @@ -347,8 +344,7 @@ pub(crate) mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_get_local_only_community() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let (data, _, path) = init(false, CommunityVisibility::LocalOnlyPrivate, &context).await?; @@ -373,8 +369,7 @@ pub(crate) mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_outbox_deleted_user() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let (data, community, path) = init(false, CommunityVisibility::Public, &context).await?; diff --git a/crates/apub/apub/src/lib.rs b/crates/apub/apub/src/lib.rs index 7b4a9f82ba..4f23f73e5b 100644 --- a/crates/apub/apub/src/lib.rs +++ b/crates/apub/apub/src/lib.rs @@ -4,7 +4,7 @@ use chrono::{Days, Utc}; use lemmy_api_utils::context::LemmyContext; use lemmy_apub_objects::utils::functions::{check_apub_id_valid, local_site_data_cached}; use lemmy_db_views_site::SiteView; -use lemmy_diesel_utils::connection::ActualDbPool; +use lemmy_diesel_utils::connection::GenericDbPool; use lemmy_utils::error::{LemmyError, LemmyErrorType, LemmyResult, UntranslatedError}; use url::Url; @@ -17,7 +17,7 @@ pub mod protocol; pub const FEDERATION_HTTP_FETCH_LIMIT: u32 = 100; #[derive(Clone)] -pub struct VerifyUrlData(pub ActualDbPool); +pub struct VerifyUrlData(pub GenericDbPool); #[async_trait] impl UrlVerifier for VerifyUrlData { diff --git a/crates/apub/objects/Cargo.toml b/crates/apub/objects/Cargo.toml index bb3d5d7db0..33de1babf7 100644 --- a/crates/apub/objects/Cargo.toml +++ b/crates/apub/objects/Cargo.toml @@ -54,8 +54,8 @@ lemmy_diesel_utils = { workspace = true } regex = { workspace = true } [dev-dependencies] -serial_test = { workspace = true } pretty_assertions = { workspace = true } +tokio-shared-rt = { workspace = true } [package.metadata.cargo-shear] ignored = ["futures-util"] diff --git a/crates/apub/objects/src/objects/comment.rs b/crates/apub/objects/src/objects/comment.rs index f12a7a8219..01e4793204 100644 --- a/crates/apub/objects/src/objects/comment.rs +++ b/crates/apub/objects/src/objects/comment.rs @@ -254,7 +254,6 @@ pub(crate) mod tests { use html2md::parse_html; use lemmy_db_schema::{source::instance::Instance, test_data::TestData}; use pretty_assertions::assert_eq; - use serial_test::serial; async fn prepare_comment_test( url: &Url, @@ -270,8 +269,7 @@ pub(crate) mod tests { Ok((person, community, post, site)) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] pub(crate) async fn test_parse_lemmy_comment() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let test_data = TestData::create(&mut context.pool()).await?; @@ -295,8 +293,7 @@ pub(crate) mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_parse_pleroma_comment() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let test_data = TestData::create(&mut context.pool()).await?; @@ -322,8 +319,7 @@ pub(crate) mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_html_to_markdown_sanitize() { let parsed = parse_html("hello"); assert_eq!(parsed, "**hello**"); diff --git a/crates/apub/objects/src/objects/community.rs b/crates/apub/objects/src/objects/community.rs index 5a7e79798d..fbf82d390f 100644 --- a/crates/apub/objects/src/objects/community.rs +++ b/crates/apub/objects/src/objects/community.rs @@ -296,10 +296,8 @@ pub(crate) mod tests { use crate::utils::test::{parse_lemmy_community, parse_lemmy_instance}; use lemmy_db_schema::{source::instance::Instance, test_data::TestData}; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_parse_lemmy_community() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let test_data = TestData::create(&mut context.pool()).await?; diff --git a/crates/apub/objects/src/objects/instance.rs b/crates/apub/objects/src/objects/instance.rs index f8862a7251..5a463ae8cf 100644 --- a/crates/apub/objects/src/objects/instance.rs +++ b/crates/apub/objects/src/objects/instance.rs @@ -219,10 +219,8 @@ pub(crate) mod tests { use crate::utils::test::parse_lemmy_instance; use lemmy_db_schema::{source::instance::Instance, test_data::TestData}; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_parse_lemmy_instance() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let test_data = TestData::create(&mut context.pool()).await?; diff --git a/crates/apub/objects/src/objects/person.rs b/crates/apub/objects/src/objects/person.rs index 7bb8819e1f..0ad19fd0b4 100644 --- a/crates/apub/objects/src/objects/person.rs +++ b/crates/apub/objects/src/objects/person.rs @@ -215,10 +215,8 @@ pub(crate) mod tests { use activitypub_federation::fetch::object_id::ObjectId; use lemmy_db_schema::{source::instance::Instance, test_data::TestData}; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_parse_lemmy_person() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let test_data = TestData::create(&mut context.pool()).await?; @@ -233,8 +231,7 @@ pub(crate) mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_parse_pleroma_person() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let test_data = TestData::create(&mut context.pool()).await?; diff --git a/crates/apub/objects/src/objects/post.rs b/crates/apub/objects/src/objects/post.rs index 6dd118165c..484a56633d 100644 --- a/crates/apub/objects/src/objects/post.rs +++ b/crates/apub/objects/src/objects/post.rs @@ -384,10 +384,8 @@ mod tests { }; use lemmy_db_schema::{source::instance::Instance, test_data::TestData}; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_parse_lemmy_post() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let test_data = TestData::create(&mut context.pool()).await?; @@ -412,8 +410,7 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_convert_mastodon_post_title() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let test_data = TestData::create(&mut context.pool()).await?; diff --git a/crates/apub/objects/src/objects/private_message.rs b/crates/apub/objects/src/objects/private_message.rs index c59054ac1c..e0d20f3206 100644 --- a/crates/apub/objects/src/objects/private_message.rs +++ b/crates/apub/objects/src/objects/private_message.rs @@ -187,7 +187,6 @@ mod tests { use assert_json_diff::assert_json_include; use lemmy_db_schema::test_data::TestData; use pretty_assertions::assert_eq; - use serial_test::serial; async fn prepare_comment_test( url: &Url, @@ -205,8 +204,7 @@ mod tests { Ok((person1, person2, site)) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_parse_lemmy_pm() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let test_data = TestData::create(&mut context.pool()).await?; @@ -229,8 +227,7 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_parse_pleroma_pm() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let test_data = TestData::create(&mut context.pool()).await?; diff --git a/crates/apub/objects/src/utils/markdown_links.rs b/crates/apub/objects/src/utils/markdown_links.rs index 7fa51e1d87..d9cc46fbcc 100644 --- a/crates/apub/objects/src/utils/markdown_links.rs +++ b/crates/apub/objects/src/utils/markdown_links.rs @@ -79,10 +79,8 @@ mod tests { use lemmy_diesel_utils::traits::Crud; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; - #[serial] - #[tokio::test] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_markdown_rewrite_remote_links() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let data = TestData::create(&mut context.pool()).await?; @@ -140,7 +138,6 @@ mod tests { ), ]; - let context = LemmyContext::init_test_context().await; for (msg, input, expected) in &tests { let result = markdown_rewrite_remote_links(input.clone(), &context).await; diff --git a/crates/apub/send/Cargo.toml b/crates/apub/send/Cargo.toml index b7fde589ea..48f0502b6d 100644 --- a/crates/apub/send/Cargo.toml +++ b/crates/apub/send/Cargo.toml @@ -48,13 +48,14 @@ tokio-util = "0.7.18" lemmy_diesel_utils = { workspace = true } [dev-dependencies] -serial_test = { workspace = true } url.workspace = true actix-web.workspace = true tracing-test = "0.2.6" uuid.workspace = true test-context = "0.5.5" mockall = "0.14.0" +serial_test = "3.4.0" +tokio-shared-rt = { workspace = true } [lib] doctest = false diff --git a/crates/apub/send/src/inboxes.rs b/crates/apub/send/src/inboxes.rs index ac78cc7939..218ce2f392 100644 --- a/crates/apub/send/src/inboxes.rs +++ b/crates/apub/send/src/inboxes.rs @@ -7,7 +7,7 @@ use lemmy_db_schema::{ use lemmy_db_schema_file::InstanceId; use lemmy_db_views_community_follower::CommunityFollowerView; use lemmy_diesel_utils::{ - connection::{ActualDbPool, DbPool}, + connection::{DbPool, GenericDbPool}, dburl::DbUrl, }; use lemmy_utils::error::LemmyResult; @@ -50,18 +50,18 @@ pub trait DataSource: Send + Sync { ) -> LemmyResult>; } pub struct DbDataSource { - pool: ActualDbPool, + pool: GenericDbPool, } impl DbDataSource { - pub fn new(pool: ActualDbPool) -> Self { + pub fn new(pool: GenericDbPool) -> Self { Self { pool } } } impl DataSource for DbDataSource { async fn read_site_from_instance_id(&self, instance_id: InstanceId) -> LemmyResult { - Site::read_from_instance_id(&mut DbPool::Pool(&self.pool), instance_id).await + Site::read_from_instance_id(&mut DbPool::from(&self.pool), instance_id).await } async fn get_instance_followed_community_inboxes( @@ -70,7 +70,7 @@ impl DataSource for DbDataSource { last_fetch: DateTime, ) -> LemmyResult> { CommunityFollowerView::get_instance_followed_community_inboxes( - &mut DbPool::Pool(&self.pool), + &mut DbPool::from(&self.pool), instance_id, last_fetch, ) @@ -97,7 +97,7 @@ pub type RealCommunityInboxCollector = CommunityInboxCollector; impl CommunityInboxCollector { pub fn new_real( - pool: ActualDbPool, + pool: GenericDbPool, instance_id: InstanceId, domain: String, ) -> RealCommunityInboxCollector { diff --git a/crates/apub/send/src/lib.rs b/crates/apub/send/src/lib.rs index 48b8affa11..e7577c3350 100644 --- a/crates/apub/send/src/lib.rs +++ b/crates/apub/send/src/lib.rs @@ -206,7 +206,6 @@ mod test { }; use lemmy_diesel_utils::traits::Crud; use lemmy_utils::error::LemmyError; - use serial_test::serial; use std::{ collections::HashSet, sync::{Arc, Mutex}, @@ -273,8 +272,7 @@ mod test { } /// Basic test with default params and only active/allowed instances - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_send_manager() -> LemmyResult<()> { let mut data = TestData::init(1, 1).await?; @@ -289,8 +287,7 @@ mod test { } /// Running with multiple processes should start correct workers - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_send_manager_processes() -> LemmyResult<()> { let active = Arc::new(Mutex::new(vec![])); let execute = |count, index, active: Arc>>| async move { @@ -314,8 +311,7 @@ mod test { } /// Use blocklist, should not send to blocked instances - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_send_manager_blocked() -> LemmyResult<()> { let mut data = TestData::init(1, 1).await?; @@ -336,8 +332,7 @@ mod test { } /// Use allowlist, should only send to allowed instance - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_send_manager_allowed() -> LemmyResult<()> { let mut data = TestData::init(1, 1).await?; @@ -357,8 +352,7 @@ mod test { } /// Mark instance as dead, there should be no worker created for it - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_send_manager_dead() -> LemmyResult<()> { let mut data = TestData::init(1, 1).await?; diff --git a/crates/apub/send/src/stats.rs b/crates/apub/send/src/stats.rs index d75713d878..39f807ac20 100644 --- a/crates/apub/send/src/stats.rs +++ b/crates/apub/send/src/stats.rs @@ -2,7 +2,7 @@ use crate::util::{FederationQueueStateWithDomain, get_latest_activity_id}; use chrono::Local; use lemmy_db_schema::newtypes::ActivityId; use lemmy_db_schema_file::InstanceId; -use lemmy_diesel_utils::connection::{ActualDbPool, DbPool}; +use lemmy_diesel_utils::connection::{DbPool, GenericDbPool}; use lemmy_utils::{error::LemmyResult, federate_retry_sleep_duration}; use std::{collections::HashMap, time::Duration}; use tokio::{sync::mpsc::UnboundedReceiver, time::interval}; @@ -11,10 +11,10 @@ use tracing::{debug, info, warn}; /// every 60s, print the state for every instance. exits if the receiver is done (all senders /// dropped) pub(crate) async fn receive_print_stats( - pool: ActualDbPool, + pool: GenericDbPool, mut receiver: UnboundedReceiver, ) { - let pool = &mut DbPool::Pool(&pool); + let pool = &mut DbPool::from(&pool); let mut printerval = interval(Duration::from_secs(60)); let mut stats = HashMap::new(); loop { diff --git a/crates/apub/send/src/worker.rs b/crates/apub/send/src/worker.rs index b9f9fbd9f1..4ef158641b 100644 --- a/crates/apub/send/src/worker.rs +++ b/crates/apub/send/src/worker.rs @@ -19,7 +19,7 @@ use lemmy_db_schema::{ instance::{Instance, InstanceForm}, }, }; -use lemmy_diesel_utils::connection::{ActualDbPool, DbPool}; +use lemmy_diesel_utils::connection::{DbPool, GenericDbPool}; use lemmy_utils::{ error::LemmyResult, federate_retry_sleep_duration, @@ -65,7 +65,7 @@ pub(crate) struct InstanceWorker { federation_worker_config: FederationWorkerConfig, state: FederationQueueState, last_state_insert: DateTime, - pool: ActualDbPool, + pool: GenericDbPool, inbox_collector: RealCommunityInboxCollector, // regularily send stats back to the SendManager stats_sender: UnboundedSender, @@ -89,9 +89,8 @@ impl InstanceWorker { stats_sender: UnboundedSender, ) -> LemmyResult<()> { let pool = config.to_request_data().inner_pool().clone(); - let state = FederationQueueState::load(&mut DbPool::Pool(&pool), instance.id).await?; - let (report_send_result, receive_send_result) = - tokio::sync::mpsc::unbounded_channel::(); + let state = FederationQueueState::load(&mut DbPool::from(&pool), instance.id).await?; + let (report_send_result, receive_send_result) = mpsc::unbounded_channel::(); let mut worker = InstanceWorker { inbox_collector: RealCommunityInboxCollector::new_real( pool.clone(), @@ -442,7 +441,7 @@ impl InstanceWorker { } fn pool(&self) -> DbPool<'_> { - DbPool::Pool(&self.pool) + DbPool::from(&self.pool) } } diff --git a/crates/db_schema/Cargo.toml b/crates/db_schema/Cargo.toml index 4bd96ebf45..d837c509f7 100644 --- a/crates/db_schema/Cargo.toml +++ b/crates/db_schema/Cargo.toml @@ -48,7 +48,11 @@ lemmy_diesel_utils = { workspace = true } bcrypt = { workspace = true, optional = true } diesel = { workspace = true, optional = true } diesel-derive-newtype = { workspace = true, optional = true } -diesel-async = { workspace = true, optional = true } +diesel-async = { workspace = true, features = [ + "deadpool", + "postgres", + "async-connection-wrapper", +], optional = true } diesel-uplete = { workspace = true, optional = true } diesel_ltree = { workspace = true, optional = true } ts-rs = { workspace = true, optional = true } @@ -57,5 +61,8 @@ i-love-jesus = { workspace = true, optional = true } derive-new.workspace = true [dev-dependencies] -serial_test = { workspace = true } pretty_assertions = { workspace = true } +tokio-shared-rt = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_schema/src/impls/activity.rs b/crates/db_schema/src/impls/activity.rs index 0627a1db93..9a81568d58 100644 --- a/crates/db_schema/src/impls/activity.rs +++ b/crates/db_schema/src/impls/activity.rs @@ -70,13 +70,11 @@ mod tests { use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; use serde_json::json; - use serial_test::serial; use url::Url; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn receive_activity_duplicate() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let ap_id: DbUrl = Url::parse("http://example.com/activity/531")?.into(); @@ -88,10 +86,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn sent_activity_write_read() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let ap_id: DbUrl = Url::parse("http://example.com/activity/412")?.into(); let data = json!({ diff --git a/crates/db_schema/src/impls/actor_language.rs b/crates/db_schema/src/impls/actor_language.rs index 861fb529d6..d2e903c997 100644 --- a/crates/db_schema/src/impls/actor_language.rs +++ b/crates/db_schema/src/impls/actor_language.rs @@ -357,7 +357,6 @@ mod tests { }; use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use pretty_assertions::assert_eq; - use serial_test::serial; async fn test_langs1(pool: &mut DbPool<'_>) -> LemmyResult> { Ok(vec![ @@ -373,10 +372,9 @@ mod tests { ]) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_convert_update_languages() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); // call with empty vec, returns all languages @@ -392,10 +390,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_site_languages() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = TestData::create(pool).await?; @@ -415,10 +412,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_user_languages() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = TestData::create(pool).await?; @@ -447,10 +443,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_community_languages() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = TestData::create(pool).await?; let test_langs = test_langs1(pool).await?; @@ -502,10 +497,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_validate_post_language() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = TestData::create(pool).await?; let test_langs = test_langs1(pool).await?; diff --git a/crates/db_schema/src/impls/comment.rs b/crates/db_schema/src/impls/comment.rs index 034427e847..cd01b1b89b 100644 --- a/crates/db_schema/src/impls/comment.rs +++ b/crates/db_schema/src/impls/comment.rs @@ -456,13 +456,11 @@ mod tests { use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; use url::Url; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_crud() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "my_domain.tld").await?; @@ -576,10 +574,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_aggregates() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "my_domain.tld").await?; @@ -675,10 +672,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_update_children() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "mydomain.tld").await?; @@ -748,10 +744,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_remove_post_children() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "mydomain.tld").await?; diff --git a/crates/db_schema/src/impls/community.rs b/crates/db_schema/src/impls/community.rs index 33976933bd..b58aab7166 100644 --- a/crates/db_schema/src/impls/community.rs +++ b/crates/db_schema/src/impls/community.rs @@ -688,12 +688,10 @@ mod tests { use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_crud() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "my_domain.tld").await?; @@ -841,10 +839,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_aggregates() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "my_domain.tld").await?; diff --git a/crates/db_schema/src/impls/federation_allowlist.rs b/crates/db_schema/src/impls/federation_allowlist.rs index 7ed68fb830..5d5c546d75 100644 --- a/crates/db_schema/src/impls/federation_allowlist.rs +++ b/crates/db_schema/src/impls/federation_allowlist.rs @@ -30,12 +30,10 @@ mod tests { use crate::source::instance::Instance; use lemmy_diesel_utils::connection::build_db_pool_for_tests; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_allowlist_insert_and_clear() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let instances = vec![ Instance::read_or_create(pool, "tld1.xyz").await?, diff --git a/crates/db_schema/src/impls/language.rs b/crates/db_schema/src/impls/language.rs index f9c1a45637..2875b8f823 100644 --- a/crates/db_schema/src/impls/language.rs +++ b/crates/db_schema/src/impls/language.rs @@ -61,12 +61,10 @@ mod tests { use lemmy_diesel_utils::connection::build_db_pool_for_tests; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_languages() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let mut all = Language::read_all(pool).await?; diff --git a/crates/db_schema/src/impls/local_site.rs b/crates/db_schema/src/impls/local_site.rs index bed35c28fc..e92772d519 100644 --- a/crates/db_schema/src/impls/local_site.rs +++ b/crates/db_schema/src/impls/local_site.rs @@ -54,7 +54,6 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; async fn read_local_site(pool: &mut DbPool<'_>) -> LemmyResult { let conn = &mut get_conn(pool).await?; @@ -84,10 +83,9 @@ mod tests { Ok((data, inserted_person, inserted_community)) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_aggregates() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let (data, inserted_person, inserted_community) = prepare_site_with_community(pool).await?; @@ -156,10 +154,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_soft_delete() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let (data, inserted_person, inserted_community) = prepare_site_with_community(pool).await?; diff --git a/crates/db_schema/src/impls/local_user.rs b/crates/db_schema/src/impls/local_user.rs index 20323cf4b6..201e8e5b9e 100644 --- a/crates/db_schema/src/impls/local_user.rs +++ b/crates/db_schema/src/impls/local_user.rs @@ -407,12 +407,10 @@ mod tests { }; use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_admin_higher_check() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "my_domain.tld").await?; @@ -448,10 +446,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_email_taken() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let darwin_email = "charles.darwin@gmail.com"; diff --git a/crates/db_schema/src/impls/multi_community.rs b/crates/db_schema/src/impls/multi_community.rs index 0292cd4978..9158d755dc 100644 --- a/crates/db_schema/src/impls/multi_community.rs +++ b/crates/db_schema/src/impls/multi_community.rs @@ -372,7 +372,6 @@ mod tests { use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { multi: MultiCommunity, @@ -409,10 +408,9 @@ mod tests { }) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_counts() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = setup(pool).await?; @@ -467,10 +465,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_multi_community_apub() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = setup(pool).await?; diff --git a/crates/db_schema/src/impls/password_reset_request.rs b/crates/db_schema/src/impls/password_reset_request.rs index addcaa6646..d84fc4ba8b 100644 --- a/crates/db_schema/src/impls/password_reset_request.rs +++ b/crates/db_schema/src/impls/password_reset_request.rs @@ -55,12 +55,10 @@ mod tests { use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_password_reset() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); // Setup diff --git a/crates/db_schema/src/impls/person.rs b/crates/db_schema/src/impls/person.rs index 0a277e56e8..a1ea334b31 100644 --- a/crates/db_schema/src/impls/person.rs +++ b/crates/db_schema/src/impls/person.rs @@ -427,12 +427,10 @@ mod tests { use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_crud() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = TestData::create(pool).await?; @@ -481,10 +479,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn follow() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = TestData::create(pool).await?; @@ -508,10 +505,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_aggregates() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = TestData::create(pool).await?; @@ -643,10 +639,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn person_vote_counts() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = TestData::create(pool).await?; diff --git a/crates/db_schema/src/impls/post.rs b/crates/db_schema/src/impls/post.rs index 1dc4742c95..3c7c6d2d99 100644 --- a/crates/db_schema/src/impls/post.rs +++ b/crates/db_schema/src/impls/post.rs @@ -582,13 +582,11 @@ mod tests { use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; use url::Url; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_crud() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "my_domain.tld").await?; @@ -725,10 +723,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_aggregates() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "my_domain.tld").await?; @@ -832,10 +829,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_aggregates_soft_delete() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "my_domain.tld").await?; diff --git a/crates/db_schema/src/impls/post_report.rs b/crates/db_schema/src/impls/post_report.rs index ade4d26222..43c8715f79 100644 --- a/crates/db_schema/src/impls/post_report.rs +++ b/crates/db_schema/src/impls/post_report.rs @@ -100,7 +100,6 @@ mod tests { post::{Post, PostInsertForm}, }; use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; - use serial_test::serial; struct Data { instance: Instance, @@ -145,10 +144,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_resolve_post_report() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -163,10 +161,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_resolve_all_post_reports() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_schema/src/impls/private_message.rs b/crates/db_schema/src/impls/private_message.rs index c1c81fe9e4..9b36b691bc 100644 --- a/crates/db_schema/src/impls/private_message.rs +++ b/crates/db_schema/src/impls/private_message.rs @@ -122,13 +122,11 @@ mod tests { use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; use url::Url; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_crud() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "my_domain.tld").await?; diff --git a/crates/db_views/comment/Cargo.toml b/crates/db_views/comment/Cargo.toml index e105b5c540..a0bea7f001 100644 --- a/crates/db_views/comment/Cargo.toml +++ b/crates/db_views/comment/Cargo.toml @@ -44,6 +44,9 @@ chrono = { workspace = true } [dev-dependencies] lemmy_db_views_local_user = { workspace = true } -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } pretty_assertions = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/comment/src/impls.rs b/crates/db_views/comment/src/impls.rs index e871a0e2d9..ae2c8c5813 100644 --- a/crates/db_views/comment/src/impls.rs +++ b/crates/db_views/comment/src/impls.rs @@ -390,7 +390,6 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { instance: Instance, @@ -550,10 +549,9 @@ mod tests { }) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_crud() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -606,10 +604,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_comment_tree() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -685,10 +682,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_languages() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -744,10 +740,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_distinguished_first() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -769,10 +764,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_creator_is_moderator() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -798,10 +792,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_creator_is_admin() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -829,10 +822,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn local_only_instance() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -877,10 +869,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn comment_listing_local_user_banned_from_community() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -920,10 +911,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn comment_listing_local_user_not_banned_from_community() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -940,10 +930,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn comment_listings_hide_nsfw() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -973,10 +962,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn comment_listing_private_community() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let mut data = init_data(pool).await?; @@ -1071,10 +1059,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn comment_removed() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let mut data = init_data(pool).await?; @@ -1147,10 +1134,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn search() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_views/community/Cargo.toml b/crates/db_views/community/Cargo.toml index 61f2457a10..d560d92170 100644 --- a/crates/db_views/community/Cargo.toml +++ b/crates/db_views/community/Cargo.toml @@ -46,5 +46,8 @@ ts-rs = { workspace = true, optional = true } i-love-jesus = { workspace = true, optional = true } [dev-dependencies] -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/community/src/impls.rs b/crates/db_views/community/src/impls.rs index 2455bf6a20..fc6f0804a2 100644 --- a/crates/db_views/community/src/impls.rs +++ b/crates/db_views/community/src/impls.rs @@ -424,7 +424,6 @@ mod tests { traits::Crud, }; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; - use serial_test::serial; use std::collections::HashSet; struct Data { @@ -530,10 +529,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn follow_state() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; let community = &data.communities[0]; @@ -602,10 +600,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn local_only_community() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -647,10 +644,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn community_sort_name() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -677,10 +673,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn can_mod() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -724,10 +719,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_multi_community_list() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -793,10 +787,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn search() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -845,10 +838,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn multi_community_search() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_views/community_follower_approval/Cargo.toml b/crates/db_views/community_follower_approval/Cargo.toml index 4d651f2af0..34ef60add4 100644 --- a/crates/db_views/community_follower_approval/Cargo.toml +++ b/crates/db_views/community_follower_approval/Cargo.toml @@ -40,5 +40,8 @@ ts-rs = { workspace = true, optional = true } i-love-jesus = { workspace = true, optional = true } [dev-dependencies] -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/community_follower_approval/src/impls.rs b/crates/db_views/community_follower_approval/src/impls.rs index b495661908..292af4e6d7 100644 --- a/crates/db_views/community_follower_approval/src/impls.rs +++ b/crates/db_views/community_follower_approval/src/impls.rs @@ -248,12 +248,10 @@ mod tests { }; use lemmy_db_schema_file::enums::CommunityVisibility; use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_has_followers_from_instance() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); // insert local community @@ -319,10 +317,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_pending_followers() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); // insert local community diff --git a/crates/db_views/local_user/Cargo.toml b/crates/db_views/local_user/Cargo.toml index b2d90f9255..7f689e582e 100644 --- a/crates/db_views/local_user/Cargo.toml +++ b/crates/db_views/local_user/Cargo.toml @@ -43,6 +43,9 @@ i-love-jesus = { workspace = true, optional = true } chrono = { workspace = true } [dev-dependencies] -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } pretty_assertions = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/local_user/src/impls.rs b/crates/db_views/local_user/src/impls.rs index be8b4dee2e..97e6ead779 100644 --- a/crates/db_views/local_user/src/impls.rs +++ b/crates/db_views/local_user/src/impls.rs @@ -259,7 +259,6 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { alice: Person, @@ -284,10 +283,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn list_banned() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_views/modlog/Cargo.toml b/crates/db_views/modlog/Cargo.toml index 073484e542..f5180600cc 100644 --- a/crates/db_views/modlog/Cargo.toml +++ b/crates/db_views/modlog/Cargo.toml @@ -41,5 +41,8 @@ i-love-jesus = { workspace = true, optional = true } [dev-dependencies] pretty_assertions = { workspace = true } -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/modlog/src/impls.rs b/crates/db_views/modlog/src/impls.rs index 218bff6cce..d27f51f136 100644 --- a/crates/db_views/modlog/src/impls.rs +++ b/crates/db_views/modlog/src/impls.rs @@ -248,7 +248,6 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { instance: Instance, @@ -339,10 +338,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn admin_types() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -494,10 +492,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn mod_types() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -889,10 +886,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn hide_modlog_names() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -930,10 +926,9 @@ mod tests { } /// Verifies that a single (non-bulk) modlog entry has bulk_action_parent_id == None by default. - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn individual_modlog_is_not_bulk() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -956,10 +951,9 @@ mod tests { } /// Verifies bulk entries are linked to their parent and can be queried by parent ID or show_bulk. - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn bulk_modlog_has_parent_id() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -1040,10 +1034,9 @@ mod tests { } /// Verifies that bulk_action_parent_id filter isolates children of one parent from another. - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn bulk_action_parent_id_isolation() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_views/notification/Cargo.toml b/crates/db_views/notification/Cargo.toml index 3426ea6f58..83dad4e42d 100644 --- a/crates/db_views/notification/Cargo.toml +++ b/crates/db_views/notification/Cargo.toml @@ -50,6 +50,9 @@ serde_with = { workspace = true } chrono = { workspace = true } [dev-dependencies] -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } pretty_assertions = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/notification/src/tests.rs b/crates/db_views/notification/src/tests.rs index da5ae00ef8..f923f0137b 100644 --- a/crates/db_views/notification/src/tests.rs +++ b/crates/db_views/notification/src/tests.rs @@ -19,7 +19,6 @@ use lemmy_diesel_utils::{ }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; -use serial_test::serial; struct Data { alice: Person, @@ -43,10 +42,9 @@ async fn cleanup(data: Data, pool: &mut DbPool<'_>) -> LemmyResult<()> { Ok(()) } -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_private_message() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -75,10 +73,9 @@ async fn test_private_message() -> LemmyResult<()> { cleanup(data, pool).await } -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_post() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -145,10 +142,9 @@ async fn test_post() -> LemmyResult<()> { cleanup(data, pool).await } -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_modlog() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_views/person/Cargo.toml b/crates/db_views/person/Cargo.toml index 1b4c46fee5..fdce4692ac 100644 --- a/crates/db_views/person/Cargo.toml +++ b/crates/db_views/person/Cargo.toml @@ -50,6 +50,9 @@ chrono = { workspace = true } i-love-jesus = { workspace = true, optional = true } [dev-dependencies] -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } pretty_assertions = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/person/src/impls.rs b/crates/db_views/person/src/impls.rs index 11586a5bb4..f0e8aad9f2 100644 --- a/crates/db_views/person/src/impls.rs +++ b/crates/db_views/person/src/impls.rs @@ -210,7 +210,6 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { site: Site, @@ -271,10 +270,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn exclude_deleted() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -298,10 +296,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn list_admins() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -332,10 +329,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn note() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -363,10 +359,9 @@ mod tests { cleanup(data, pool).await } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn search() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_views/person_content_combined/Cargo.toml b/crates/db_views/person_content_combined/Cargo.toml index 3cfc832c1e..c2eed544d9 100644 --- a/crates/db_views/person_content_combined/Cargo.toml +++ b/crates/db_views/person_content_combined/Cargo.toml @@ -47,5 +47,8 @@ serde_with = { workspace = true } [dev-dependencies] pretty_assertions = { workspace = true } -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/person_content_combined/src/impls.rs b/crates/db_views/person_content_combined/src/impls.rs index 41d1ffbb36..8e6389312b 100644 --- a/crates/db_views/person_content_combined/src/impls.rs +++ b/crates/db_views/person_content_combined/src/impls.rs @@ -228,7 +228,6 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { instance: Instance, @@ -350,10 +349,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn combined() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -425,10 +423,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn private_community() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_views/person_liked_combined/Cargo.toml b/crates/db_views/person_liked_combined/Cargo.toml index 3b74c9cd53..fcffde769b 100644 --- a/crates/db_views/person_liked_combined/Cargo.toml +++ b/crates/db_views/person_liked_combined/Cargo.toml @@ -48,5 +48,8 @@ i-love-jesus = { workspace = true, optional = true } [dev-dependencies] pretty_assertions = { workspace = true } -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/person_liked_combined/src/impls.rs b/crates/db_views/person_liked_combined/src/impls.rs index 64949dddd7..0ac6b3f88c 100644 --- a/crates/db_views/person_liked_combined/src/impls.rs +++ b/crates/db_views/person_liked_combined/src/impls.rs @@ -210,7 +210,6 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { instance: Instance, @@ -297,10 +296,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_combined() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_views/person_saved_combined/Cargo.toml b/crates/db_views/person_saved_combined/Cargo.toml index 66351dbc81..6c9d99062c 100644 --- a/crates/db_views/person_saved_combined/Cargo.toml +++ b/crates/db_views/person_saved_combined/Cargo.toml @@ -48,5 +48,8 @@ serde_with = { workspace = true } [dev-dependencies] pretty_assertions = { workspace = true } -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/person_saved_combined/src/impls.rs b/crates/db_views/person_saved_combined/src/impls.rs index de8607fa90..4dd411ba38 100644 --- a/crates/db_views/person_saved_combined/src/impls.rs +++ b/crates/db_views/person_saved_combined/src/impls.rs @@ -218,7 +218,6 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { instance: Instance, @@ -305,10 +304,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_combined() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_views/post/Cargo.toml b/crates/db_views/post/Cargo.toml index 2cbec4ccee..df4af303ef 100644 --- a/crates/db_views/post/Cargo.toml +++ b/crates/db_views/post/Cargo.toml @@ -45,8 +45,8 @@ url = { workspace = true } [dev-dependencies] lemmy_db_views_local_user = { workspace = true } -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } pretty_assertions = { workspace = true } test-context = "0.5.5" diesel-uplete.workspace = true diff --git a/crates/db_views/post/src/db_perf/mod.rs b/crates/db_views/post/src/db_perf/mod.rs index 67d150625a..77b9bdbfd4 100644 --- a/crates/db_views/post/src/db_perf/mod.rs +++ b/crates/db_views/post/src/db_perf/mod.rs @@ -22,7 +22,6 @@ use lemmy_diesel_utils::{ utils::now, }; use lemmy_utils::error::LemmyResult; -use serial_test::serial; use std::{fmt::Display, num::NonZeroU32, str::FromStr}; use url::Url; @@ -46,7 +45,6 @@ fn get_option(suffix: &str, default: T) -> Result LemmyResult<()> { let args = CmdArgs { communities: get_option("COMMUNITIES", 3.try_into()?)?, diff --git a/crates/db_views/post/src/test.rs b/crates/db_views/post/src/test.rs index d5059731ea..80f595450a 100644 --- a/crates/db_views/post/src/test.rs +++ b/crates/db_views/post/src/test.rs @@ -50,15 +50,15 @@ use lemmy_db_schema_file::enums::{ }; use lemmy_db_views_local_user::LocalUserView; use lemmy_diesel_utils::{ - connection::{ActualDbPool, DbPool, build_db_pool, get_conn}, + connection::{DbPool, ReusableDbPool, build_db_pool_for_tests, get_conn}, pagination::PaginationCursor, traits::Crud, }; use lemmy_utils::error::{LemmyError, LemmyErrorType, LemmyResult}; use pretty_assertions::assert_eq; -use serial_test::serial; use std::{ collections::HashSet, + sync::Arc, time::{Duration, Instant}, }; use test_context::{AsyncTestContext, test_context}; @@ -76,7 +76,7 @@ fn names(post_views: &[PostView]) -> Vec<&str> { } struct Data { - pool: ActualDbPool, + pool: Arc, instance: Instance, tegan: LocalUserView, john: LocalUserView, @@ -92,11 +92,11 @@ struct Data { } impl Data { - fn pool(&self) -> ActualDbPool { - self.pool.clone() + fn pool(&self) -> Arc { + Arc::clone(&self.pool) } pub fn pool2(&self) -> DbPool<'_> { - DbPool::Pool(&self.pool) + DbPool::ReusablePool(&self.pool) } fn default_post_query(&self) -> PostQuery<'_> { PostQuery { @@ -107,7 +107,7 @@ impl Data { } async fn setup_inner() -> LemmyResult { - let actual_pool = build_db_pool()?; + let actual_pool = build_db_pool_for_tests().await; let pool = &mut (&actual_pool).into(); let data = TestData::create(pool).await?; @@ -249,7 +249,7 @@ impl Data { }; Ok(Data { - pool: actual_pool, + pool: actual_pool.into(), instance: data.instance, tegan, john, @@ -288,11 +288,11 @@ impl AsyncTestContext for Data { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_with_person(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let local_user_form = LocalUserUpdateForm { show_bot_accounts: Some(false), @@ -348,11 +348,11 @@ async fn post_listing_with_person(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_no_person(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let read_post_listing_multiple_no_person = PostQuery { community_id: Some(data.community.id), @@ -381,11 +381,11 @@ async fn post_listing_no_person(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_block_community(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let community_block = CommunityBlockForm::new(data.community.id, data.tegan.person.id); CommunityActions::block(pool, &community_block).await?; @@ -404,11 +404,11 @@ async fn post_listing_block_community(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_like(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let post_like_form = PostLikeForm::new(data.post.id, data.tegan.person.id, Some(true)); @@ -470,11 +470,11 @@ async fn post_listing_like(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn person_note(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let note_str = "Tegan loves cats."; @@ -520,11 +520,11 @@ async fn person_note(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_person_vote_totals(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Create a 2nd bot post, to do multiple votes let bot_post_2 = PostInsertForm::new( @@ -695,11 +695,11 @@ async fn post_listing_person_vote_totals(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_read_only(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Mark the bot post, then the tags post as read PostActions::mark_as_read(pool, data.tegan.person.id, &[data.bot_post.id]).await?; @@ -719,11 +719,11 @@ async fn post_listing_read_only(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn creator_info(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let community_id = data.community.id; let tegan_listings = PostQuery { @@ -842,13 +842,13 @@ async fn creator_info(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_person_language(data: &mut Data) -> LemmyResult<()> { const EL_POSTO: &str = "el posto"; - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let spanish_id = Language::read_id_from_code(pool, "es").await?; @@ -915,11 +915,11 @@ async fn post_listing_person_language(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listings_removed(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Remove the post Post::update( @@ -955,11 +955,11 @@ async fn post_listings_removed(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listings_deleted(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Delete the post Post::update( @@ -994,11 +994,11 @@ async fn post_listings_deleted(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listings_hidden_community(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); Community::update( pool, @@ -1041,8 +1041,7 @@ async fn post_listings_hidden_community(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_instance_block_communities(data: &mut Data) -> LemmyResult<()> { const POST_FROM_BLOCKED_INSTANCE_COMMS: &str = "post on blocked instance"; const HOWARD_POST: &str = "howard post"; @@ -1054,8 +1053,9 @@ async fn post_listing_instance_block_communities(data: &mut Data) -> LemmyResult POST, ]; - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let blocked_instance_comms = Instance::read_or_create(pool, "another_domain.tld").await?; @@ -1142,8 +1142,7 @@ async fn post_listing_instance_block_communities(data: &mut Data) -> LemmyResult } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_instance_block_persons(data: &mut Data) -> LemmyResult<()> { const POST_FROM_BLOCKED_INSTANCE_USERS: &str = "post from blocked instance user"; const POST_TO_UNBLOCKED_COMM: &str = "post to unblocked comm"; @@ -1155,8 +1154,9 @@ async fn post_listing_instance_block_persons(data: &mut Data) -> LemmyResult<()> POST, ]; - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let blocked_instance_persons = Instance::read_or_create(pool, "another_domain.tld").await?; @@ -1232,11 +1232,11 @@ async fn post_listing_instance_block_persons(data: &mut Data) -> LemmyResult<()> } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn pagination_includes_each_post_once(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let community_form = CommunityInsertForm::new( data.instance.id, @@ -1332,12 +1332,12 @@ async fn pagination_includes_each_post_once(data: &mut Data) -> LemmyResult<()> } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] /// Test that last and first partial pages only have one cursor. async fn pagination_hidden_cursors(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let community_form = CommunityInsertForm::new( data.instance.id, @@ -1396,8 +1396,9 @@ async fn pagination_hidden_cursors(data: &mut Data) -> LemmyResult<()> { assert!(first_page2.prev_page.is_some()); assert_eq!(first_page2.next_page, first_page.next_page); - let pool = &data.pool; - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Mark first post as deleted let first_post_view = first_page.items.first().expect("first post"); @@ -1449,12 +1450,12 @@ async fn pagination_hidden_cursors(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] /// Test paging past the last and first page. async fn pagination_recovery_cursors(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let community_form = CommunityInsertForm::new( data.instance.id, @@ -1580,11 +1581,11 @@ async fn pagination_recovery_cursors(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listings_hide_read(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Make sure local user hides read posts let local_user_form = LocalUserUpdateForm { @@ -1631,11 +1632,11 @@ async fn post_listings_hide_read(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listings_hide_hidden(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Mark a post as hidden let hide_form = PostHideForm::new(data.bot_post.id, data.tegan.person.id); @@ -1680,11 +1681,11 @@ async fn post_listings_hide_hidden(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listings_hide_nsfw(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Mark a post as nsfw let update_form = PostUpdateForm { @@ -1728,11 +1729,11 @@ async fn post_listings_hide_nsfw(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn local_only_instance(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); Community::update( pool, @@ -1777,11 +1778,11 @@ async fn local_only_instance(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_local_user_banned_from_community(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Test that post view shows if local user is blocked from community let banned_from_comm_person = PersonInsertForm::test_form(data.instance.id, "jill"); @@ -1821,11 +1822,11 @@ async fn post_listing_local_user_banned_from_community(data: &mut Data) -> Lemmy } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_local_user_not_banned_from_community(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let post_view = PostView::read( pool, @@ -1849,11 +1850,11 @@ fn micros(dt: DateTime) -> i64 { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_creator_banned(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let banned_person_form = PersonInsertForm::test_form(data.instance.id, "jill"); @@ -1900,11 +1901,11 @@ async fn post_listing_creator_banned(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_creator_community_banned(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let banned_person_form = PersonInsertForm::test_form(data.instance.id, "jarvis"); @@ -1955,11 +1956,11 @@ async fn post_listing_creator_community_banned(data: &mut Data) -> LemmyResult<( } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn speed_check(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Make sure the post_view query is less than this time let duration_max = Duration::from_millis(120); @@ -2007,11 +2008,11 @@ async fn speed_check(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listings_no_comments_only(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Create a comment for a post let comment_form = CommentInsertForm::new( @@ -2041,11 +2042,11 @@ async fn post_listings_no_comments_only(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_private_community(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Mark community as private Community::update( @@ -2140,11 +2141,11 @@ async fn post_listing_private_community(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listings_hide_media(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Make one post an image post Post::update( @@ -2200,11 +2201,11 @@ async fn post_listings_hide_media(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_with_blocked_keywords(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let name_blocked = format!("post_{POST_KEYWORD_BLOCKED}"); let name_blocked2 = format!("post2_{POST_KEYWORD_BLOCKED}2"); @@ -2273,11 +2274,11 @@ async fn post_with_blocked_keywords(data: &mut Data) -> LemmyResult<()> { Ok(()) } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_tags_present(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); let post_view = PostView::read( pool, @@ -2306,11 +2307,11 @@ async fn post_tags_present(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_listing_multi_community(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // create two more communities with one post each let form = CommunityInsertForm::new( @@ -2389,11 +2390,11 @@ async fn post_listing_multi_community(data: &mut Data) -> LemmyResult<()> { } #[test_context(Data)] -#[tokio::test] -#[serial] +#[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn search(data: &mut Data) -> LemmyResult<()> { - let pool = &data.pool(); - let pool = &mut pool.into(); + let pool_arc = data.pool(); + let pool_ref = &***pool_arc; + let pool = &mut pool_ref.into(); // Using a term let search_by_name = PostQuery { diff --git a/crates/db_views/registration_applications/Cargo.toml b/crates/db_views/registration_applications/Cargo.toml index 5ac156e584..3f7a217761 100644 --- a/crates/db_views/registration_applications/Cargo.toml +++ b/crates/db_views/registration_applications/Cargo.toml @@ -43,6 +43,9 @@ extism = { workspace = true, optional = true } extism-convert = { workspace = true, optional = true } [dev-dependencies] -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } pretty_assertions = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/registration_applications/src/api.rs b/crates/db_views/registration_applications/src/api.rs index 2909825956..a201e526d1 100644 --- a/crates/db_views/registration_applications/src/api.rs +++ b/crates/db_views/registration_applications/src/api.rs @@ -63,8 +63,8 @@ pub struct Register { pub stay_logged_in: Option, } -#[derive(Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(ToBytes,))] +#[derive(Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(ToBytes))] #[cfg_attr(feature = "full", encoding(Json))] pub struct CaptchaAnswer { pub answer: String, diff --git a/crates/db_views/registration_applications/src/impls.rs b/crates/db_views/registration_applications/src/impls.rs index 7745376a75..94122fcbb6 100644 --- a/crates/db_views/registration_applications/src/impls.rs +++ b/crates/db_views/registration_applications/src/impls.rs @@ -169,12 +169,10 @@ mod tests { use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_crud() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let instance = Instance::read_or_create(pool, "my_domain.tld").await?; diff --git a/crates/db_views/report_combined/Cargo.toml b/crates/db_views/report_combined/Cargo.toml index 78fd04071f..e9e589e13f 100644 --- a/crates/db_views/report_combined/Cargo.toml +++ b/crates/db_views/report_combined/Cargo.toml @@ -46,5 +46,8 @@ i-love-jesus = { workspace = true, optional = true } [dev-dependencies] pretty_assertions = { workspace = true } -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/report_combined/src/impls.rs b/crates/db_views/report_combined/src/impls.rs index fe1f6c45dc..1c84929fee 100644 --- a/crates/db_views/report_combined/src/impls.rs +++ b/crates/db_views/report_combined/src/impls.rs @@ -457,7 +457,6 @@ mod tests { }; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; struct Data { instance: Instance, @@ -560,10 +559,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn combined() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -731,10 +729,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn private_message_reports() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -796,10 +793,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_reports() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -929,10 +925,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn comment_reports() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -1052,10 +1047,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn community_reports() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -1124,10 +1118,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn violates_instance_rules() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -1214,10 +1207,9 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn my_reports_only() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; @@ -1265,13 +1257,12 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn ensure_creator_data_is_correct() -> LemmyResult<()> { // The creator_banned and other creator_data should be the content creator, not the report // creator. - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let data = init_data(pool).await?; diff --git a/crates/db_views/site/Cargo.toml b/crates/db_views/site/Cargo.toml index 8eb3fc039b..57e09268c4 100644 --- a/crates/db_views/site/Cargo.toml +++ b/crates/db_views/site/Cargo.toml @@ -67,5 +67,8 @@ anyhow = { workspace = true, optional = true } i-love-jesus = { workspace = true, optional = true } [dev-dependencies] -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/site/src/impls.rs b/crates/db_views/site/src/impls.rs index 9fb46830b3..ee14e51648 100644 --- a/crates/db_views/site/src/impls.rs +++ b/crates/db_views/site/src/impls.rs @@ -221,12 +221,10 @@ mod tests { }; use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_instance_list() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); // insert test data diff --git a/crates/db_views/vote/Cargo.toml b/crates/db_views/vote/Cargo.toml index 0a68f8db86..5b8e12ccac 100644 --- a/crates/db_views/vote/Cargo.toml +++ b/crates/db_views/vote/Cargo.toml @@ -40,6 +40,9 @@ ts-rs = { workspace = true, optional = true } i-love-jesus = { workspace = true, optional = true } [dev-dependencies] -serial_test = { workspace = true } tokio = { workspace = true } +tokio-shared-rt = { workspace = true } pretty_assertions = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tokio"] diff --git a/crates/db_views/vote/src/impls.rs b/crates/db_views/vote/src/impls.rs index 0e3d00a0b9..ceec249fc4 100644 --- a/crates/db_views/vote/src/impls.rs +++ b/crates/db_views/vote/src/impls.rs @@ -200,12 +200,10 @@ mod tests { use lemmy_diesel_utils::{connection::build_db_pool_for_tests, traits::Crud}; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn post_and_comment_vote_views() -> LemmyResult<()> { - let pool = &build_db_pool_for_tests(); + let pool = &build_db_pool_for_tests().await; let pool = &mut pool.into(); let inserted_instance = Instance::read_or_create(pool, "my_domain.tld").await?; diff --git a/crates/diesel_utils/Cargo.toml b/crates/diesel_utils/Cargo.toml index 536c10b08c..c4e632b02d 100644 --- a/crates/diesel_utils/Cargo.toml +++ b/crates/diesel_utils/Cargo.toml @@ -53,7 +53,12 @@ diesel-derive-newtype = { workspace = true } diesel-async = { workspace = true, features = [ "deadpool", "postgres", + "async-connection-wrapper", ], optional = true } +db-pool = { git = "https://github.com/momentary-lapse/db-pool.git", branch = "edition2021-superuser-config", features = [ + "diesel-async-postgres", + "diesel-async-deadpool", +] } diesel_ltree = { workspace = true, optional = true } tracing = { workspace = true, optional = true } deadpool = { version = "0.13.0", features = ["rt_tokio_1"], optional = true } @@ -71,7 +76,6 @@ serde_with = { workspace = true } itertools = { workspace = true, optional = true } [dev-dependencies] -serial_test = { workspace = true } diff = "0.1.13" itertools = { workspace = true } pathfinding = "4.15.0" diff --git a/crates/diesel_utils/src/connection.rs b/crates/diesel_utils/src/connection.rs index 7910611b4d..92a48d4c16 100644 --- a/crates/diesel_utils/src/connection.rs +++ b/crates/diesel_utils/src/connection.rs @@ -1,4 +1,15 @@ -use deadpool::Runtime; +use crate::schema_setup; +use db_pool::{ + PrivilegedPostgresConfig, + r#async::{ + DatabasePool, + DatabasePoolBuilderTrait, + DieselAsyncPostgresBackend, + DieselDeadpool, + ReusableConnectionPool, + }, +}; +use deadpool::{Runtime, Status}; use diesel::result::{ ConnectionError, ConnectionResult, @@ -6,6 +17,7 @@ use diesel::result::{ }; use diesel_async::{ AsyncConnection, + async_connection_wrapper::AsyncConnectionWrapper, pg::AsyncPgConnection, pooled_connection::{ AsyncDieselConnectionManager, @@ -37,9 +49,12 @@ use std::{ sync::Arc, time::Duration, }; +use tokio::sync::OnceCell; use tracing::error; pub type ActualDbPool = Pool; +pub type ReusableDbPool = + ReusableConnectionPool<'static, DieselAsyncPostgresBackend>; /// References a pool or connection. Functions must take `&mut DbPool<'_>` to allow implicit /// reborrowing. @@ -47,6 +62,7 @@ pub type ActualDbPool = Pool; /// https://github.com/rust-lang/rfcs/issues/1403 pub enum DbPool<'a> { Pool(&'a ActualDbPool), + ReusablePool(&'a ReusableDbPool), Conn(&'a mut AsyncPgConnection), } @@ -55,12 +71,30 @@ pub enum DbConn<'a> { Conn(&'a mut AsyncPgConnection), } +#[derive(Clone)] +pub enum GenericDbPool { + Actual(ActualDbPool), + Reusable(Arc), +} + +impl GenericDbPool { + pub fn status(&self) -> Status { + match self { + GenericDbPool::Actual(pool) => pool.status(), + GenericDbPool::Reusable(pool) => pool.status(), + } + } +} + pub async fn get_conn<'a, 'b: 'a>(pool: &'a mut DbPool<'b>) -> Result, DieselError> { Ok(match pool { DbPool::Pool(pool) => DbConn::Pool(Box::new( pool.get().await.map_err(|e| QueryBuilderError(e.into()))?, )), DbPool::Conn(conn) => DbConn::Conn(conn), + DbPool::ReusablePool(pool) => DbConn::Pool(Box::new( + pool.get().await.map_err(|e| QueryBuilderError(e.into()))?, + )), }) } @@ -119,6 +153,21 @@ impl<'a> From<&'a ActualDbPool> for DbPool<'a> { } } +impl<'a> From<&'a ReusableDbPool> for DbPool<'a> { + fn from(value: &'a ReusableDbPool) -> Self { + DbPool::ReusablePool(value) + } +} + +impl<'a> From<&'a GenericDbPool> for DbPool<'a> { + fn from(value: &'a GenericDbPool) -> Self { + match value { + GenericDbPool::Actual(pool) => DbPool::Pool(pool), + GenericDbPool::Reusable(pool) => DbPool::ReusablePool(pool), + } + } +} + /// Runs multiple async functions that take `&mut DbPool<'_>` as input and return `Result`. Only /// works when the `futures` crate is listed in `Cargo.toml`. /// @@ -153,6 +202,13 @@ macro_rules! try_join_with_pool { } }),+)) }.await, + // Run concurrently with `try_join` + $crate::connection::DbPool::ReusablePool(__pool) => ::futures_util::try_join!( + $(async { + let mut __dbpool = $crate::connection::DbPool::ReusablePool(__pool); + ($func)(&mut __dbpool).await + }),+ + ), } }}; } @@ -194,8 +250,53 @@ pub fn build_db_pool() -> LemmyResult { } #[expect(clippy::expect_used)] -pub fn build_db_pool_for_tests() -> ActualDbPool { - build_db_pool().expect("db pool missing") +pub async fn build_db_pool_for_tests() +-> ReusableConnectionPool<'static, DieselAsyncPostgresBackend> { + static POOL: OnceCell>> = + OnceCell::const_new(); + let db_pool = POOL + .get_or_init(|| async { + let config = PrivilegedPostgresConfig::new().database_url( + SETTINGS + .get_database_url_with_options() + .expect("get database url with options"), + ); + + let backend = DieselAsyncPostgresBackend::new( + config, + |manager| Pool::builder(manager).max_size(30), //TODO use some env var + |manager| Pool::builder(manager).max_size(2), + None, + move |conn| { + Box::pin(async { + let mut async_wrapper: AsyncConnectionWrapper = + AsyncConnectionWrapper::from(conn); + + tokio::task::spawn_blocking(move || { + schema_setup::run_with_connection( + schema_setup::Options::default().run(), + &mut async_wrapper, + ) + .expect("run migrations") + }) + .await + .expect("task panicked"); + + None + }) + }, + ) + .await + .expect("diesel postgres backend"); + + backend + .create_database_pool() + .await + .expect("create db pool") + }) + .await; + + db_pool.pull_immutable().await } fn establish_connection(config: &str) -> BoxFuture<'_, ConnectionResult> { diff --git a/crates/diesel_utils/src/schema_setup/mod.rs b/crates/diesel_utils/src/schema_setup/mod.rs index 4dade47a33..548037147c 100644 --- a/crates/diesel_utils/src/schema_setup/mod.rs +++ b/crates/diesel_utils/src/schema_setup/mod.rs @@ -8,7 +8,7 @@ use diesel::{ PgConnection, QueryDsl, RunQueryDsl, - connection::SimpleConnection, + connection::LoadConnection, dsl::exists, migration::{Migration, MigrationVersion}, pg::Pg, @@ -52,14 +52,20 @@ fn replaceable_schema() -> String { const REPLACEABLE_SCHEMA_PATH: &str = "crates/diesel_utils/replaceable_schema"; -struct MigrationHarnessWrapper<'a> { - conn: &'a mut PgConnection, +struct MigrationHarnessWrapper<'a, Conn> +where + Conn: MigrationHarness, +{ + conn: &'a mut Conn, #[cfg(test)] enable_diff_check: bool, options: &'a Options, } -impl MigrationHarnessWrapper<'_> { +impl MigrationHarnessWrapper<'_, Conn> +where + Conn: MigrationHarness, +{ fn run_migration_inner( &mut self, migration: &dyn Migration, @@ -78,7 +84,10 @@ impl MigrationHarnessWrapper<'_> { } } -impl MigrationHarness for MigrationHarnessWrapper<'_> { +impl MigrationHarness for MigrationHarnessWrapper<'_, Conn> +where + Conn: MigrationHarness, +{ fn run_migration( &mut self, migration: &dyn Migration, @@ -182,10 +191,10 @@ pub enum Branch { ReplaceableSchemaNotRebuilt, } -pub fn run(options: Options, db_url: &str) -> anyhow::Result { - // Migrations don't support async connection, and this function doesn't need to be async - let conn = &mut PgConnection::establish(db_url)?; - +pub fn run_with_connection(options: Options, conn: &mut Conn) -> anyhow::Result +where + Conn: Connection + MigrationHarness + LoadConnection, +{ // If possible, skip getting a lock and recreating the "r" schema, so // lemmy_server processes in a horizontally scaled setup can start without causing locks if !options.revert @@ -255,7 +264,15 @@ pub fn run(options: Options, db_url: &str) -> anyhow::Result { Ok(output) } -fn run_replaceable_schema(conn: &mut PgConnection) -> anyhow::Result<()> { +pub fn run(options: Options, db_url: &str) -> anyhow::Result { + // Migrations don't support async connection, and this function doesn't need to be async + run_with_connection(options, &mut PgConnection::establish(db_url)?) +} + +fn run_replaceable_schema(conn: &mut Conn) -> anyhow::Result<()> +where + Conn: Connection, +{ conn.transaction(|conn| { conn .batch_execute(&replaceable_schema()) @@ -271,7 +288,10 @@ fn run_replaceable_schema(conn: &mut PgConnection) -> anyhow::Result<()> { }) } -fn revert_replaceable_schema(conn: &mut PgConnection) -> anyhow::Result<()> { +fn revert_replaceable_schema(conn: &mut Conn) -> anyhow::Result<()> +where + Conn: Connection, +{ conn .batch_execute("DROP SCHEMA IF EXISTS r CASCADE;") .with_context(|| format!("Failed to revert SQL files in {REPLACEABLE_SCHEMA_PATH}"))?; @@ -282,10 +302,13 @@ fn revert_replaceable_schema(conn: &mut PgConnection) -> anyhow::Result<()> { Ok(()) } -fn run_selected_migrations( - conn: &mut PgConnection, +fn run_selected_migrations( + conn: &mut Conn, options: &Options, -) -> diesel::migration::Result<()> { +) -> diesel::migration::Result<()> +where + Conn: MigrationHarness, +{ let mut wrapper = MigrationHarnessWrapper { conn, options, @@ -329,12 +352,12 @@ mod tests { *, }; use diesel::{ + connection::SimpleConnection, dsl::{not, sql}, sql_types, }; use diesel_ltree::Ltree; use lemmy_utils::{error::LemmyResult, settings::SETTINGS}; - use serial_test::serial; // The number of migrations that should be run to set up some test data. // Currently, this includes migrations until // 2020-04-07-135912_add_user_community_apub_constraints, since there are some mandatory apub @@ -382,7 +405,7 @@ mod tests { const COMMENT2_AP_ID: &str = "https://fedi.example/comment/12346"; #[test] - #[serial] + #[ignore] fn test_schema_setup() -> LemmyResult<()> { let o = Options::default(); let db_url = SETTINGS.get_database_url(); diff --git a/crates/routes/Cargo.toml b/crates/routes/Cargo.toml index 4d72adb302..3c10d59363 100644 --- a/crates/routes/Cargo.toml +++ b/crates/routes/Cargo.toml @@ -68,4 +68,4 @@ ts-rs = { workspace = true, optional = true } [dev-dependencies] pretty_assertions.workspace = true -serial_test.workspace = true +tokio-shared-rt = { workspace = true } diff --git a/crates/routes/src/middleware/session.rs b/crates/routes/src/middleware/session.rs index d9dee9a826..e475d4bf50 100644 --- a/crates/routes/src/middleware/session.rs +++ b/crates/routes/src/middleware/session.rs @@ -110,10 +110,8 @@ mod tests { use lemmy_diesel_utils::traits::Crud; use lemmy_utils::error::LemmyResult; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_session_auth() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); diff --git a/crates/routes/src/utils/scheduled_tasks.rs b/crates/routes/src/utils/scheduled_tasks.rs index e0a10215ef..ba36381b87 100644 --- a/crates/routes/src/utils/scheduled_tasks.rs +++ b/crates/routes/src/utils/scheduled_tasks.rs @@ -707,9 +707,8 @@ mod tests { use lemmy_diesel_utils::traits::Crud; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; use pretty_assertions::assert_eq; - use serial_test::serial; - #[tokio::test] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_nodeinfo_lemmy_ml() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let form = build_update_instance_form("lemmy.ml", &context) @@ -719,7 +718,7 @@ mod tests { Ok(()) } - #[tokio::test] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_nodeinfo_mastodon_social() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let form = build_update_instance_form("mastodon.social", &context) @@ -729,8 +728,7 @@ mod tests { Ok(()) } - #[tokio::test] - #[serial] + #[tokio_shared_rt::test(shared = true, flavor = "multi_thread")] async fn test_scheduled_tasks() -> LemmyResult<()> { let context = LemmyContext::init_test_context().await; let pool = &mut context.pool(); diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index 631579d0b3..d9d3df2c02 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -20,6 +20,7 @@ workspace = true [features] default = [] +full = [] [dependencies] lemmy_api = { workspace = true } diff --git a/crates/server/src/lib.rs b/crates/server/src/lib.rs index 419e377174..9656958a4d 100644 --- a/crates/server/src/lib.rs +++ b/crates/server/src/lib.rs @@ -25,7 +25,7 @@ use lemmy_apub_objects::objects::{community::FETCH_COMMUNITY_COLLECTIONS, instan use lemmy_apub_send::{Opts, SendManager}; use lemmy_db_schema::source::secret::Secret; use lemmy_db_views_site::SiteView; -use lemmy_diesel_utils::connection::build_db_pool; +use lemmy_diesel_utils::connection::{GenericDbPool, build_db_pool}; use lemmy_routes::{ feeds, middleware::{ @@ -206,7 +206,7 @@ pub async fn start_lemmy_server(args: CmdArgs) -> LemmyResult<()> { .with(TracingMiddleware::default()) .build(); let context = LemmyContext::create( - pool.clone(), + GenericDbPool::Actual(pool.clone()), client.clone(), pictrs_client, secret.clone(), diff --git a/crates/utils/src/settings/mod.rs b/crates/utils/src/settings/mod.rs index b0ee7e9bb2..5292ee702d 100644 --- a/crates/utils/src/settings/mod.rs +++ b/crates/utils/src/settings/mod.rs @@ -87,15 +87,24 @@ impl Settings { .ok_or_else(|| anyhow!("images_disabled").into()) } + pub fn get_lemmy_connection_options(&self) -> Vec<(String, String)> { + Vec::from([( + "lemmy.protocol_and_hostname".to_string(), + self.get_protocol_and_hostname().clone(), + )]) + } + /// Sets a few additional config options necessary for starting lemmy pub fn get_database_url_with_options(&self) -> LemmyResult { let mut url = Url::parse(&self.get_database_url())?; - // Set `lemmy.protocol_and_hostname` so triggers can use it - let lemmy_protocol_and_hostname_option = - "lemmy.protocol_and_hostname=".to_owned() + &self.get_protocol_and_hostname(); - let mut options = CONNECTION_OPTIONS.to_vec(); - options.push(&lemmy_protocol_and_hostname_option); + let mut options = CONNECTION_OPTIONS + .iter() + .map(ToString::to_string) + .collect::>(); + for (k, v) in self.get_lemmy_connection_options() { + options.push(format!("{}={}", k, v)); + } // Create the connection uri portion let options_segments = options