Skip to content

7.2.5.post2 - Portable Test Environments & Secure Attach 🧪🔐

Choose a tag to compare

@poissoncorp poissoncorp released this 30 Jul 09:37
e4181fe

7.2.5.post2 makes ravendb-test-driver portable across developer machines and CI runners while keeping tests on a real RavenDB server. Tests can use the bundled embedded server, download a platform-matched self-contained server without requiring system .NET, or attach to RavenDB running in Docker, Testcontainers, or a shared environment.

Highlights

Choose where RavenDB runs

The default path remains zero-configuration and starts the framework-dependent server bundled by ravendb-embedded. For portable environments, configure the on-demand self-contained provider before the first store is created:

from ravendb_embedded import ServerOptions
from ravendb_test_driver import RavenTestDriver

options = ServerOptions()
options.with_auto_downloaded_server()
RavenTestDriver.configure_server(options)

with RavenTestDriver() as driver:
    with driver.get_document_store() as store:
        ...

The platform is detected at runtime and the downloaded server is cached for later runs. The same test configuration works across supported Windows, Linux, and macOS machines without installing system .NET.

To manage RavenDB separately, attach the driver to an existing server:

RavenTestDriver.configure_external_server("http://localhost:8080")

The driver does not start or stop an attached server, but it still creates and deletes an isolated database for every returned store.

Secure HTTPS attach

External HTTPS servers support client-certificate authentication through the public API or environment variables. Configuration fails fast when an HTTPS URL has no client identity.

RavenTestDriver.configure_external_server(
    "https://my-ravendb",
    certificate_pem_path="client.pem",
    trust_store_path="ca.crt",
)

Environment equivalents: RAVENDB_TEST_SERVER_URL, RAVENDB_TEST_SERVER_CERT, RAVENDB_TEST_SERVER_CA

Isolated databases and reliable indexing

Every get_document_store() call creates a fresh database and closing the store removes it, so tests do not leak state into one another. wait_for_indexing() now waits until active indexes are no longer stale and reports index errors on timeout, removing the race between writing documents and asserting index-backed queries.

from datetime import timedelta
from ravendb_test_driver import GetDocumentStoreOptions, RavenTestDriver

options = GetDocumentStoreOptions.with_timeout(timedelta(seconds=30))

with RavenTestDriver() as driver:
    with driver.get_document_store(options) as store:
        # setup_database() has run and indexing has settled
        ...

Runnable labs

  • Lab 01: attach to Docker, Testcontainers, or a shared RavenDB server without local .NET.
  • Lab 02: use the default embedded server with isolated per-test databases.
  • Lab 03: seed a database and wait for real indexing before querying.
  • Lab 04: run portable embedded tests with an on-demand self-contained server and no system .NET.

Other Changes

  • Pins ravendb-embedded==7.2.5.post2 and ravendb==7.2.3.post1.
  • Documents the .NET 10 requirement for the default RavenDB 7.2 embedded mode and both no-.NET alternatives.
  • Adds API and environment-based secured attach coverage with real TLS/client certificates.
  • Keeps context-manager ownership for reliable store, database, and server cleanup.
  • Reworks the README around customer workflows and direct runnable examples.

Full Changelog: 7.2.3...7.2.5.post2