-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SNOW-1693588 Upgrade to JUnit5 #1909
base: master
Are you sure you want to change the base?
Conversation
@@ -59,7 +59,8 @@ | |||
<jna.version>5.13.0</jna.version> | |||
<joda.time.version>2.8.1</joda.time.version> | |||
<json.smart.version>2.4.9</json.smart.version> | |||
<junit.version>4.13.2</junit.version> | |||
<junit.version>5.11.1</junit.version> | |||
<junit4.version>4.13.2</junit4.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in parent pom we don't neet junit4 anymore?
parent-pom.xml
Outdated
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
<version>${junit4.version}</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove junit 4?
@@ -257,10 +258,28 @@ | |||
<artifactId>opencensus-api</artifactId> | |||
<version>${opencensus.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.junit.jupiter</groupId> | |||
<artifactId>junit-jupiter-api</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are chaning the library - please start the security review for the new artifacts if not started
@@ -26,6 +26,7 @@ | |||
import org.junit.runners.model.FrameworkMethod; | |||
import org.junit.runners.model.Statement; | |||
|
|||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to keep the depracated methods for the old driver tests? it's not our API so can we remove it even now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably could. I recently noticed that some of their static methods are being used in assumptions, so I'll investigate what can be done about this (worst case we can extract the static methods to a util class)
src/test/java/net/snowflake/client/annotations/DontRunOnGithubActions.java
Show resolved
Hide resolved
@@ -39,81 +38,67 @@ | |||
import net.snowflake.client.jdbc.structuredtypes.sqldata.NullableFieldsSqlData; | |||
import net.snowflake.client.jdbc.structuredtypes.sqldata.SimpleClass; | |||
import net.snowflake.client.jdbc.structuredtypes.sqldata.StringClass; | |||
import org.junit.After; | |||
import net.snowflake.client.providers.FormatProvider; | |||
import org.junit.Assume; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about Assume usage? should we replace it with junit 5 equivalent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed we should, good catch
@@ -0,0 +1,13 @@ | |||
package net.snowflake.client.providers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add missing copyright header to the new files
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.ArgumentsProvider; | ||
|
||
public class FormatProvider implements ArgumentsProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename to ResultFormatProvider
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
|
||
public class SimpleFormatProvider extends SnowflakeArgumentsProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that it simple format for data time :) - can we rename this class to SimpleResultFormatProvider
?
|
||
@Override | ||
protected List<Arguments> rawArguments(ExtensionContext context) { | ||
return timeZones.subList(0, length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need length to just copy the list? cannot we just keep unmodifiable list in this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea here was to allow for some tests to easily get just a few of this. There were some long running tests that were originally running with 3-4 timezones only, and I decided not to double their execution time. Having said that, this is not useful when using it directly in the @ArgumentsSource
annotation, only when using the cartesianProduct
util
# Conflicts: # src/test/java/net/snowflake/client/jdbc/ClientMemoryLimitParallelIT.java # src/test/java/net/snowflake/client/jdbc/ConnectionIT.java # src/test/java/net/snowflake/client/jdbc/ConnectionLatestIT.java # src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataIT.java # src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataLatestIT.java # src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultsetIT.java # src/test/java/net/snowflake/client/jdbc/MultiStatementLatestIT.java # src/test/java/net/snowflake/client/jdbc/OpenGroupCLIFuncIT.java # src/test/java/net/snowflake/client/jdbc/PreparedMultiStmtArrowIT.java # src/test/java/net/snowflake/client/jdbc/PreparedMultiStmtIT.java # src/test/java/net/snowflake/client/jdbc/SnowflakeDriverLatestIT.java # src/test/java/net/snowflake/client/jdbc/SnowflakeUtilTest.java # src/test/java/net/snowflake/client/jdbc/StreamLatestIT.java
Overview
SNOW-1693588 upgraded all tests to junit5. There are a lot of changes, but most are of following types:
@Before
to@BeforeEach
,@BeforeClass
to@BeforeAll
etc.)@Rule
to@TempDir
)Pre-review self checklist
master
branchmvn -P check-style validate
)mvn verify
and inspecttarget/japicmp/japicmp.html
)SNOW-XXXX: