Elffuss BraidHub

kikocis/java-driver public

Update NodeListRefreshDebouncerTest max pending requests test.
Changeseta49b95c49f8d806369503fbcfbff28e01a61c036c2189a29fc510bf68d60c341
AuthorAndrew Tolbert <andrew.tolbert@datastax.com> · 2015-08-14 18:00 -05:00
CommitterAndrew Tolbert <andrew.tolbert@datastax.com> · 2015-08-14 18:00 -05:00
Parentsa9c3f7efad0e

Browse the files at this changeset

2 files changed

modified driver-core/src/test/java/com/datastax/driver/core/NodeListRefreshDebouncerTest.java +7 −4
@@ -54,6 +54,7 @@
5454 queryOptions = new QueryOptions();
5555 queryOptions.setRefreshNodeListIntervalMillis(DEBOUNCE_TIME);
5656 queryOptions.setMaxPendingRefreshNodeListRequests(5);
57+ queryOptions.setRefreshSchemaIntervalMillis(0);
5758 // Create a separate cluster that will receive the schema events on its control connection.
5859 cluster2 = this.configure(Cluster.builder())
5960 .addContactPointsWithPorts(newArrayList(hostAddress))
@@ -108,14 +109,16 @@
108109 */
109110 @Test(groups = "short")
110111 public void should_refresh_when_max_pending_requests_reached() {
111- // Enable and disable schema management 5 times to cause
112+ // Create keyspaces 5 times to cause
112113 // refreshNodeListAndTokenMap to be called.
114+ String prefix = "srwmprr";
113115 for(int i = 0; i < 5; i++) {
114- queryOptions.setMetadataEnabled(false);
115- queryOptions.setMetadataEnabled(true);
116+ String keyspace = prefix + i;
117+ session.execute(String.format(CREATE_KEYSPACE_SIMPLE_FORMAT, keyspace, 1));
118+ keyspaces.add(keyspace);
116119 }
117120
118121 // add a 1 second delay to account for executor submit.
119- verify(controlConnection, timeout(1000).times(1)).refreshNodeListAndTokenMap();
122+ verify(controlConnection, timeout(1000)).refreshNodeListAndTokenMap();
120123 }
121124 }
modified driver-core/src/test/java/com/datastax/driver/core/SchemaChangesTest.java +1 −2
@@ -356,8 +356,7 @@
356356 schemaDisabledCluster.getConfiguration().getQueryOptions().setMetadataEnabled(true);
357357
358358 verify(schemaDisabledControlConnection, after(1000)).refreshSchema(null, null);
359- // TODO: Remove atLeastOnce() if submitNodeRefresh removed from setMetadataEnabled.
360- verify(schemaDisabledControlConnection, atLeastOnce()).refreshNodeListAndTokenMap();
359+ verify(schemaDisabledControlConnection).refreshNodeListAndTokenMap();
361360
362361 // Ensure that there is schema metadata.
363362 assertThat(schemaDisabledCluster.getMetadata().getKeyspace(keyspace)).isNotNull();