@@ -69,8 +69,11 @@ public void testShowDates() throws Exception {
6969 report1 .setType ("healthcheck" );
7070 report1 .setValue ("{\" checks\" :[]}" );
7171 reportResultService .update (context , report1 );
72+ // Force commit and flush to ensure timestamp is set
73+ context .commit ();
7274
73- Thread .sleep (100 );
75+ // Wait longer to ensure different timestamps
76+ Thread .sleep (1000 );
7477
7578 ReportResult report2 = reportResultService .create (context );
7679 report2 .setType ("healthcheck" );
@@ -99,9 +102,11 @@ public void testCompareReports() throws Exception {
99102 report1 .setValue ("{\" checks\" :[{\" name\" :\" Check1\" ,\" report\" :{\" key\" :\" value1\" }}]}" );
100103 reportResultService .update (context , report1 );
101104 report1 = reportResultService .find (context , report1 .getID ());
105+ // Force commit and flush to ensure timestamp is set
106+ context .commit ();
102107
103- Thread . sleep ( 100 );
104-
108+ // Wait longer to ensure different timestamps
109+ Thread . sleep ( 1000 );
105110 ReportResult report2 = reportResultService .create (context );
106111 report2 .setType ("healthcheck" );
107112 report2 .setValue ("{\" checks\" :[{\" name\" :\" Check1\" ,\" report\" :{\" key\" :\" value2\" }}]}" );
@@ -133,7 +138,11 @@ public void testCompareSpecificCheck() throws Exception {
133138 reportResultService .update (context , report1 );
134139 report1 = reportResultService .find (context , report1 .getID ());
135140
136- Thread .sleep (100 );
141+ // Force commit and flush to ensure timestamp is set
142+ context .commit ();
143+
144+ // Wait longer to ensure different timestamps
145+ Thread .sleep (1000 );
137146
138147 ReportResult report2 = reportResultService .create (context );
139148 report2 .setType ("healthcheck" );
@@ -210,7 +219,11 @@ public void testReportWithMissingValue() throws Exception {
210219 reportResultService .update (context , report1 );
211220 report1 = reportResultService .find (context , report1 .getID ());
212221
213- Thread .sleep (100 );
222+ // Force commit and flush to ensure timestamp is set
223+ context .commit ();
224+
225+ // Wait longer to ensure different timestamps
226+ Thread .sleep (1000 );
214227
215228 ReportResult report2 = reportResultService .create (context );
216229 report2 .setType ("healthcheck" );
@@ -239,8 +252,11 @@ public void testNoDifferences() throws Exception {
239252 reportResultService .update (context , report1 );
240253 report1 = reportResultService .find (context , report1 .getID ());
241254
242- Thread .sleep (100 );
255+ // Force commit and flush to ensure timestamp is set
256+ context .commit ();
243257
258+ // Wait longer to ensure different timestamps
259+ Thread .sleep (1000 );
244260 ReportResult report2 = reportResultService .create (context );
245261 report2 .setType ("healthcheck" );
246262 report2 .setValue ("{\" checks\" :[{\" name\" :\" Check1\" ,\" report\" :{\" key\" :\" value\" }}]}" );
@@ -267,7 +283,11 @@ public void testNoEnteredDate() throws Exception {
267283 report1 .setValue ("{\" checks\" :[{\" name\" :\" Check1\" ,\" report\" :{\" key\" :\" value\" }}]}" );
268284 reportResultService .update (context , report1 );
269285
270- Thread .sleep (100 );
286+ // Force commit and flush to ensure timestamp is set
287+ context .commit ();
288+
289+ // Wait longer to ensure different timestamps
290+ Thread .sleep (1000 );
271291
272292 ReportResult report2 = reportResultService .create (context );
273293 report2 .setType ("healthcheck" );
@@ -296,7 +316,11 @@ public void testReportDiff() throws Exception {
296316 report1 .setArgs ("-c: 0" );
297317 reportResultService .update (context , report1 );
298318
299- Thread .sleep (100 );
319+ // Force commit and flush to ensure timestamp is set
320+ context .commit ();
321+
322+ // Wait longer to ensure different timestamps
323+ Thread .sleep (1000 );
300324
301325 ReportResult report2 = reportResultService .create (context );
302326 report2 .setType ("healthcheck" );
@@ -325,8 +349,11 @@ public void testShowDatesLimit() throws Exception {
325349 report1 .setValue ("{\" checks\" :[]}" );
326350 reportResultService .update (context , report1 );
327351 report1 = reportResultService .find (context , report1 .getID ());
352+ // Force commit and flush to ensure timestamp is set
353+ context .commit ();
328354
329- Thread .sleep (100 );
355+ // Wait longer to ensure different timestamps
356+ Thread .sleep (1000 );
330357
331358 ReportResult report2 = reportResultService .create (context );
332359 report2 .setType ("healthcheck" );
0 commit comments