Skip to content

Commit

Permalink
Fix flaky test
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Stäber <fabian@fstab.de>
  • Loading branch information
fstab committed Apr 5, 2024
1 parent 45a1e1a commit 1c27e58
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void testCounterComplete() throws IOException, InterruptedException {
}

@Test
public void testCounterMinimal() throws IOException, InterruptedException {
public void testCounterMinimal() throws IOException {
Counter.build()
.name("events")
.help("total number of events")
Expand Down Expand Up @@ -222,9 +222,17 @@ private String fixTimestamps(String s) {
// Example of a "_created" timestamp in new format: 1694464002.939
// The following regex translates the orig timestamp to the new timestamp
return s
.replaceAll( "1\\.([0-9]{9})([0-9]{3})E9", "1$1.$2") // Example: 1.694464002939E9
.replaceAll( "1\\.([0-9]{9})([0-9]{2})E9", "1$1.$20") // Example: 1.69460725747E9
.replaceAll( "1\\.([0-9]{9})([0-9])E9", "1$1.$200"); // Example: 1.6946072574E9
.replaceAll("1\\.([0-9]{9})([0-9]{3})E9", "1$1.$2") // Example: 1.694464002939E9
.replaceAll("1\\.([0-9]{9})([0-9]{2})E9", "1$1.$20") // Example: 1.69460725747E9
.replaceAll("1\\.([0-9]{9})([0-9])E9", "1$1.$200") // Example: 1.6946072574E9
.replaceAll("1\\.([0-9]{9})E9", "1$1.000") // Example: 1.712332231E9
.replaceAll("1\\.([0-9]{8})E9", "1$10.000") // Example: 1.71233242E9
.replaceAll("1\\.([0-9]{7})E9", "1$100.000") // Example: 1.7123324E9
.replaceAll("1\\.([0-9]{6})E9", "1$1000.000")
.replaceAll("1\\.([0-9]{5})E9", "1$10000.000")
.replaceAll("1\\.([0-9]{4})E9", "1$100000.000")
.replaceAll("1\\.([0-9]{3})E9", "1$1000000.000")
.replaceAll("1\\.([0-9]{2})E9", "1$10000000.000");
}

private String fixCounts(String s) {
Expand Down

0 comments on commit 1c27e58

Please sign in to comment.