-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make rate limit error code configurable
- Loading branch information
Showing
5 changed files
with
112 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
kaldb/src/test/java/com/slack/kaldb/util/TestingZKServer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.slack.kaldb.util; | ||
|
||
import static org.assertj.core.api.Assertions.fail; | ||
|
||
import org.apache.curator.test.TestingServer; | ||
|
||
/** | ||
* This class is responsible for creating a testing ZK server for testing purposes. We create the ZK | ||
* server in a separate thread to avoid blocking the main thread. This improves the reliability of | ||
* the tests i.e I can put a debug point while running a test and ZKServer won't get blocked. | ||
* ZkServer getting blocked leads to a session expiry which will cause curator(the client) to | ||
* disconnect and call the runtime halter | ||
*/ | ||
public class TestingZKServer { | ||
|
||
public static TestingServer createTestingServer() throws InterruptedException { | ||
ZKTestingServer zkTestingServer = new ZKTestingServer(); | ||
Thread.ofVirtual().start(zkTestingServer).join(); | ||
return zkTestingServer.zkServer; | ||
} | ||
|
||
private static class ZKTestingServer implements Runnable { | ||
public TestingServer zkServer; | ||
|
||
@Override | ||
public void run() { | ||
try { | ||
zkServer = new TestingServer(); | ||
} catch (Exception e) { | ||
fail("Failed to start ZK server", e); | ||
} | ||
} | ||
} | ||
} |