Skip to content

Commit

Permalink
Flaky unit test tweaks (unrelated to this change).
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixGV committed Dec 18, 2024
1 parent 128c072 commit 0499e98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static com.linkedin.venice.router.api.VeniceMultiKeyRoutingStrategy.HELIX_ASSISTED_ROUTING;
import static com.linkedin.venice.router.api.VeniceMultiKeyRoutingStrategy.LEAST_LOADED_ROUTING;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.atLeastOnce;
Expand All @@ -14,6 +14,7 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;

import com.linkedin.alpini.base.concurrency.TimeoutProcessor;
import com.linkedin.alpini.router.api.HostFinder;
Expand Down Expand Up @@ -723,7 +724,9 @@ public void testScatterForMultiGetWithHelixAssistedRouting() throws RouterExcept
.assertEquals(request.getHosts().size(), 1, "There should be only one host for each request"));
Set<Instance> instanceSet = new HashSet<>();
requests.stream().forEach(request -> instanceSet.add(request.getHosts().get(0)));
Assert.assertTrue(instanceSet.contains(instance1) && instanceSet.contains(instance2));
assertEquals(instanceSet.size(), 2, "The instanceSet does not have two entries: " + instanceSet);
Assert.assertTrue(instanceSet.contains(instance1), "instance1 is missing from the instanceSet: " + instanceSet);

Check failure on line 728 in services/venice-router/src/test/java/com/linkedin/venice/router/api/TestVeniceDelegateMode.java

View workflow job for this annotation

GitHub Actions / Router / UT & CodeCov (11)

TestVeniceDelegateMode.testScatterForMultiGetWithHelixAssistedRouting

java.lang.AssertionError: instance1 is missing from the instanceSet: [host4_123, host3_123] expected [true] but found [false]

Check failure on line 728 in services/venice-router/src/test/java/com/linkedin/venice/router/api/TestVeniceDelegateMode.java

View workflow job for this annotation

GitHub Actions / Router / UT & CodeCov (11)

TestVeniceDelegateMode.testScatterForMultiGetWithHelixAssistedRouting

java.lang.AssertionError: instance1 is missing from the instanceSet: [host4_123, host3_123] expected [true] but found [false]

Check failure on line 728 in services/venice-router/src/test/java/com/linkedin/venice/router/api/TestVeniceDelegateMode.java

View workflow job for this annotation

GitHub Actions / Router / UT & CodeCov (8)

TestVeniceDelegateMode.testScatterForMultiGetWithHelixAssistedRouting

java.lang.AssertionError: instance1 is missing from the instanceSet: [host4_123, host3_123] expected [true] but found [false]

Check failure on line 728 in services/venice-router/src/test/java/com/linkedin/venice/router/api/TestVeniceDelegateMode.java

View workflow job for this annotation

GitHub Actions / Router / UT & CodeCov (8)

TestVeniceDelegateMode.testScatterForMultiGetWithHelixAssistedRouting

java.lang.AssertionError: instance1 is missing from the instanceSet: [host4_123, host3_123] expected [true] but found [false]

Check failure on line 728 in services/venice-router/src/test/java/com/linkedin/venice/router/api/TestVeniceDelegateMode.java

View workflow job for this annotation

GitHub Actions / Router / UT & CodeCov (17)

TestVeniceDelegateMode.testScatterForMultiGetWithHelixAssistedRouting

java.lang.AssertionError: instance1 is missing from the instanceSet: [host4_123, host3_123] expected [true] but found [false]

Check failure on line 728 in services/venice-router/src/test/java/com/linkedin/venice/router/api/TestVeniceDelegateMode.java

View workflow job for this annotation

GitHub Actions / Router / UT & CodeCov (17)

TestVeniceDelegateMode.testScatterForMultiGetWithHelixAssistedRouting

java.lang.AssertionError: instance1 is missing from the instanceSet: [host4_123, host3_123] expected [true] but found [false]
Assert.assertTrue(instanceSet.contains(instance2), "instance2 is missing from the instanceSet: " + instanceSet);

// The second request should pick up another group
scatter = new Scatter(path, getPathParser(), VeniceRole.REPLICA);
Expand All @@ -740,7 +743,9 @@ public void testScatterForMultiGetWithHelixAssistedRouting() throws RouterExcept
.assertEquals(request.getHosts().size(), 1, "There should be only one host for each request"));
instanceSet.clear();
requests.stream().forEach(request -> instanceSet.add(request.getHosts().get(0)));
Assert.assertTrue(instanceSet.contains(instance1) && instanceSet.contains(instance2));
assertEquals(instanceSet.size(), 2, "The instanceSet does not have two entries: " + instanceSet);
Assert.assertTrue(instanceSet.contains(instance1), "instance1 is missing from the instanceSet: " + instanceSet);
Assert.assertTrue(instanceSet.contains(instance2), "instance2 is missing from the instanceSet: " + instanceSet);

// Test the scenario that all the replicas for a given partition are slow
// for partition 1, both instance1 and instance3 are slow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void testAggServerQuotaUsageStats() {
double totalQPS = 4d / 30d;
double totalKPS = (batchSize2 + batchSize * 3) / 30d;
Assert.assertEquals(metricsRepository.getMetric(totalReadQuotaRequestedQPSString).value(), totalQPS, 0.05);
Assert.assertEquals(metricsRepository.getMetric(totalReadQuotaRequestedKPSString).value(), totalKPS, 0.05);
Assert.assertEquals(metricsRepository.getMetric(totalReadQuotaRequestedKPSString).value(), totalKPS, 0.1);
Assert.assertEquals(metricsRepository.getMetric(quotaUsageRatio).value(), (200d / 30d) / 200d, 0.01);

String readQuotaRejectedQPSString = "." + storeName + "--quota_rejected_request.Rate";
Expand Down

0 comments on commit 0499e98

Please sign in to comment.