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 ``` -- 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-unsubscr...@drill.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org