upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/test_utils
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-10-28 15:05:38 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-10-28 15:05:38 +0000
commit5979e13cdc65ea78894dbcab3acde11b246889a7 (patch)
tree9dfb0971847bfa3a5a064f39e01bd0415fd05946 /test_utils
parente60a419510696e3fa25a35be6cba35e547b53e24 (diff)
refactor: replace sqlite with lmdb
as sqlite is depricated in rust-nostr
Diffstat (limited to 'test_utils')
-rw-r--r--test_utils/Cargo.toml2
-rw-r--r--test_utils/src/lib.rs11
2 files changed, 6 insertions, 7 deletions
diff --git a/test_utils/Cargo.toml b/test_utils/Cargo.toml
index 68484cb..403e478 100644
--- a/test_utils/Cargo.toml
+++ b/test_utils/Cargo.toml
@@ -13,7 +13,7 @@ git2 = "0.19.0"
13nostr = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 13nostr = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" }
14nostr-database = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 14nostr-database = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" }
15nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 15nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" }
16nostr-sqlite = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } 16nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" }
17once_cell = "1.18.0" 17once_cell = "1.18.0"
18rand = "0.8" 18rand = "0.8"
19rexpect = { git = "https://github.com/rust-cli/rexpect.git", rev = "9eb61dd" } 19rexpect = { git = "https://github.com/rust-cli/rexpect.git", rev = "9eb61dd" }
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs
index f329681..57b0643 100644
--- a/test_utils/src/lib.rs
+++ b/test_utils/src/lib.rs
@@ -11,8 +11,8 @@ use futures::executor::block_on;
11use git::GitTestRepo; 11use git::GitTestRepo;
12use nostr::{self, nips::nip65::RelayMetadata, Kind, Tag}; 12use nostr::{self, nips::nip65::RelayMetadata, Kind, Tag};
13use nostr_database::NostrDatabase; 13use nostr_database::NostrDatabase;
14use nostr_lmdb::NostrLMDB;
14use nostr_sdk::{serde_json, Client, NostrSigner, TagStandard}; 15use nostr_sdk::{serde_json, Client, NostrSigner, TagStandard};
15use nostr_sqlite::SQLiteDatabase;
16use once_cell::sync::Lazy; 16use once_cell::sync::Lazy;
17use rexpect::session::{Options, PtySession}; 17use rexpect::session::{Options, PtySession};
18use strip_ansi_escapes::strip_str; 18use strip_ansi_escapes::strip_str;
@@ -1051,10 +1051,9 @@ where
1051} 1051}
1052 1052
1053/** copied from client.rs */ 1053/** copied from client.rs */
1054async fn get_local_cache_database(git_repo_path: &Path) -> Result<SQLiteDatabase> { 1054async fn get_local_cache_database(git_repo_path: &Path) -> Result<NostrLMDB> {
1055 SQLiteDatabase::open(git_repo_path.join(".git/nostr-cache.sqlite")) 1055 NostrLMDB::open(git_repo_path.join(".git/nostr-cache.lmdb"))
1056 .await 1056 .context("cannot open or create nostr cache database at .git/nostr-cache.lmdb")
1057 .context("cannot open or create nostr cache database at .git/nostr-cache.sqlite")
1058} 1057}
1059 1058
1060/** copied from client.rs */ 1059/** copied from client.rs */
@@ -1067,7 +1066,7 @@ pub async fn get_events_from_cache(
1067 .query(filters.clone()) 1066 .query(filters.clone())
1068 .await 1067 .await
1069 .context( 1068 .context(
1070 "cannot execute query on opened git repo nostr cache database .git/nostr-cache.sqlite", 1069 "cannot execute query on opened git repo nostr cache database .git/nostr-cache.lmdb",
1071 ) 1070 )
1072} 1071}
1073 1072