Skip to content

Commit 2a3eec5

Browse files
committed
Wait for agreement in test in SchemaAgreementTest
This is an alternative solution to d962bf6. That commit tried to deal with the fact, that should_unset_flag_on_failed_agreement would leave the schema in disagreement. If another test ran after that one, it would start with schema in disagreement. The previous solution was to set priority=1, so that this test would run after other tests. The problem with that solution is that all other tests from SchemaAgreementTests would run at one moment, then some unrelated tests would run and finally should_unset_flag_on_failed_agreement would run. Those unrelated tests could screw up the execution of should_unset_flag_on_failed_agreement, as seen in #170. Fix that problem by running a dummy query with long schema agreement timeout, so that after this test runs, the schema is in agreement and the state of affairs is clean. Fixes #170
1 parent 927dec2 commit 2a3eec5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

driver-core/src/test/java/com/datastax/driver/core/SchemaAgreementTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ public void should_unset_flag_on_failed_agreement() {
5454
protocolOptions.maxSchemaAgreementWaitSeconds = 0;
5555
ResultSet rs = session().execute(String.format(CREATE_TABLE, COUNTER.getAndIncrement()));
5656
assertThat(rs.getExecutionInfo().isSchemaInAgreement()).isFalse();
57+
58+
// Execute a dummy query, that will wait for schema agreement,
59+
// so that the next tests that run afterwards have a clean state.
60+
protocolOptions = cluster().getConfiguration().getProtocolOptions();
61+
protocolOptions.maxSchemaAgreementWaitSeconds = 10;
62+
rs = session().execute(String.format(CREATE_TABLE, COUNTER.getAndIncrement()));
63+
assertThat(rs.getExecutionInfo().isSchemaInAgreement()).isTrue();
5764
}
5865

5966
@Test(groups = "short")

0 commit comments

Comments
 (0)