This is an automated email from the ASF dual-hosted git repository.

pabloem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 0df0a34b6e6 [BEAM-14448] add datastore test
     new 98044dd526f Merge pull request #17592 from [BEAM-14448] add datastore 
exception handling test
0df0a34b6e6 is described below

commit 0df0a34b6e64a237bb8b03add147c373cbd0f16c
Author: johnjcasey <[email protected]>
AuthorDate: Mon May 9 14:33:28 2022 -0400

    [BEAM-14448] add datastore test
---
 .../beam/sdk/io/gcp/datastore/DatastoreV1Test.java       | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git 
a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/datastore/DatastoreV1Test.java
 
b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/datastore/DatastoreV1Test.java
index 83715820719..0fc895b0d9e 100644
--- 
a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/datastore/DatastoreV1Test.java
+++ 
b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/datastore/DatastoreV1Test.java
@@ -814,6 +814,22 @@ public class DatastoreV1Test {
     verify(mockDatastore, times(1)).runQuery(gqlRequestWithZeroLimit);
   }
 
+  @Test
+  public void testTranslateGqlQueryWithException() throws Exception {
+    String gql = "SELECT * from DummyKind";
+    String gqlWithZeroLimit = gql + " LIMIT 0";
+    GqlQuery gqlQueryWithZeroLimit =
+        
GqlQuery.newBuilder().setQueryString(gqlWithZeroLimit).setAllowLiterals(true).build();
+    RunQueryRequest gqlRequestWithZeroLimit =
+        makeRequest(gqlQueryWithZeroLimit, V_1_OPTIONS.getNamespace());
+    when(mockDatastore.runQuery(gqlRequestWithZeroLimit))
+        .thenThrow(new RuntimeException("TestException"));
+
+    thrown.expect(RuntimeException.class);
+    thrown.expectMessage("TestException");
+    translateGqlQueryWithLimitCheck(gql, mockDatastore, 
V_1_OPTIONS.getNamespace());
+  }
+
   /** Test options. * */
   public interface RuntimeTestOptions extends PipelineOptions {
     ValueProvider<String> getDatastoreProject();

Reply via email to