Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ dependencies {
implementation("com.google.code.gson:gson:2.13.2")
implementation("io.github.resilience4j:resilience4j-circuitbreaker:2.3.0")
compileOnly("javax.annotation:javax.annotation-api:1.3.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.14.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:6.0.2")
testImplementation("org.testcontainers:junit-jupiter:1.21.4")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.14.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:6.0.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("ch.qos.logback:logback-core:1.5.24")
testImplementation("ch.qos.logback:logback-classic:1.5.24")
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/dev/cerbos/sdk/hub/CircuitBreaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ enum CircuitBreaker {
public <T> T execute(CheckedSupplier<T> s) throws Throwable {
return circuitBreaker.decorateCheckedSupplier(s).get();
}

void reset() {
circuitBreaker.reset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public static StoreException from(Throwable cause) {
case Code.PERMISSION_DENIED_VALUE:
return new PermissionDeniedException(cause);

case Code.RESOURCE_EXHAUSTED_VALUE:
return new TooManyRequestsException(cause);

case Code.UNAUTHENTICATED_VALUE:
return new AuthenticationFailedException(cause);

Expand Down Expand Up @@ -93,6 +96,7 @@ public static StoreException from(Throwable cause) {
}
}
break;

}

return new UnknownException(cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public static void initClient() {

@BeforeEach
public void resetStore() throws IOException, StoreException, URISyntaxException {
CircuitBreaker.INSTANCE.reset();
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Path dir = Path.of(loader.getResource("hub/replace_files/success").toURI());
Store.ReplaceFilesResponse replaceResp = client.replaceFilesLenient(Store.newReplaceFilesRequest(storeID, "Reset store", Utils.createZip(dir)));
Expand Down
Loading