Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBZ-3304 Fix intermittent test failure #2229

Merged
merged 1 commit into from Mar 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -171,10 +171,18 @@ public void testStreamingOnlyMetrics() throws Exception {
.with(DatabaseHistory.STORE_ONLY_MONITORED_TABLES_DDL, Boolean.TRUE)
.build());

assertNoSnapshotMetricsExist();

// CREATE DATABASE, CREATE TABLE, and 2 INSERT
assertStreamingMetrics(4);

// The legacy implementation did not exposed snapshot metrics when snapshot never was configured.
// All other connectors based on new framework exposes snapshot metrics always so we are
// following the same behaviour in the new implementation
if (isLegacy()) {
assertNoSnapshotMetricsExist();
}
else {
assertSnapshotMetricsExist();
}
}

private void assertNoSnapshotMetricsExist() throws Exception {
Expand Down Expand Up @@ -209,6 +217,16 @@ private void assertStreamingMetricsExist() throws Exception {
}
}

private void assertSnapshotMetricsExist() throws Exception {
final MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
try {
mBeanServer.getAttribute(getSnapshotMetricsObjectName(), "SnapshotCompleted");
}
catch (InstanceNotFoundException e) {
Assert.fail("Snapshot Metrics should exist");
}
}

private void assertSnapshotMetrics() throws Exception {
final MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();

Expand Down