Skip to content

Conversation

@ableegoldman
Copy link
Contributor

@ableegoldman ableegoldman commented Nov 11, 2024

Changes the default storage backend type to Mongo in the ResponsiveExtension test harness

Also tries to reduce testing runtime in two ways:

  1. Reusing the ResponsiveExtension for all integration tests so we don't have to start and stop all the containers for each new test class. From my local testing this seems to cut the total test runtime down by about 3 minutes
  2. Start up containers in parallel, which has a minimal impact on total runtime now that we only start them up once, but reduces the startup for individual tests by about 10s which is nice for debugging cases where you're running a test multiple times

@ableegoldman ableegoldman requested a review from agavra November 11, 2024 02:29
@agavra
Copy link
Contributor

agavra commented Nov 11, 2024

image Did you mean to commit these files?

Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused about this PR, it seems like we're changing the default to run with Mongo but having all our integration tests specifically test Cassandra? I feel like they should be aligned to make sure we're testing our defaults

public static final String STORAGE_BACKEND_TYPE_CONFIG = "responsive.storage.backend.type";
private static final String STORAGE_BACKEND_TYPE_DOC = "The storage backend";
private static final StorageBackend STORAGE_BACKEND_TYPE_DEFAULT = StorageBackend.CASSANDRA;
private static final StorageBackend STORAGE_BACKEND_TYPE_DEFAULT = StorageBackend.MONGO_DB;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I'm a little anxious about this, not sure whether or not existing customers set this explicitly or not. please check with them first!

I originally thought you were just going to change the default in the test configurations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah sorry, good call. We should check with them though because I think we do want to shift to Mongo as the default (or do we?)

I'll extract this out into a separate PR that we can merge if/when we're ready. Does it make sense to change the default for the tests before we change the default itself?

};

private final CassandraClientFactory mockCassandryFactory = new CassandraClientFactory() {
private final CassandraClientFactory mockCassandraFactory = new CassandraClientFactory() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆

final RemoteKVTable<?> table;
if (EXTENSION.backend == StorageBackend.CASSANDRA) {

if (type == KVSchema.FACT) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like we're removing the ability to test with cassandra and instead tying that to the KVSchema type? Am I reading that correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for this specific test (sorry I meant to leave a comment to clarify before you read this)

My thought was, since we still have at least one customer running Cassandra fact stores then it makes sense to keep some tests parametrized to run that. But no one is running Cassandra KV stores, we would recommend Mongo for that, so we might as well change this to run the KV schema variation against mongo.

Is the method of parametrizing confusing though? I can change it so that the storage backend is the parameter and we determine the schema type based on that.


properties.put(RESPONSIVE_ORG_CONFIG, "responsive");
properties.put(RESPONSIVE_ENV_CONFIG, "test");
properties.put(ResponsiveConfig.STORAGE_BACKEND_TYPE_CONFIG, StorageBackend.CASSANDRA.name());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the point of this PR is to change our tests to run with Mongo?

Copy link
Contributor Author

@ableegoldman ableegoldman Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of them are Cassandra-specific or rely on a mocked Cassandra client to do something like fault injection, as is the case here. I went through and left a note on all the other tests that I hardcoded to use the Cassandra test harness

This specific test actually isn't using the test harness and only had to be updated because I changed the default. Since I'm backing that change out this test actually doesn't need to be updated yet anyways, and I'll back out this change too (so that we remember to update this test if/when we do change the actual default)

public class TablePartitionerIntegrationTest {

@RegisterExtension
static ResponsiveExtension EXTENSION = new ResponsiveExtension(StorageBackend.CASSANDRA);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table partitioner is an exclusively cassandra concept

class CassandraFactTableIntegrationTest {

@RegisterExtension
static ResponsiveExtension EXTENSION = new ResponsiveExtension(StorageBackend.CASSANDRA);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously this test is cassandra specific 😄 (ditto the one below)

public class CommitBufferTest {

@RegisterExtension
static ResponsiveExtension EXTENSION = new ResponsiveExtension(StorageBackend.CASSANDRA);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should eventually migrate this test to Mongo but that will be a pretty huge shift, so imo it makes sense to leave this one as Cassandra for now since it's pretty much hardcoded into the test setup

@ableegoldman ableegoldman changed the title Change default to Mongo and reduce integration test runtime Change test harness default to Mongo and reduce integration test runtime Nov 17, 2024
public class GlobalStoreIntegrationTest {

@RegisterExtension
static ResponsiveExtension EXTENSION = new ResponsiveExtension(StorageBackend.CASSANDRA);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global stores are incompatible with Mongo(I guess we should fix this...?)

@ableegoldman ableegoldman merged commit 31ec0c9 into main Nov 17, 2024
1 check passed
@ableegoldman ableegoldman deleted the TEST-debug-testing-runtime branch November 17, 2024 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants