Test JDBC connection creations#14749
Conversation
d8d633b to
07b45f2
Compare
There was a problem hiding this comment.
Does singleThreaded on a base class apply to child classes?
(i think it does not)
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
...ostgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Can this be simpler?
E.g. we don't have any extra credentials in the test, and also a StaticCredentialProvider was already constructed earlier.
There was a problem hiding this comment.
I would prefer this testing plugin for postgresql to be as close to real as possible. We don't win much using things like StaticCredentialProvider and we may end up having completely two connectors for postgresql, which I would like to avoid.
...ostgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
...ostgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
See
for the convention.There was a problem hiding this comment.
It is no longer needed.
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
...ostgresql/src/main/java/io/trino/plugin/postgresql/PostgreSqlClientAuthenticationModule.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
875bcba to
640cd3e
Compare
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestingH2JdbcModule.java
Outdated
Show resolved
Hide resolved
...ostgresql/src/main/java/io/trino/plugin/postgresql/PostgreSqlClientAuthenticationModule.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
It is no longer needed.
...ostgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
I would prefer this testing plugin for postgresql to be as close to real as possible. We don't win much using things like StaticCredentialProvider and we may end up having completely two connectors for postgresql, which I would like to avoid.
54a2cde to
4e90d4d
Compare
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
IllegalStateException(String message, Throwable cause)
There was a problem hiding this comment.
There is a difference in semantic between suppressed exception and a cause exception. Neither of them fits in 100% here, however suppressed sounds to be closer ;)
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
plugin/trino-postgresql/src/main/java/io/trino/plugin/postgresql/PostgreSqlClientModule.java
Outdated
Show resolved
Hide resolved
...ostgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Instead of creating a new TestingPostgreSqlPlugin can we combine these module and create a JdbcPlugin like this new JdbcPlugin("jdbc", combine(new PostgreSqlClientModule(), new TestingPostgreSqlModule())
4e90d4d to
b525f99
Compare
There was a problem hiding this comment.
There is a difference in semantic between suppressed exception and a cause exception. Neither of them fits in 100% here, however suppressed sounds to be closer ;)
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
...ostgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
...ostgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
...ostgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
h2 is an implementation detail. There is no such connector like h2. It is more about testing the base jdbc framework, which we usually call jdbc in tests.
There was a problem hiding this comment.
Just thoughs aloud: these are trino statements, and reused for different connectors, however even for h2 and postgres numbers are really different. Would be great to reuse them somehow..
There was a problem hiding this comment.
Queries are the almost the same, however expected behavior is connector specific. I don't see a good way of doing this and keeping the code simple.
There was a problem hiding this comment.
is it the last entry by intention? does it matter?
There was a problem hiding this comment.
To make sure that closed and connectionCreations are in a good shape. However it does not matter much. Tests will fail in case of any exception here.
There was a problem hiding this comment.
I think it does not matter too.
There was a problem hiding this comment.
To make sure that closed and connectionCreations are in a good shape. However it does not matter much. Tests will fail in case of any exception here.
There was a problem hiding this comment.
h2 is an implementation detail. There is no such connector like h2. It is more about testing the base jdbc framework, which we usually call jdbc in tests.
There was a problem hiding this comment.
Queries are the almost the same, however expected behavior is connector specific. I don't see a good way of doing this and keeping the code simple.
...ostgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
8b3adeb to
bd1a780
Compare
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestJdbcConnectionCreation.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
is ordering across @BeforeClass methods deterministic?
There was a problem hiding this comment.
clever - unfortunately I can't think of better ways to store this information either
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/BaseJdbcConnectionCreationTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
is this significant for the test? Deserves some comment IMO.
There was a problem hiding this comment.
I wanted to make sure that we always open connections in a deterministic manner. Like we read data on worker. I don't think it is needed and possibly it lowers the test coverage. So I will remove it.
That way it is possible to inject a different way to provision ConnectionFactory in PostgreSql connector.
bd1a780 to
c697cf6
Compare
There was a problem hiding this comment.
LGTM % some clarity around #14749 (comment) (@BeforeClass ordering)
Test JDBC connection creations