KandraCloud

Live-cluster (e.g. Scylla Cloud) test harness. Env-driven, so no credentials ever live in the repo.

Environment:

  • KANDRA_CLOUD_CONTACT_POINTS comma-separated host[:port] (port defaults to 9042). Unset => unconfigured.

  • KANDRA_CLOUD_USERNAME / KANDRA_CLOUD_PASSWORD plain auth credentials (optional pair).

  • KANDRA_CLOUD_LOCAL_DC local datacenter (required by the driver; the verified value for the shared cluster is documented in docs/features/multi-keyspace-plan.md).

  • TLS (optional, off by default: the shared cluster accepts plain auth on 9042 and TLS on 9142): KANDRA_CLOUD_TLS=true enables it (contact-point port 9042 is rewritten to 9142). Trust comes from KANDRA_CLOUD_CA_PEM=/path/ca.pem (in-memory trust store built from the PEM; never committed), else KANDRA_CLOUD_TRUSTSTORE, else the JVM default trust store. Legacy: KANDRA_CLOUD_SSL=true == TLS with JVM trust; KANDRA_CLOUD_TRUSTSTORE=/path/to/truststore.jks (+ KANDRA_CLOUD_TRUSTSTORE_PASSWORD) uses a custom one.

Usage in a JUnit 5 test (skipped, not failed, when unconfigured):

@BeforeAll @JvmStatic fun gate() = KandraCloud.assumeConfigured()

@Test fun works() = KandraCloud.freshKeyspace("smoke").use { ks ->
ks.session.execute("CREATE TABLE t (id int PRIMARY KEY)") // session is bound to ks.name
}

Keyspaces are named kt_<prefix>_<random8>; close() always drops them.

Types

Link copied to clipboard

A temporary keyspace plus sessions. session is bound to it; admin is unbound.

Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Username / password from the env (null when unset). Never log these.

Functions

Link copied to clipboard

JUnit assumption: aborts (skips) the test or class when the cloud env is not configured.

Link copied to clipboard

Contact points as a host:port CSV (TLS port 9142 substituted when TLS is on), for config DSLs taking a string.

Link copied to clipboard

Creates kt_<prefix>_<random8> (SimpleStrategy, rf) and returns a handle holding a session bound to it. Use with use {}; FreshKeyspace.close drops the keyspace even if the test fails.

Link copied to clipboard
fun newSession(keyspace: String? = null): CqlSession

Opens a new session, optionally bound to keyspace. Caller must close it.

Link copied to clipboard
fun sessionBuilder(): CqlSessionBuilder

A configured (not yet built) session builder. Caller owns the built session.

Link copied to clipboard

A temporary PKCS12 truststore built from KANDRA_CLOUD_CA_PEM, for APIs that want a truststore file (e.g. Kandra's ssl { trustStorePath = ... }). Deleted on close. Null when TLS is off or no PEM is set.