benchmarks: Use Truth in LoadWorkerTest

This will produce better error messages when the comparisons fail. This
is to help debug aarch64 test failures.
This commit is contained in:
Eric Anderson 2022-05-02 09:48:33 -07:00
parent 80f1cbf6c4
commit fe5511cf21
1 changed files with 5 additions and 5 deletions

View File

@ -16,7 +16,7 @@
package io.grpc.benchmarks.driver;
import static org.junit.Assert.assertTrue;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
import io.grpc.ManagedChannel;
@ -194,12 +194,12 @@ public class LoadWorkerTest {
}
}
clientObserver.onCompleted();
assertTrue(stat.hasLatencies());
assertTrue(stat.getLatencies().getCount() < stat.getLatencies().getSum());
assertThat(stat.hasLatencies()).isTrue();
assertThat(stat.getLatencies().getCount()).isLessThan(stat.getLatencies().getSum());
double mean = stat.getLatencies().getSum() / stat.getLatencies().getCount();
System.out.println("Mean " + mean + " us");
assertTrue(mean > stat.getLatencies().getMinSeen());
assertTrue(mean < stat.getLatencies().getMaxSeen());
assertThat(stat.getLatencies().getMinSeen()).isLessThan(mean);
assertThat(stat.getLatencies().getMaxSeen()).isGreaterThan(mean);
}
private StreamObserver<Control.ClientArgs> startClient(Control.ClientArgs clientArgs)