You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2022/08/08 02:37:35 UTC

[GitHub] [incubator-pegasus] foreverneverer commented on a diff in pull request #1104: refactor(java): add more detail message for error log

foreverneverer commented on code in PR #1104:
URL: https://github.com/apache/incubator-pegasus/pull/1104#discussion_r939777082


##########
java-client/idl/recompile_thrift.sh:
##########
@@ -19,7 +19,7 @@
 # under the License.
 #
 
-function GenThriftTool() {
+function GenThriftTool(){

Review Comment:
   revert



##########
java-client/src/test/java/org/apache/pegasus/client/TestBasic.java:
##########
@@ -2780,4 +2783,78 @@ private void assertScanResult(
           new String(actuallyRes.results.get(i - startIndex).getRight()));
     }
   }
+  @Test   //To create a timeout condition,need to change configuration/pegasus.properties timeout parameter to 1 in this case
+  public void testRequestDetail() throws PException {
+    PegasusClientInterface client = PegasusClientFactory.getSingletonClient();
+    String tableName = "temp";
+    PegasusTableInterface tb = client.openTable(tableName);
+
+    String HashPrefix = "TestHash";
+    String SortPrefix = "TestSort";
+    String hashKey = HashPrefix + "_0";
+    String sortKey = SortPrefix + "_0";
+
+    try {
+      // multiSet timeout
+      System.out.println("Test multiSet PException request");
+
+      String multiValue2 = RandomStringUtils.random(5, true, true);
+      List<Pair<byte[], byte[]>> multiValues2 = new ArrayList<Pair<byte[], byte[]>>();
+      int count2 = 500;
+      while (count2-- > 0) {
+        multiValues2.add(Pair.of(sortKey.getBytes(), multiValue2.getBytes()));
+      }
+
+      Throwable exception = Assertions.assertThrows(PException.class,()->{
+        client.multiSet(tableName, hashKey.getBytes(), multiValues2);
+      });
+      System.out.println(exception.getMessage());
+
+      //checkAndMutate timeout
+      System.out.println("Test checkAndMutate PException request");
+      Mutations mutations = new Mutations();
+      mutations.set(sortKey.getBytes(), "2".getBytes());
+
+      CheckAndMutateOptions options = new CheckAndMutateOptions();
+      options.returnCheckValue = true;
+      Throwable exception2 =  Assertions.assertThrows(PException.class,()->{
+        client.checkAndMutate(
+                tableName,
+                hashKey.getBytes(),
+                "k5".getBytes(),
+                CheckType.CT_VALUE_INT_LESS,
+                "2".getBytes(),
+                mutations,
+                options);
+      });
+      System.out.println(exception2.getMessage());
+
+      //multiDel timeout
+      System.out.println("Test multiDel PException request");
+      List<Pair<byte[], byte[]>> multiValues3 = new ArrayList<Pair<byte[], byte[]>>();
+      List<byte[]> sortKeys = new ArrayList<byte[]>();
+      multiValues3.add(Pair.of("basic_test_sort_key_0".getBytes(), "basic_test_value_0".getBytes()));
+      multiValues3.add(Pair.of("basic_test_sort_key_1".getBytes(), "basic_test_value_1".getBytes()));
+      multiValues3.add(Pair.of("basic_test_sort_key_2".getBytes(), "basic_test_value_2".getBytes()));
+      sortKeys.add("basic_test_sort_key_0".getBytes());
+      sortKeys.add("basic_test_sort_key_1".getBytes());
+      sortKeys.add("basic_test_sort_key_2".getBytes());
+
+      tb.multiSet(hashKey.getBytes(),multiValues3,5000);
+      Assertions.assertDoesNotThrow(()->{
+        tb.multiSet(hashKey.getBytes(),multiValues3,5000);
+      });
+
+      Throwable exception3 =  Assertions.assertThrows(PException.class,()->{
+        client.multiDel(tableName,hashKey.getBytes(),sortKeys);
+      });
+      System.out.println(exception3);

Review Comment:
   you should test the log content, so just assert and print is not enough



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org