How can I write unit tests that exercise CockroachDB enterprise-only features when I don't have a license?

Viewed 41

If I'm paying for a Cockroach Cloud cluster (managed CockroachDB), I can run tests for my application without spending money by running them against a temporary cockroachdb instance I start up myself. But if my test requires an enterprise feature (e.g. it involves a changefeed to an external sink), I'm out of luck as I don't have a license key. Is there any way to do this without mocking out the database entirely?

1 Answers

If you start your test version of cockroach using the cockroach demo command (instead of cockroach start or cockroach start-single-node) it will automatically get a temporary Enterprise license. You'll need to restart it (and regenerate any test fixture data) every 24 hours, so it'll usually be simplest to start a fresh process for each test.

Related