Skip to content
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

Open
wants to merge 87 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
8956d3f
Initial upgrade
sfc-gh-astachowski Oct 4, 2024
fe34193
Formatting fix
sfc-gh-astachowski Oct 4, 2024
4788157
Formatting fix
sfc-gh-astachowski Oct 4, 2024
ed62767
Removed extra dependencies
sfc-gh-astachowski Oct 4, 2024
c219985
Changed temporary directories
sfc-gh-astachowski Oct 4, 2024
17c51ad
Add explicit dependency on junit4
sfc-gh-astachowski Oct 4, 2024
50ba1ca
Add test scope to junit4
sfc-gh-astachowski Oct 4, 2024
c6db3ef
Pom fix
sfc-gh-astachowski Oct 4, 2024
63eaf4b
Added junit5 to test only pom
sfc-gh-astachowski Oct 4, 2024
3dd6e40
Added junit5 engine and migrated Assumptions
sfc-gh-astachowski Oct 9, 2024
8a503d5
Formatting
sfc-gh-astachowski Oct 9, 2024
9d71987
Attempt to fix dependencies
sfc-gh-astachowski Oct 10, 2024
84a8c34
Attempt to fix dependencies
sfc-gh-astachowski Oct 10, 2024
4c72889
Removed junit4 entirely
sfc-gh-astachowski Oct 11, 2024
af01a07
Formatting
sfc-gh-astachowski Oct 11, 2024
7461ef5
Fixed FIPS folder
sfc-gh-astachowski Oct 11, 2024
f5d91f4
Further fixes to FIPS
sfc-gh-astachowski Oct 11, 2024
8dbb729
Fixed package names
sfc-gh-astachowski Oct 11, 2024
5e7a55e
Changed to static imports
sfc-gh-astachowski Oct 11, 2024
62864ef
Changed categories to tags
sfc-gh-astachowski Oct 11, 2024
1a1b111
Formatting
sfc-gh-astachowski Oct 11, 2024
b8add67
Added test suites (expected to fail on old driver at the moment)
sfc-gh-astachowski Oct 25, 2024
39d8383
Fips fix
sfc-gh-astachowski Oct 25, 2024
158dc3b
Added dependencies for local testing
sfc-gh-astachowski Oct 29, 2024
d210c0e
Merge branch 'master' into SNOW-1693588-upgrade-to-junit5
sfc-gh-astachowski Oct 29, 2024
b18e508
Merge with master
sfc-gh-astachowski Oct 29, 2024
c418979
Formatting
sfc-gh-astachowski Oct 29, 2024
bf3b1d0
Added explicit junit4 dependency
sfc-gh-astachowski Oct 29, 2024
b593608
Removed test category from pom
sfc-gh-astachowski Oct 29, 2024
68805e9
Added explicit surefire provider
sfc-gh-astachowski Oct 29, 2024
335828e
Changed prepared statement tests to parameterized
sfc-gh-astachowski Oct 31, 2024
5f578b2
Formatting
sfc-gh-astachowski Oct 31, 2024
4899819
Merge master
sfc-gh-astachowski Oct 31, 2024
31023c4
Formatting
sfc-gh-astachowski Oct 31, 2024
4a97907
Refactored result set serializable tests from inheritance to paramete…
sfc-gh-astachowski Nov 5, 2024
73ce0fd
Refactored callable statement tests to avoid running a test twice
sfc-gh-astachowski Nov 5, 2024
704f86f
Fixed assertions of array equality
sfc-gh-astachowski Nov 5, 2024
c9b15df
Changed asserting a properties value to setting and reverting it
sfc-gh-astachowski Nov 5, 2024
6295d2c
Removed a class to avoid duplicating tests with parent class, in whic…
sfc-gh-astachowski Nov 5, 2024
239f71c
Formatting
sfc-gh-astachowski Nov 5, 2024
f8156ee
Script changes
sfc-gh-astachowski Nov 5, 2024
aa592b1
Added restoring static values in Session Util Test
sfc-gh-astachowski Nov 5, 2024
cabb3af
Added restoring static values in Trust Manager Test
sfc-gh-astachowski Nov 5, 2024
b5f811c
Ignore GCP test on Github Actions
sfc-gh-astachowski Nov 6, 2024
e045c7e
Fixed testing script
sfc-gh-astachowski Nov 6, 2024
37b6d16
Fixed testing script
sfc-gh-astachowski Nov 6, 2024
4d99bf7
Added closing input streams to Arrow Result Set IT
sfc-gh-astachowski Nov 6, 2024
52252f2
Removed Result Set Arrow IT, as it's parent class has previously been…
sfc-gh-astachowski Nov 6, 2024
e9001e0
Temporarily disabled potentially problematic test
sfc-gh-astachowski Nov 6, 2024
ac43895
Formatting
sfc-gh-astachowski Nov 6, 2024
3d0a3b3
Temporarily disabled failing test
sfc-gh-astachowski Nov 6, 2024
7641cc7
Disabled failsafe integration-test
sfc-gh-astachowski Nov 7, 2024
f53ba90
Running secure storage manager tests only on relevant systems
sfc-gh-astachowski Nov 7, 2024
a4a5d32
Added try-with-resources for input stream
sfc-gh-astachowski Nov 7, 2024
29a7dec
Added old driver tests
sfc-gh-astachowski Nov 7, 2024
e98c743
Formatting
sfc-gh-astachowski Nov 7, 2024
80c7458
Changed test provider for old driver tests
sfc-gh-astachowski Nov 7, 2024
ee773d3
Bumped the version of failsafe plugin
sfc-gh-astachowski Nov 7, 2024
11bafe5
Changed junit jupiter api version
sfc-gh-astachowski Nov 7, 2024
200fbb0
Removed unit tests from tests excluded from build
sfc-gh-astachowski Nov 7, 2024
c6a1656
Reverted dependency version change
sfc-gh-astachowski Nov 7, 2024
eed2726
Added unit tests back to exclude from compilation list for old driver…
sfc-gh-astachowski Nov 8, 2024
bdd0142
Removed Core and Unit tests from old drivers tests
sfc-gh-astachowski Nov 8, 2024
45a9394
Changed a dependency
sfc-gh-astachowski Nov 8, 2024
f1299ed
Changed a dependency
sfc-gh-astachowski Nov 8, 2024
2a94a10
Changed a dependency
sfc-gh-astachowski Nov 8, 2024
fce902c
Changed windows testing script to run multiple suites at once
sfc-gh-astachowski Nov 8, 2024
9c4e457
Restored old test names
sfc-gh-astachowski Nov 8, 2024
70fbd2a
Added copyright headers
sfc-gh-astachowski Nov 12, 2024
a59bec7
Removed empty file
sfc-gh-astachowski Nov 12, 2024
5729e22
Removed old ignore conditions and test categories
sfc-gh-astachowski Nov 12, 2024
49bfc08
Changed imports to assumptionUtil
sfc-gh-astachowski Nov 12, 2024
6f28e2e
Added missing copyright header
sfc-gh-astachowski Nov 12, 2024
6f9ae50
Renamed format providers to result format providers
sfc-gh-astachowski Nov 12, 2024
d35574f
Changed test annotation from junit4 to junit5
sfc-gh-astachowski Nov 12, 2024
8fb4e63
Moved throw assertions to relevant lines
sfc-gh-astachowski Nov 12, 2024
cb2239a
Added don't run on Github annotation
sfc-gh-astachowski Nov 12, 2024
afaf5d6
Merge branch 'master' into SNOW-1693588-upgrade-to-junit5
sfc-gh-astachowski Nov 14, 2024
2e33f77
Added system properties in build
sfc-gh-astachowski Nov 14, 2024
5aafdf2
Temporary disable test
sfc-gh-astachowski Nov 14, 2024
9197cd3
Temporary disable tests
sfc-gh-astachowski Nov 15, 2024
dd672e0
Script fix
sfc-gh-astachowski Nov 15, 2024
994b956
Added TODO
sfc-gh-astachowski Nov 15, 2024
e63c961
Re-enabled to test
sfc-gh-astachowski Nov 15, 2024
cca23d8
Formatting
sfc-gh-astachowski Nov 15, 2024
fa966fb
Disabled test with ticket attached
sfc-gh-astachowski Nov 15, 2024
8058d8e
Switched from failsafe to surefire
sfc-gh-astachowski Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ jobs:

test-windows:
needs: build
name: ${{ matrix.runConfig.cloud }} Windows java ${{ matrix.runConfig.javaVersion }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category }}
name: ${{ matrix.runConfig.cloud }} Windows java ${{ matrix.runConfig.javaVersion }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category.name }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
runConfig: [ {cloud: 'AWS', javaVersion: '8'}, {cloud: 'GCP', javaVersion: '11'}, {cloud: 'AZURE', javaVersion: '17'}, {cloud: 'AWS', javaVersion: '21'}]
category: ['TestCategoryResultSet,TestCategoryStatement,TestCategoryLoader', 'TestCategoryOthers', 'TestCategoryArrow,TestCategoryConnection,TestCategoryCore,TestCategoryDiagnostic', 'TestCategoryFips']
category: [{suites: 'ResultSetTestSuite,StatementTestSuite,LoaderTestSuite', name: 'TestCategoryResultSet,TestCategoryStatement,TestCategoryLoader'},
{suites: 'OthersTestSuite', name: 'TestCategoryOthers'},
{suites: 'ArrowTestSuite,ConnectionTestSuite,CoreTestSuite,DiagnosticTestSuite', name: 'TestCategoryArrow,TestCategoryConnection,TestCategoryCore,TestCategoryDiagnostic'},
{suites: 'FipsTestSuite', name: "TestCategoryFips"}]
additionalMavenProfile: ['']
steps:
- uses: actions/checkout@v4
Expand All @@ -62,19 +65,22 @@ jobs:
env:
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }}
CLOUD_PROVIDER: ${{ matrix.runConfig.cloud }}
JDBC_TEST_CATEGORY: ${{ matrix.category }}
JDBC_TEST_CATEGORY: ${{ matrix.category.suites }}
ADDITIONAL_MAVEN_PROFILE: ${{ matrix.additionalMavenProfile }}
run: ci\\test_windows.bat

test-mac:
needs: build
name: ${{ matrix.runConfig.cloud }} Mac java ${{ matrix.runConfig.javaVersion }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category }}
name: ${{ matrix.runConfig.cloud }} Mac java ${{ matrix.runConfig.javaVersion }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category.name }}
runs-on: macos-13
strategy:
fail-fast: false
matrix:
runConfig: [ {cloud: 'AWS', javaVersion: '8'}, {cloud: 'GCP', javaVersion: '11'}, {cloud: 'AZURE', javaVersion: '17'}, {cloud: 'AWS', javaVersion: '21'}]
category: ['TestCategoryResultSet,TestCategoryStatement,TestCategoryLoader', 'TestCategoryOthers', 'TestCategoryArrow,TestCategoryConnection,TestCategoryCore,TestCategoryDiagnostic', 'TestCategoryFips']
category: [{suites: 'ResultSetTestSuite,StatementTestSuite,LoaderTestSuite', name: 'TestCategoryResultSet,TestCategoryStatement,TestCategoryLoader'},
{suites: 'OthersTestSuite', name: 'TestCategoryOthers'},
{suites: 'ArrowTestSuite,ConnectionTestSuite,CoreTestSuite,DiagnosticTestSuite', name: 'TestCategoryArrow,TestCategoryConnection,TestCategoryCore,TestCategoryDiagnostic'},
{suites: 'FipsTestSuite', name: "TestCategoryFips"}]
additionalMavenProfile: ['']
steps:
- uses: actions/checkout@v4
Expand All @@ -94,20 +100,23 @@ jobs:
env:
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }}
CLOUD_PROVIDER: ${{ matrix.runConfig.cloud }}
JDBC_TEST_CATEGORY: ${{ matrix.category }}
JDBC_TEST_CATEGORY: ${{ matrix.category.suites }}
ADDITIONAL_MAVEN_PROFILE: ${{ matrix.additionalMavenProfile }}
run: /usr/local/bin/bash ./ci/test_mac.sh

test-linux:
needs: build
name: ${{ matrix.cloud }} Linux java on ${{ matrix.image }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category }}
name: ${{ matrix.cloud }} Linux java on ${{ matrix.image }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: [ 'jdbc-centos7-openjdk8', 'jdbc-centos7-openjdk11', 'jdbc-centos7-openjdk17', 'jdbc-centos7-openjdk21' ]
cloud: [ 'AWS', 'AZURE', 'GCP' ]
category: ['TestCategoryResultSet,TestCategoryStatement,TestCategoryLoader', 'TestCategoryOthers', 'TestCategoryArrow,TestCategoryConnection,TestCategoryCore,TestCategoryDiagnostic', 'TestCategoryFips']
category: [{suites: 'ResultSetTestSuite,StatementTestSuite,LoaderTestSuite', name: 'TestCategoryResultSet,TestCategoryStatement,TestCategoryLoader'},
{suites: 'OthersTestSuite', name: 'TestCategoryOthers'},
{suites: 'ArrowTestSuite,ConnectionTestSuite,CoreTestSuite,DiagnosticTestSuite', name: 'TestCategoryArrow,TestCategoryConnection,TestCategoryCore,TestCategoryDiagnostic'},
{suites: 'FipsTestSuite', name: "TestCategoryFips"}]
additionalMavenProfile: ['', '-Dthin-jar']
steps:
- uses: actions/checkout@v1
Expand All @@ -117,19 +126,21 @@ jobs:
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }}
CLOUD_PROVIDER: ${{ matrix.cloud }}
TARGET_DOCKER_TEST_IMAGE: ${{ matrix.image }}
JDBC_TEST_CATEGORY: ${{ matrix.category }}
JDBC_TEST_CATEGORY: ${{ matrix.category.suites }}
ADDITIONAL_MAVEN_PROFILE: ${{ matrix.additionalMavenProfile }}
run: ./ci/test.sh

test-linux-old-driver:
name: Old JDBC ${{ matrix.category }} on ${{ matrix.image }}
name: Old JDBC ${{ matrix.category.name }} on ${{ matrix.image }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: [ 'jdbc-centos7-openjdk8' ]
cloud: [ 'AWS' ]
category: ['TestCategoryOthers', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryCore,TestCategoryLoader,TestCategoryResultSet']
category: [{suites: 'OthersOldDriverTestSuite', name: 'TestCategoryOthers'},
{suites: 'ConnectionOldDriverTestSuite,StatementOldDriverTestSuite', name: 'TestCategoryConnection,TestCategoryStatement'},
{suites: 'LoaderOldDriverTestSuite,ResultSetOldDriverTestSuite', name: 'TestCategoryLoader,TestCategoryResultSet'}]
is_old_driver: ['true']
steps:
- uses: actions/checkout@v1
Expand All @@ -139,6 +150,6 @@ jobs:
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }}
CLOUD_PROVIDER: ${{ matrix.cloud }}
TARGET_DOCKER_TEST_IMAGE: ${{ matrix.image }}
JDBC_TEST_CATEGORY: ${{ matrix.category }}
JDBC_TEST_CATEGORY: ${{ matrix.category.suites }}
is_old_driver: ${{ matrix.is_old_driver }}
run: ./ci/test.sh
14 changes: 14 additions & 0 deletions FIPS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,13 @@
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>3.5.1</version>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add version to the properties - here and in other places in poms

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call

</dependency>
</dependencies>
<version>${version.plugin.failsafe}</version>
<configuration>
<argLine>
Expand Down Expand Up @@ -715,6 +722,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>3.5.1</version>
</dependency>
</dependencies>
<version>${version.plugin.failsafe}</version>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
import java.util.TimeZone;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.Rule;

/** Base test class with common constants, data structures and methods */
public class AbstractDriverIT {
// This is required to use ConditionalIgnore annotation.
@Rule public ConditionalIgnoreRule rule = new ConditionalIgnoreRule();

public static final String DRIVER_CLASS = "net.snowflake.client.jdbc.SnowflakeDriver";
public static final String DRIVER_CLASS_COM = "com.snowflake.client.jdbc.SnowflakeDriver";
Expand Down
125 changes: 0 additions & 125 deletions FIPS/src/test/java/net/snowflake/client/ConditionalIgnoreRule.java

This file was deleted.

15 changes: 15 additions & 0 deletions FIPS/src/test/java/net/snowflake/client/DontRunOnGCP.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved.
*/
package net.snowflake.client;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@DisabledIfEnvironmentVariable(named = "CLOUD_PROVIDER", matches = "(?i)GCP(?-i)")
public @interface DontRunOnGCP {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved.
*/
package net.snowflake.client;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@DisabledIfEnvironmentVariable(named = "GITHUB_ACTIONS", matches = ".*")
public @interface DontRunOnGithubActions {}
12 changes: 0 additions & 12 deletions FIPS/src/test/java/net/snowflake/client/RunningOnGCP.java

This file was deleted.

This file was deleted.

Empty file.
4 changes: 2 additions & 2 deletions FIPS/src/test/java/net/snowflake/client/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.snowflake.client.core.SFException;
import net.snowflake.client.log.SFLogger;
import net.snowflake.client.log.SFLoggerFactory;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;

public class TestUtil {
private static final SFLogger logger = SFLoggerFactory.getLogger(TestUtil.class);
Expand All @@ -22,7 +22,7 @@ public class TestUtil {
public static void assertSFException(int errorCode, TestRunInterface testCode) {
try {
testCode.run();
Assert.fail();
Assertions.fail();
} catch (SFException e) {
assertThat(e.getVendorCode(), is(errorCode));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved.
*/
package net.snowflake.client.category;

import org.junit.platform.suite.api.IncludeTags;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.platform.suite.api.ExcludePackages;
import org.junit.platform.suite.api.IncludeClassNamePatterns;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;
import org.junit.platform.suite.api.SuiteDisplayName;

@Suite
@SelectPackages("net.snowflake.client")
@ExcludePackages("net.snowflake.client.suites")
@IncludeClassNamePatterns(".+")
public class FipsTestSuite {
}

This file was deleted.

Loading
Loading