Skip to content

Commit d53c1c6

Browse files
authored
Improve VerifySerialRecoveryITgst (apache#5182)
Improves the logging and assert messages for this flaky IT so it will be easier to debug next time it fails.
1 parent be9fa22 commit d53c1c6

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

test/src/main/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java

+14-11
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@
4646
import org.apache.hadoop.fs.RawLocalFileSystem;
4747
import org.apache.hadoop.io.Text;
4848
import org.junit.jupiter.api.Test;
49+
import org.slf4j.Logger;
50+
import org.slf4j.LoggerFactory;
4951

5052
public class VerifySerialRecoveryIT extends ConfigurableMacBase {
5153

54+
private static final Logger log = LoggerFactory.getLogger(VerifySerialRecoveryIT.class);
55+
5256
private static final byte[] HEXCHARS = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
5357
0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66};
5458

@@ -114,32 +118,31 @@ public void testSerializedRecovery() throws Exception {
114118
assertEquals(0, cluster.exec(Admin.class, "stopAll").getProcess().waitFor());
115119
ts.getProcess().waitFor();
116120
String result = ts.readStdOut();
117-
for (String line : result.split("\n")) {
118-
System.out.println(line);
119-
}
121+
log.info(result);
122+
120123
// walk through the output, verifying that only a single normal recovery was running at one
121124
// time
122-
boolean started = false;
125+
boolean ongoingRecovery = false;
123126
int recoveries = 0;
124127
var pattern =
125128
Pattern.compile(".*recovered \\d+ mutations creating \\d+ entries from \\d+ walogs.*");
126129
for (String line : result.split("\n")) {
127-
// ignore metadata tables
130+
// ignore metadata and root tables
128131
if (line.contains("!0") || line.contains("+r")) {
129132
continue;
130133
}
131134
if (line.contains("recovering data from walogs")) {
132-
assertFalse(started);
133-
started = true;
135+
assertFalse(ongoingRecovery, "Saw recovery start before previous recovery finished");
136+
ongoingRecovery = true;
134137
recoveries++;
135138
}
136139
if (pattern.matcher(line).matches()) {
137-
assertTrue(started);
138-
started = false;
140+
assertTrue(ongoingRecovery, "Saw recovery end without recovery start");
141+
ongoingRecovery = false;
139142
}
140143
}
141-
assertFalse(started);
142-
assertTrue(recoveries > 0);
144+
assertFalse(ongoingRecovery, "Expected no ongoing recovery at end of test");
145+
assertTrue(recoveries > 0, "Expected at least one recovery to have occurred");
143146
}
144147
}
145148
}

0 commit comments

Comments
 (0)