Skip to content

Commit 0f3fb04

Browse files
committed
DBZ-8883 Guard against file read/write race conditions
1 parent e115248 commit 0f3fb04

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

  • debezium-server-instructlab/src/test/java/io/debezium/server/instructlab

debezium-server-instructlab/src/test/java/io/debezium/server/instructlab/InstructLabIT.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ public void testInstructLab() throws Exception {
4949

5050
Awaitility.await()
5151
.atMost(Duration.ofMinutes(2))
52-
.until(() -> {
52+
.untilAsserted(() -> {
5353
try {
54+
final String t1Contents = Files.readString(t1Path);
55+
final String t2Contents = Files.readString(t2Path);
56+
5457
// Check that taxonomy t1 was created
55-
assertThat(Files.readString(t1Path)).isEqualTo(ofLines(
58+
assertThat(t1Contents).isEqualTo(ofLines(
5659
"version: 3",
5760
"task_description: " + t1Path.toAbsolutePath().toString(),
5861
"created_by: Debezium",
@@ -70,7 +73,7 @@ public void testInstructLab() throws Exception {
7073
" answer: '107'",
7174
" context: '1'"));
7275

73-
assertThat(Files.readString(t2Path)).isEqualTo(ofLines(
76+
assertThat(t2Contents).isEqualTo(ofLines(
7477
"version: 3",
7578
"task_description: " + t2Path.toAbsolutePath().toString(),
7679
"created_by: Debezium",
@@ -83,13 +86,10 @@ public void testInstructLab() throws Exception {
8386
" answer: '106'",
8487
"- question: '1003'",
8588
" answer: '107'"));
86-
87-
return true;
8889
}
8990
catch (IOException e) {
90-
// no-op
91+
throw new AssertionError(e);
9192
}
92-
return false;
9393
});
9494
}
9595

0 commit comments

Comments
 (0)