Skip to content

Commit 03438b2

Browse files
authored
Merge pull request #4110 from confluentinc/test-kek
DGS-23351 Add API to test shared KEKs to DEK Registry client
2 parents 59d2bb0 + 9a90800 commit 03438b2

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

dek-registry-client/src/main/java/io/confluent/dekregistry/client/CachedDekRegistryClient.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,12 @@ public void undeleteDekVersion(
469469
dekCache.invalidateAll();
470470
}
471471

472+
@Override
473+
public void testKek(String name)
474+
throws IOException, RestClientException {
475+
restService.testKek(DEFAULT_REQUEST_PROPERTIES, name);
476+
}
477+
472478
@Override
473479
public void reset() {
474480
kekCache.invalidateAll();

dek-registry-client/src/main/java/io/confluent/dekregistry/client/DekRegistryClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ void undeleteDek(String kekName, String subject, DekFormat algorithm)
140140
void undeleteDekVersion(String kekName, String subject, int version, DekFormat algorithm)
141141
throws IOException, RestClientException;
142142

143+
default void testKek(String name)
144+
throws IOException, RestClientException {
145+
throw new UnsupportedOperationException();
146+
}
147+
143148
void reset();
144149

145150
@Override

dek-registry-client/src/main/java/io/confluent/dekregistry/client/rest/DekRegistryRestService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,4 +431,12 @@ public void undeleteDekVersion(Map<String, String> requestProperties, String nam
431431

432432
httpRequest(path, "POST", null, requestProperties, VOID_TYPE);
433433
}
434+
435+
public void testKek(Map<String, String> requestProperties, String name)
436+
throws IOException, RestClientException {
437+
UriBuilder builder = UriBuilder.fromPath("/dek-registry/v1/keks/{name}/test");
438+
String path = builder.build(name).toString();
439+
440+
httpRequest(path, "POST", null, requestProperties, VOID_TYPE);
441+
}
434442
}

dek-registry/src/test/java/io/confluent/dekregistry/web/rest/RestApiTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ private void testBasic(Map<String, String> headers, boolean isImport) throws Exc
267267
newKek = client.updateKek(headers, kekName, kmsProps, doc, true);
268268
assertEquals(kek2, newKek);
269269

270+
// Test shared kek
271+
client.testKek(kekName);
272+
270273
// Advance ticker
271274
fakeTicker.advance(61, TimeUnit.SECONDS);
272275

0 commit comments

Comments
 (0)