[ 
https://issues.apache.org/jira/browse/DRILL-8117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17692073#comment-17692073
 ] 

ASF GitHub Bot commented on DRILL-8117:
---------------------------------------

jnturton commented on code in PR #2763:
URL: https://github.com/apache/drill/pull/2763#discussion_r1114071613


##########
docs/dev/ClusterFixture.md:
##########
@@ -125,6 +125,27 @@ In some cases, you may want to change an option in a test. 
Rather than writing o
 
 Again, you can pass a Java value which the test code will convert to a string, 
then will build the `ALTER SESSION` command.
 
+# Try-with-resource Style of Creating Single-use Client Fixtures.
+
+The benefit of Cluster Fixture framework is to define specific config for 
specific clusterFixture and clientFixture as needed flexibly.

Review Comment:
   ```suggestion
   A benefit of the Cluster Fixture framework is the ability to define specific 
configs for specific clusterFixtures and clientFixtures as needed flexibly.
   ```



##########
docs/dev/ClusterFixture.md:
##########
@@ -156,6 +177,28 @@ It is often very handy, during development, to accumulate 
a collection of test f
 * The (local) file system location
 * The default format
 
+# Exception Matcher
+
+The `QueryBuilder` provides a clean and concise way to handle Exception match 
which includes type match and pattern match:

Review Comment:
   ```suggestion
   The `QueryBuilder` provides a clean and concise way to handle UserException 
matching which includes error type matching and error message pattern matching:
   ```



##########
docs/dev/ClusterFixture.md:
##########
@@ -125,6 +125,27 @@ In some cases, you may want to change an option in a test. 
Rather than writing o
 
 Again, you can pass a Java value which the test code will convert to a string, 
then will build the `ALTER SESSION` command.
 
+# Try-with-resource Style of Creating Single-use Client Fixtures.
+
+The benefit of Cluster Fixture framework is to define specific config for 
specific clusterFixture and clientFixture as needed flexibly.
+
+In some cases, clusterFixture has been initialized, and we need to create 
several different config clients for different test cases,
+
+We could use try-with-resource style to creating single-use clientFixture.

Review Comment:
   ```suggestion
   Using Java's try-with-resources syntax to create a single-use clientFixture 
is a convenient way to ensure that the clientFixture will automatically be 
closed once we've finished with it.
   ```



##########
docs/dev/ClusterFixture.md:
##########
@@ -125,6 +125,27 @@ In some cases, you may want to change an option in a test. 
Rather than writing o
 
 Again, you can pass a Java value which the test code will convert to a string, 
then will build the `ALTER SESSION` command.
 
+# Try-with-resource Style of Creating Single-use Client Fixtures.
+
+The benefit of Cluster Fixture framework is to define specific config for 
specific clusterFixture and clientFixture as needed flexibly.
+
+In some cases, clusterFixture has been initialized, and we need to create 
several different config clients for different test cases,

Review Comment:
   ```suggestion
   In some cases, clusterFixture has been initialized and we need to create 
several different config clients for different test cases.
   ```
   ```suggestion
   In some cases, a clusterFixture has been initialized and we need to create 
several different config clients for different test cases.
   ```



##########
docs/dev/ClusterFixture.md:
##########
@@ -156,6 +177,28 @@ It is often very handy, during development, to accumulate 
a collection of test f
 * The (local) file system location
 * The default format
 
+# Exception Matcher
+
+The `QueryBuilder` provides a clean and concise way to handle Exception match 
which includes type match and pattern match:
+
+```
+    @Test
+    public void unsupportedLiteralValidation() throws Exception {
+      String query = "ALTER session SET `%s` = %s";
+
+      client.queryBuilder()
+        .sql(query, ENABLE_VERBOSE_ERRORS_KEY, "DATE '1995-01-01'")
+        .userExceptionMatcher()
+        .expectedType(ErrorType.VALIDATION)
+        .include("Drill doesn't support assigning literals of type")
+        .match();
+    }
+```
+* Use `.userExceptionMatcher` to call UserExceptionMatcher
+* Use `.expectedType` to define expected Error type
+* Use `.include` to define expected Error pattern

Review Comment:
   ```suggestion
   * Use `.include` to define an expected error message regex pattern
   * Use `.exclude` to define an unexpected error message regex pattern
   ```





> Upgrade unit tests to the cluster fixture framework
> ---------------------------------------------------
>
>                 Key: DRILL-8117
>                 URL: https://issues.apache.org/jira/browse/DRILL-8117
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.20.1
>            Reporter: Jingchuan Hu
>            Assignee: James Turton
>            Priority: Major
>             Fix For: 1.21.0
>
>
> Upgrade various unit tests to the cluster fixture framework and replace other 
> instances of deprecated code usage.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to