Skip to content

Commit

Permalink
Add Model for FailoutProperties (#789)
Browse files Browse the repository at this point in the history
* Added D2FailoutProperties model. This weakly typed model will be converted to a strongly typed model elsewhere.
  • Loading branch information
cstufflebeam authored May 10, 2022
1 parent cd3eabd commit e4c851b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace com.linkedin.d2

/**
* Loosely typed model containing data that controls the failout state an application.
*/
record D2FailoutProperties {
/**
* Routing data for offline partitions.
*/
failoutRedirectConfigs: array[ map[string, D2FailoutPropertiesConfigValue]]

/**
* Batch of buckets to failout.
*/
failoutBucketConfigs: array[ map[string, D2FailoutPropertiesConfigValue]]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace com.linkedin.d2


/**
* Weakly typed configValue containing failout data (Later to be converted in to a strongly typed object).
*/
typeref D2FailoutPropertiesConfigValue = union[longValue: long, intValue: int, stringValue: string, mapValue: map[string, int]]
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import com.linkedin.r2.transport.common.bridge.common.TransportCallback;
import com.linkedin.r2.transport.common.bridge.common.TransportResponseImpl;
import com.linkedin.test.util.retry.SingleRetry;
import com.linkedin.test.util.retry.ThreeRetries;
import com.linkedin.util.clock.SystemClock;
import java.io.IOException;
import java.net.URI;
Expand Down Expand Up @@ -233,7 +234,7 @@ public void onSuccess(StreamResponse result) {
/**
* Backup Request should still work when a hint is given together with the flag indicating that the hint is only a preference, not requirement.
*/
@Test(invocationCount = 3, dataProvider = "isD2Async", retryAnalyzer = SingleRetry.class) // Appears to be flaky in CI
@Test(invocationCount = 3, dataProvider = "isD2Async", retryAnalyzer = ThreeRetries.class) // Appears to be flaky in CI
public void testRequestWithHint(boolean isD2Async) throws Exception
{
int responseDelayNano = 100000000; //1s till response comes back
Expand Down Expand Up @@ -425,7 +426,7 @@ private static long busyWaitUntil(long nextNano)
}
}

@Test(dataProvider = "isD2Async")
@Test(dataProvider = "isD2Async", retryAnalyzer = ThreeRetries.class)
public void testStatsConsumerAddRemove(boolean isD2Async) throws Exception
{
AtomicReference<ServiceProperties> serviceProperties = new AtomicReference<>();
Expand Down

0 comments on commit e4c851b

Please sign in to comment.