cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.11k stars 3.81k forks source link

backupccl: reuse test clusters between tests #46156

Open pbardea opened 4 years ago

pbardea commented 4 years ago

I'm creating this issue to have a place to discuss possible ways to speedup backupccl tests.

Currently each backup test spins up and tears down a test cluster. This means that for a lot of tests we spend most of the time doing repeated work. I think we can speed up running make test PKG=./pkg/ccl/backupccl but doing something smarter here. Essentially we want to only have 1 test cluster instance that can be shared among all the tests. Most tests use backupRestoreTestSetup, so I think that it can be leveraged to manage a singleton instance of the cluster. The main work that needs to be done is ensuring that the data for each test doesn't conflict with eachother. After poking around at this, I think it can be done in 1 of 2 ways:

  1. Namespace the databases created by each tests to be prefixed with the testname. This ensures that there are no conflicts, but things may get a bit messy with nested tests which refer to databases that are created at a higher level test.

  2. Introduce a new guarantee that every test has to clean up after itself and drop any databases that it created. We can leverage the cleanup func provided by backupRestoreTestSetup to make this easier. This means that on most CREATE DATABASE request, we should expect to see a DROP DATABASE deferred.

Soliciting any additional thoughts/approaches we could use here.

cc @dt

Epic CRDB-7779

Jira issue: CRDB-5103

github-actions[bot] commented 1 year ago

We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!

blathers-crl[bot] commented 1 year ago

cc @cockroachdb/test-eng