KandraCloud
Live-cluster (e.g. Scylla Cloud) test harness. Env-driven, so no credentials ever live in the repo.
Environment:
KANDRA_CLOUD_CONTACT_POINTScomma-separatedhost[:port](port defaults to 9042). Unset => unconfigured.KANDRA_CLOUD_USERNAME/KANDRA_CLOUD_PASSWORDplain auth credentials (optional pair).KANDRA_CLOUD_LOCAL_DClocal 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=trueenables it (contact-point port 9042 is rewritten to 9142). Trust comes fromKANDRA_CLOUD_CA_PEM=/path/ca.pem(in-memory trust store built from the PEM; never committed), elseKANDRA_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.
Functions
JUnit assumption: aborts (skips) the test or class when the cloud env is not configured.
Contact points as a host:port CSV (TLS port 9142 substituted when TLS is on), for config DSLs taking a string.
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.
Opens a new session, optionally bound to keyspace. Caller must close it.
A configured (not yet built) session builder. Caller owns the built session.
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.