Skip to content

Commit 9dec5a6

Browse files
authored
feat(surrealdb)!: support surrealdb v2 (#307)
This is incompatible update because requires appropriate client. For the users of surreal v1 it's still possible to use an old version of client and tag customization
1 parent c1c741f commit 9dec5a6

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ retry = "2.0.0"
114114
rustls = { version = "0.23.2", features = ["ring"] }
115115
serde = { version = "1.0.217", features = ["derive"] }
116116
serde_json = { version = "1.0.138" }
117-
surrealdb = { version = "1.2.1" }
117+
surrealdb = { version = "2.2.1" }
118118
tar = "0.4.40"
119119
testcontainers = { version = "0.23.2", features = ["blocking"] }
120120
# To use Tiberius on macOS, rustls is needed instead of native-tls

src/surrealdb/mod.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use testcontainers::{
66
};
77

88
const NAME: &str = "surrealdb/surrealdb";
9-
const TAG: &str = "v1.1.1";
9+
const TAG: &str = "v2.2";
1010

1111
/// Port that the [`SurrealDB`] container has internally
1212
/// Can be rebound externally via [`testcontainers::core::ImageExt::with_mapped_port`]
@@ -65,10 +65,10 @@ impl SurrealDb {
6565
self
6666
}
6767

68-
/// Sets authentication for the SurrealDB instance.
69-
pub fn with_authentication(mut self, authentication: bool) -> Self {
68+
/// Sets unauthenticated flag for the SurrealDB instance.
69+
pub fn with_unauthenticated(mut self) -> Self {
7070
self.env_vars
71-
.insert("SURREAL_AUTH".to_owned(), authentication.to_string());
71+
.insert("SURREAL_UNAUTHENTICATED".to_owned(), "true".to_string());
7272
self
7373
}
7474

@@ -110,7 +110,7 @@ impl Image for SurrealDb {
110110
}
111111

112112
fn ready_conditions(&self) -> Vec<WaitFor> {
113-
vec![WaitFor::message_on_stderr("Started web server on ")]
113+
vec![WaitFor::message_on_stdout("Started web server on ")]
114114
}
115115

116116
fn env_vars(
@@ -201,10 +201,7 @@ mod tests {
201201
#[tokio::test]
202202
async fn surrealdb_no_auth() -> Result<(), Box<dyn std::error::Error + 'static>> {
203203
let _ = pretty_env_logger::try_init();
204-
let node = SurrealDb::default()
205-
.with_authentication(false)
206-
.start()
207-
.await?;
204+
let node = SurrealDb::default().with_unauthenticated().start().await?;
208205
let host_port = node.get_host_port_ipv4(SURREALDB_PORT).await?;
209206
let url = format!("127.0.0.1:{host_port}");
210207

0 commit comments

Comments
 (0)