kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 0960065b032abc545eb1d691e6a55e75bdcb9635ff7ff02b01ea3a24aa8d1998 |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2016-09-23 17:09 -05:00 |
| Committer | Olivier Michallat <olim7t@users.noreply.github.com> · 2016-09-23 15:09 -07:00 |
| Parents | da9ef71e7257 |
1 file changed
modified driver-core/src/test/java/com/datastax/driver/core/ReconnectionTest.java +5 −3
| @@ -106,17 +106,19 @@ | ||
| 106 | 106 | ccm().start(1); |
| 107 | 107 | ccm().waitForUp(1); |
| 108 | 108 | |
| 109 | - // Wait a few iterations to ensure that our authProvider has returned the wrong credentials at least once | |
| 109 | + // Wait a few iterations to ensure that our authProvider has returned the wrong credentials at least twice | |
| 110 | 110 | // NB: authentication errors show up in the logs |
| 111 | 111 | int initialCount = authProvider.count.get(); |
| 112 | + long initialMetricCount = cluster.getMetrics().getErrorMetrics().getAuthenticationErrors().getCount(); | |
| 112 | 113 | int iterations = 0, maxIterations = 12; // make sure we don't wait indefinitely |
| 113 | 114 | do { |
| 114 | 115 | iterations += 1; |
| 115 | 116 | TimeUnit.SECONDS.sleep(5); |
| 116 | - } while (iterations < maxIterations && authProvider.count.get() <= initialCount); | |
| 117 | + } while (iterations < maxIterations && authProvider.count.get() <= initialCount + 1); | |
| 117 | 118 | assertThat(iterations).isLessThan(maxIterations); |
| 119 | + // Number of authentication errors should have increased. | |
| 118 | 120 | assertThat(cluster.getMetrics().getErrorMetrics().getAuthenticationErrors().getCount()) |
| 119 | - .isEqualTo(authProvider.count.get() - initialCount); | |
| 121 | + .isGreaterThan(initialMetricCount); | |
| 120 | 122 | |
| 121 | 123 | // Fix the credentials |
| 122 | 124 | authProvider.setPassword("cassandra"); |