Skip to content

Commit

Permalink
fix: fix failing storage tests (#390)
Browse files Browse the repository at this point in the history
Stop looking at error metadata to determine whether an already exists
error is for a store or cache. We can check it when that is added on the
server side.

Update a test that was checking that the server could support empty keys
in the store client. That changed on the server side.
  • Loading branch information
nand4011 authored Sep 3, 2024
1 parent 1387cd0 commit bc7ff0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public void badStoreNameReturnsError() {
}

@Test
public void allowEmptyKeyValuesOnGet() throws Exception {
final String emptyKey = "";
public void allowEmptyValuesOnGet() throws Exception {
final String key = randomString("key");
final String emptyValue = "";
storageClient.put(storeName, emptyKey, emptyValue).get();
final GetResponse response = storageClient.get(storeName, emptyKey).get();
storageClient.put(storeName, key, emptyValue).get();
final GetResponse response = storageClient.get(storeName, key).get();
assertThat(response).isInstanceOf(GetResponse.Found.class);
assert response.valueWhenFound().get().getString().get().isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public static SdkException convert(Throwable e) {
return new CacheNotFoundException(grpcException, errorDetails);
}
case ALREADY_EXISTS:
if (errorCause.contains("Store with name")) {
// TODO: Switch to use the metadata when that can distinguish between a store and cache
// already exists
if (grpcException.getMessage().contains("Store with name")) {
return new StoreAlreadyExistsException(grpcException, errorDetails);
} else {
return new CacheAlreadyExistsException(grpcException, errorDetails);
Expand Down

0 comments on commit bc7ff0c

Please sign in to comment.