private boolean doesConfigReplicationFactorMatchWithCluster() { return clientPool.runWithRetry(client -> { try { CassandraVerifier.currentRfOnKeyspaceMatchesDesiredRf(client, config); return true; } catch (Exception e) { log.warn("The config and Cassandra cluster do not agree on the replication factor.", e); return false; } }); }
@Test public void testSanitiseReplicationFactorPassesForTheKeyspace() { clientPool.run(client -> { try { CassandraVerifier.currentRfOnKeyspaceMatchesDesiredRf(client, CASSANDRA.getConfig()); } catch (TException e) { fail("currentRf On Keyspace does not Match DesiredRf"); } return false; }); }
@Test public void testSanitiseReplicationFactorFailsAfterManipulatingReplicationFactorInConfig() { clientPool.run(client -> { try { CassandraVerifier.currentRfOnKeyspaceMatchesDesiredRf(client, ImmutableCassandraKeyValueServiceConfig.copyOf( CASSANDRA.getConfig()).withReplicationFactor( MODIFIED_REPLICATION_FACTOR)); fail("currentRf On Keyspace Matches DesiredRf after manipulating the cassandra config"); } catch (Exception e) { assertReplicationFactorMismatchError(e); } return false; }); }
@Test public void testSanitiseReplicationFactorFailsAfterManipulatingReplicationFactorOnCassandra() throws TException { changeReplicationFactor(MODIFIED_REPLICATION_FACTOR); clientPool.run(client -> { try { CassandraVerifier.currentRfOnKeyspaceMatchesDesiredRf(client, CASSANDRA.getConfig()); fail("currentRf On Keyspace Matches DesiredRf after manipulating the cassandra keyspace"); } catch (Exception e) { assertReplicationFactorMismatchError(e); } return false; }); changeReplicationFactor(CASSANDRA.getConfig().replicationFactor()); }
private boolean doesConfigReplicationFactorMatchWithCluster() { return clientPool.runWithRetry(client -> { try { CassandraVerifier.currentRfOnKeyspaceMatchesDesiredRf(client, config); return true; } catch (Exception e) { log.warn("The config and Cassandra cluster do not agree on the replication factor.", e); return false; } }); }