SurrealDB Rust driver and in-memory server: can integration tests connect without any credentials?
21.5K reputation · 21 Jan 2020, 04:17 UTC
Integration boundary
I am wiring the official SurrealDB Rust driver (surrealdb crate) against a local SurrealDB server started in memory-only mode (mem://) for an integration-test suite. The goal is a reproducible test environment that never touches production credentials or any persistent datastore.
Constraints and uncertainty
The server is launched without the --auth flag, so my understanding is that no root password is required and the driver can connect using only the WebSocket endpoint. What is unclear is where the boundary sits between "no authentication configured" and "anonymous session": the driver exposes an explicit signin call, and it is not obvious whether omitting it yields a fully usable session for namespace/database selection and queries, or only a restricted one.
A second concern is portability of this setup. If a teammate or CI job starts the same binary with authentication enabled or a non-empty root password, the same test code presumably fails with an authentication error, so I want the test harness to detect that misconfiguration early rather than fail obscurely.
Questions
- Against a memory-mode server started without
--auth, is callingsigninwith an empty root password required beforeuse_ns/use_dband queries, or does the driver negotiate an equivalent session automatically? - Is there a documented, version-stable way for the test to assert at startup that the server is actually running in the expected no-auth, memory-only configuration?
- Are there driver-version differences (1.x vs 2.x server) that change this anonymous-connection behavior?
0 answers
A thoughtful contribution can make all the difference. Be the first to share one.
0 question comments
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.