sadikovi commented on a change in pull request #33370:
URL: https://github.com/apache/spark/pull/33370#discussion_r671137488
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/jdbc/connection/ConnectionProviderSuite.scala
##########
@@ -45,6 +54,84 @@ class ConnectionProviderSuite extends
ConnectionProviderSuiteBase with SharedSpa
}
}
+ test("Throw an error selecting from an empty list of providers on create") {
+ val providerBase = new ConnectionProviderBase() {
+ override val providers = Seq.empty
+ }
+
+ val err1 = intercept[IllegalArgumentException] {
+ providerBase.create(mock[Driver], Map.empty, None)
+ }
+ assert(err1.getMessage.contains("Empty list of JDBC connection providers"))
+
+ val err2 = intercept[IllegalArgumentException] {
+ providerBase.create(mock[Driver], Map.empty, Some("test"))
+ }
+ assert(err2.getMessage.contains("Empty list of JDBC connection providers"))
+ }
+
+ test("Throw an error when more than one provider is available on create") {
+ val provider1 = new JdbcConnectionProvider() {
Review comment:
IMHO, I would have to provide closures for `canHandle` and
`getConnection` to the class anyway, so I am not quite sure what the test
wrapper class would accomplish.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]