From bb4593e26e48ad1af9b6fd3a9fbff5161796cc6a Mon Sep 17 00:00:00 2001
From: Dominik Przybysz <132913826+sfc-gh-dprzybysz@users.noreply.github.com>
Date: Tue, 29 Oct 2024 11:23:28 +0100
Subject: [PATCH 1/9] SNOW-1732054: Bump commons io dependency (#1942)
---
parent-pom.xml | 2 +-
thin_public_pom.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/parent-pom.xml b/parent-pom.xml
index 855d171db..c0c2dbb64 100644
--- a/parent-pom.xml
+++ b/parent-pom.xml
@@ -35,7 +35,7 @@
1.2
1.17.0
1.4
- 2.11.0
+ 2.17.0
1.2
1.5.4
0.9.5.4
diff --git a/thin_public_pom.xml b/thin_public_pom.xml
index 61118214c..460ceaec2 100644
--- a/thin_public_pom.xml
+++ b/thin_public_pom.xml
@@ -39,7 +39,7 @@
5.0.0
1.78.1
1.17.0
- 2.11.0
+ 2.17.0
1.2
2.21.0
2.22.6
From 71440e55117e092593516ead921a3afb0f13479d Mon Sep 17 00:00:00 2001
From: Dawid Heyman
Date: Wed, 30 Oct 2024 10:18:52 +0100
Subject: [PATCH 2/9] SNOW-1757822: Exclude directories from shaded packages
check (#1944)
---
FIPS/scripts/check_content.sh | 2 +-
ci/scripts/check_content.sh | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/FIPS/scripts/check_content.sh b/FIPS/scripts/check_content.sh
index 565159073..a30eacec6 100755
--- a/FIPS/scripts/check_content.sh
+++ b/FIPS/scripts/check_content.sh
@@ -6,7 +6,7 @@ set -o pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
-if jar tvf $DIR/../target/snowflake-jdbc-fips.jar | awk '{print $8}' | grep -v -E "^(net|com)/snowflake" | grep -v -E "(com|net)/\$" | grep -v -E "^META-INF" | grep -v -E "^mozilla" | grep -v -E "^com/sun/jna" | grep -v com/sun/ | grep -v mime.types | grep -v -E "^com/github/" | grep -v -E "^aix/" | grep -v -E "^darwin/" | grep -v -E "^freebsd/" | grep -v -E "^linux/" | grep -v -E "^win/"; then
+if jar tvf $DIR/../target/snowflake-jdbc-fips.jar | awk '{print $8}' | grep -v -E "/$" | grep -v -E "^(net|com)/snowflake" | grep -v -E "(com|net)/\$" | grep -v -E "^META-INF" | grep -v -E "^mozilla" | grep -v -E "^com/sun/jna" | grep -v com/sun/ | grep -v mime.types | grep -v -E "^com/github/luben/zstd/" | grep -v -E "^aix/" | grep -v -E "^darwin/" | grep -v -E "^freebsd/" | grep -v -E "^linux/" | grep -v -E "^win/"; then
echo "[ERROR] JDBC jar includes class not under the snowflake namespace"
exit 1
fi
diff --git a/ci/scripts/check_content.sh b/ci/scripts/check_content.sh
index 3a0747be2..1af33e56a 100755
--- a/ci/scripts/check_content.sh
+++ b/ci/scripts/check_content.sh
@@ -8,12 +8,12 @@ set -o pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
-if jar tvf $DIR/../../target/snowflake-jdbc${package_modifier}.jar | awk '{print $8}' | grep -v -E "^(net|com)/snowflake" | grep -v -E "(com|net)/\$" | grep -v -E "^META-INF" | grep -v -E "^mozilla" | grep -v -E "^com/sun/jna" | grep -v com/sun/ | grep -v mime.types | grep -v -E "^com/github/" | grep -v -E "^aix/" | grep -v -E "^darwin/" | grep -v -E "^freebsd/" | grep -v -E "^linux/" | grep -v -E "^win/"; then
+if jar tvf $DIR/../../target/snowflake-jdbc${package_modifier}.jar | awk '{print $8}' | grep -v -E "/$" | grep -v -E "^(net|com)/snowflake" | grep -v -E "(com|net)/\$" | grep -v -E "^META-INF" | grep -v -E "^mozilla" | grep -v -E "^com/sun/jna" | grep -v com/sun/ | grep -v mime.types | grep -v -E "^com/github/luben/zstd/" | grep -v -E "^aix/" | grep -v -E "^darwin/" | grep -v -E "^freebsd/" | grep -v -E "^linux/" | grep -v -E "^win/"; then
echo "[ERROR] JDBC jar includes class not under the snowflake namespace"
exit 1
fi
-if jar tvf $DIR/../../target/snowflake-jdbc${package_modifier}.jar | awk '{print $8}' | grep -E "^META-INF/versions/.*.class" | grep -v -E "^META-INF/versions/.*/(net|com)/snowflake" | grep -v -E "^META-INF/versions/.*/com/github" | grep -v -E "^aix/" | grep -v -E "^darwin/" | grep -v -E "^freebsd/" | grep -v -E "^linux/" | grep -v -E "^win/"; then
+if jar tvf $DIR/../../target/snowflake-jdbc${package_modifier}.jar | awk '{print $8}' | grep -E "^META-INF/versions/.*.class" | grep -v -E "^META-INF/versions/.*/(net|com)/snowflake"; then
echo "[ERROR] JDBC jar includes multi-release classes not under the snowflake namespace"
exit 1
fi
From c703b8de38e6fff8ca52c44ca885ddac760548ce Mon Sep 17 00:00:00 2001
From: Dominik Przybysz <132913826+sfc-gh-dprzybysz@users.noreply.github.com>
Date: Wed, 30 Oct 2024 10:20:10 +0100
Subject: [PATCH 3/9] SNOW-1756807: Add note about GCP regional endpoints
(#1943)
---
README.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/README.rst b/README.rst
index c2e296e95..a9d3cacb2 100644
--- a/README.rst
+++ b/README.rst
@@ -214,3 +214,8 @@ Support
Feel free to file an issue or submit a PR here for general cases. For official support, contact Snowflake support at:
https://community.snowflake.com/s/article/How-To-Submit-a-Support-Case-in-Snowflake-Lodge
+
+Note
+----------
+
+This driver currently does not support GCP regional endpoints. Please ensure that any workloads using through this driver do not require support for regional endpoints on GCP. If you have questions about this, please contact Snowflake Support.
From 45afd71ac16ea55aeba91b8bacb4859344ae1b34 Mon Sep 17 00:00:00 2001
From: Piotr Bulawa
Date: Wed, 30 Oct 2024 14:51:57 +0100
Subject: [PATCH 4/9] SNOW-1553930: Fix incorrect key size condition check for
GCP and Azure (#1946)
---
.../client/jdbc/cloud/storage/SnowflakeAzureClient.java | 2 +-
.../snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java
index 4bec46ca7..0f8014ef6 100644
--- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java
+++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java
@@ -695,7 +695,7 @@ private SFPair createUploadStream(
final InputStream stream;
FileInputStream srcFileStream = null;
try {
- if (isEncrypting() && getEncryptionKeySize() < 256) {
+ if (isEncrypting() && getEncryptionKeySize() <= 256) {
try {
final InputStream uploadStream =
uploadFromStream
diff --git a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java
index 003d894ae..31341c5a3 100644
--- a/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java
+++ b/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeGCSClient.java
@@ -1036,7 +1036,7 @@ private SFPair createUploadStream(
final InputStream stream;
FileInputStream srcFileStream = null;
try {
- if (isEncrypting() && getEncryptionKeySize() < 256) {
+ if (isEncrypting() && getEncryptionKeySize() <= 256) {
try {
final InputStream uploadStream =
uploadFromStream
From 21e98c74145461212ff3a47f3540bc1fd3026a5e Mon Sep 17 00:00:00 2001
From: Piotr Bulawa
Date: Wed, 30 Oct 2024 19:49:11 +0100
Subject: [PATCH 5/9] Bump version to 3.20.0 for release (#1947)
---
CHANGELOG.rst | 4 ++++
FIPS/pom.xml | 4 ++--
parent-pom.xml | 2 +-
pom.xml | 4 ++--
src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java | 2 +-
5 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 72c788c36..76e948b1d 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,3 +1,7 @@
+**JDBC Driver 3.20.0**
+
+- \||Please Refer to Release Notes at https://docs.snowflake.com/en/release-notes/clients-drivers/jdbc
+
**JDBC Driver 3.19.1**
- \||Please Refer to Release Notes at https://docs.snowflake.com/en/release-notes/clients-drivers/jdbc
diff --git a/FIPS/pom.xml b/FIPS/pom.xml
index cbc6132af..5a9048f2a 100644
--- a/FIPS/pom.xml
+++ b/FIPS/pom.xml
@@ -5,12 +5,12 @@
net.snowflake
snowflake-jdbc-parent
- 3.19.2-SNAPSHOT
+ 3.20.0
../parent-pom.xml
snowflake-jdbc-fips
- 3.19.2-SNAPSHOT
+ 3.20.0
jar
snowflake-jdbc-fips
diff --git a/parent-pom.xml b/parent-pom.xml
index c0c2dbb64..2617630fd 100644
--- a/parent-pom.xml
+++ b/parent-pom.xml
@@ -5,7 +5,7 @@
net.snowflake
snowflake-jdbc-parent
- 3.19.2-SNAPSHOT
+ 3.20.0
pom
diff --git a/pom.xml b/pom.xml
index c7542a1fe..8a90512ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,13 +6,13 @@
net.snowflake
snowflake-jdbc-parent
- 3.19.2-SNAPSHOT
+ 3.20.0
./parent-pom.xml
${artifactId}
- 3.19.2-SNAPSHOT
+ 3.20.0
jar
${artifactId}
diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java
index bd03ddd55..4e9b01b30 100644
--- a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java
+++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java
@@ -37,7 +37,7 @@ public class SnowflakeDriver implements Driver {
static SnowflakeDriver INSTANCE;
public static final Properties EMPTY_PROPERTIES = new Properties();
- public static String implementVersion = "3.19.2";
+ public static String implementVersion = "3.20.0";
static int majorVersion = 0;
static int minorVersion = 0;
From 2b685e144b20de10bed4802c8b9bf543655d9111 Mon Sep 17 00:00:00 2001
From: Piotr Bulawa
Date: Thu, 31 Oct 2024 08:31:38 +0100
Subject: [PATCH 6/9] Prepare next development version (#1948)
---
FIPS/pom.xml | 4 ++--
parent-pom.xml | 2 +-
pom.xml | 4 ++--
src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/FIPS/pom.xml b/FIPS/pom.xml
index 5a9048f2a..ba1929bd2 100644
--- a/FIPS/pom.xml
+++ b/FIPS/pom.xml
@@ -5,12 +5,12 @@
net.snowflake
snowflake-jdbc-parent
- 3.20.0
+ 3.20.1-SNAPSHOT
../parent-pom.xml
snowflake-jdbc-fips
- 3.20.0
+ 3.20.1-SNAPSHOT
jar
snowflake-jdbc-fips
diff --git a/parent-pom.xml b/parent-pom.xml
index 2617630fd..7f165f376 100644
--- a/parent-pom.xml
+++ b/parent-pom.xml
@@ -5,7 +5,7 @@
net.snowflake
snowflake-jdbc-parent
- 3.20.0
+ 3.20.1-SNAPSHOT
pom
diff --git a/pom.xml b/pom.xml
index 8a90512ab..69ff5b183 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,13 +6,13 @@
net.snowflake
snowflake-jdbc-parent
- 3.20.0
+ 3.20.1-SNAPSHOT
./parent-pom.xml
${artifactId}
- 3.20.0
+ 3.20.1-SNAPSHOT
jar
${artifactId}
diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java
index 4e9b01b30..b385e04c2 100644
--- a/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java
+++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java
@@ -37,7 +37,7 @@ public class SnowflakeDriver implements Driver {
static SnowflakeDriver INSTANCE;
public static final Properties EMPTY_PROPERTIES = new Properties();
- public static String implementVersion = "3.20.0";
+ public static String implementVersion = "3.20.1";
static int majorVersion = 0;
static int minorVersion = 0;
From 58325fd04b6baedd71a4ac72cde575259ad59abf Mon Sep 17 00:00:00 2001
From: Jelena Furundzic
<141762304+sfc-gh-ext-simba-jf@users.noreply.github.com>
Date: Thu, 31 Oct 2024 01:55:08 -0700
Subject: [PATCH 7/9] SNOW-1213115: Move test categories for even distribution
(#1735)
---
.github/workflows/build-test.yml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index 190425de4..2607c5d46 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -44,7 +44,7 @@ jobs:
fail-fast: false
matrix:
runConfig: [ {cloud: 'AWS', javaVersion: '8'}, {cloud: 'GCP', javaVersion: '11'}, {cloud: 'AZURE', javaVersion: '17'}, {cloud: 'AWS', javaVersion: '21'}]
- category: ['TestCategoryResultSet,TestCategoryOthers,TestCategoryLoader,TestCategoryDiagnostic', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryArrow,TestCategoryCore', 'TestCategoryFips']
+ category: ['TestCategoryResultSet,TestCategoryStatement,TestCategoryLoader', 'TestCategoryOthers', 'TestCategoryArrow,TestCategoryConnection,TestCategoryCore,TestCategoryDiagnostic', 'TestCategoryFips']
additionalMavenProfile: ['']
steps:
- uses: actions/checkout@v4
@@ -74,7 +74,7 @@ jobs:
fail-fast: false
matrix:
runConfig: [ {cloud: 'AWS', javaVersion: '8'}, {cloud: 'GCP', javaVersion: '11'}, {cloud: 'AZURE', javaVersion: '17'}, {cloud: 'AWS', javaVersion: '21'}]
- category: ['TestCategoryResultSet,TestCategoryOthers,TestCategoryLoader,TestCategoryDiagnostic', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryArrow,TestCategoryCore', 'TestCategoryFips']
+ category: ['TestCategoryResultSet,TestCategoryStatement,TestCategoryLoader', 'TestCategoryOthers', 'TestCategoryArrow,TestCategoryConnection,TestCategoryCore,TestCategoryDiagnostic', 'TestCategoryFips']
additionalMavenProfile: ['']
steps:
- uses: actions/checkout@v4
@@ -107,7 +107,7 @@ jobs:
matrix:
image: [ 'jdbc-centos7-openjdk8', 'jdbc-centos7-openjdk11', 'jdbc-centos7-openjdk17', 'jdbc-centos7-openjdk21' ]
cloud: [ 'AWS', 'AZURE', 'GCP' ]
- category: ['TestCategoryResultSet,TestCategoryOthers,TestCategoryLoader,TestCategoryDiagnostic', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryArrow,TestCategoryCore', 'TestCategoryFips']
+ category: ['TestCategoryResultSet,TestCategoryStatement,TestCategoryLoader', 'TestCategoryOthers', 'TestCategoryArrow,TestCategoryConnection,TestCategoryCore,TestCategoryDiagnostic', 'TestCategoryFips']
additionalMavenProfile: ['', '-Dthin-jar']
steps:
- uses: actions/checkout@v1
@@ -129,7 +129,7 @@ jobs:
matrix:
image: [ 'jdbc-centos7-openjdk8' ]
cloud: [ 'AWS' ]
- category: ['TestCategoryResultSet,TestCategoryOthers', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryCore,TestCategoryLoader']
+ category: ['TestCategoryOthers', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryCore,TestCategoryLoader,TestCategoryResultSet']
is_old_driver: ['true']
steps:
- uses: actions/checkout@v1
From f1b5790f725a9ff4f799d74272fe9e1396e94647 Mon Sep 17 00:00:00 2001
From: Dominik Przybysz <132913826+sfc-gh-dprzybysz@users.noreply.github.com>
Date: Thu, 31 Oct 2024 12:27:09 +0100
Subject: [PATCH 8/9] SNOW-1778027: Fix stopwatch flaky test (#1949)
---
src/test/java/net/snowflake/client/util/StopwatchTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/net/snowflake/client/util/StopwatchTest.java b/src/test/java/net/snowflake/client/util/StopwatchTest.java
index 9e44ce18a..ed5f5d743 100644
--- a/src/test/java/net/snowflake/client/util/StopwatchTest.java
+++ b/src/test/java/net/snowflake/client/util/StopwatchTest.java
@@ -36,7 +36,7 @@ public void testGetMillisWhenStopped() throws InterruptedException {
@Test
public void testGetMillisWithoutStopping() throws InterruptedException {
stopwatch.start();
- TimeUnit.MILLISECONDS.sleep(20);
+ TimeUnit.MILLISECONDS.sleep(100);
assertThat(
stopwatch.elapsedMillis(), allOf(greaterThanOrEqualTo(10L), lessThanOrEqualTo(500L)));
}
From e37f8149db57e67b61b6e0d2f94e0152d20d295f Mon Sep 17 00:00:00 2001
From: Antoni Stachowski
Date: Thu, 31 Oct 2024 16:47:51 +0100
Subject: [PATCH 9/9] Added missing test categories to integration tests
(#1937)
---
.../client/jdbc/SnowflakeDriverIT.java | 3 +
.../DatabaseMetaDataResultSetLatestIT.java | 3 +
.../jdbc/FileUploaderExpandFileNamesTest.java | 13 ++++
.../client/jdbc/FileUploaderLatestIT.java | 2 +-
...oaderPrepIT.java => FileUploaderPrep.java} | 2 +-
.../jdbc/FileUploaderSessionlessTest.java | 2 +-
.../client/jdbc/MaxLobSizeLatestIT.java | 3 +
.../SnowflakeChunkDownloaderLatestIT.java | 29 +++++++++
.../storage/SnowflakeAzureClientLatestIT.java | 10 ++-
.../storage/SnowflakeS3ClientLatestIT.java | 3 +
.../log/JDK14LoggerWithClientLatestIT.java | 61 ++++++++++++-------
11 files changed, 105 insertions(+), 26 deletions(-)
rename src/test/java/net/snowflake/client/jdbc/{FileUploaderPrepIT.java => FileUploaderPrep.java} (99%)
diff --git a/src/test/java/com/snowflake/client/jdbc/SnowflakeDriverIT.java b/src/test/java/com/snowflake/client/jdbc/SnowflakeDriverIT.java
index 8cf16c6bd..d2a7246f8 100644
--- a/src/test/java/com/snowflake/client/jdbc/SnowflakeDriverIT.java
+++ b/src/test/java/com/snowflake/client/jdbc/SnowflakeDriverIT.java
@@ -5,8 +5,11 @@
import java.sql.Connection;
import java.sql.SQLException;
import net.snowflake.client.AbstractDriverIT;
+import net.snowflake.client.category.TestCategoryConnection;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+@Category(TestCategoryConnection.class)
public class SnowflakeDriverIT extends AbstractDriverIT {
@Test
diff --git a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java
index 0549a087d..f69260a69 100644
--- a/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/DatabaseMetaDataResultSetLatestIT.java
@@ -15,8 +15,11 @@
import java.sql.Types;
import java.util.Arrays;
import java.util.List;
+import net.snowflake.client.category.TestCategoryResultSet;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+@Category(TestCategoryResultSet.class)
public class DatabaseMetaDataResultSetLatestIT extends BaseJDBCTest {
@Test(expected = SnowflakeLoggedFeatureNotSupportedException.class)
diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java
index a4426d449..c874b3e33 100644
--- a/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java
+++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderExpandFileNamesTest.java
@@ -40,6 +40,8 @@ public void testProcessFileNames() throws Exception {
folder.newFile("TestFileB");
String folderName = folder.getRoot().getCanonicalPath();
+ String originalUserDir = System.getProperty("user.dir");
+ String originalUserHome = System.getProperty("user.home");
System.setProperty("user.dir", folderName);
System.setProperty("user.home", folderName);
@@ -58,6 +60,17 @@ public void testProcessFileNames() throws Exception {
assertTrue(files.contains(folderName + File.separator + "TestFileC"));
assertTrue(files.contains(folderName + File.separator + "TestFileD"));
assertTrue(files.contains(folderName + File.separator + "TestFileE~"));
+
+ if (originalUserHome != null) {
+ System.setProperty("user.home", originalUserHome);
+ } else {
+ System.clearProperty("user.home");
+ }
+ if (originalUserDir != null) {
+ System.setProperty("user.dir", originalUserDir);
+ } else {
+ System.clearProperty("user.dir");
+ }
}
@Test
diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java
index 378234715..995832362 100644
--- a/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderLatestIT.java
@@ -53,7 +53,7 @@
/** Tests for SnowflakeFileTransferAgent that require an active connection */
@Category(TestCategoryOthers.class)
-public class FileUploaderLatestIT extends FileUploaderPrepIT {
+public class FileUploaderLatestIT extends FileUploaderPrep {
private static final String OBJ_META_STAGE = "testObjMeta";
private ObjectMapper mapper = new ObjectMapper();
private static final String PUT_COMMAND = "put file:///dummy/path/file2.gz @testStage";
diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderPrepIT.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderPrep.java
similarity index 99%
rename from src/test/java/net/snowflake/client/jdbc/FileUploaderPrepIT.java
rename to src/test/java/net/snowflake/client/jdbc/FileUploaderPrep.java
index 73ebec2bf..d8aa8143f 100644
--- a/src/test/java/net/snowflake/client/jdbc/FileUploaderPrepIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderPrep.java
@@ -13,7 +13,7 @@
import org.junit.rules.TemporaryFolder;
/** File uploader test prep reused by IT/connection tests and sessionless tests */
-abstract class FileUploaderPrepIT extends BaseJDBCTest {
+abstract class FileUploaderPrep extends BaseJDBCTest {
@Rule public TemporaryFolder folder = new TemporaryFolder();
private ObjectMapper mapper = new ObjectMapper();
diff --git a/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java b/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java
index 822ce8e92..e23800e4e 100644
--- a/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java
+++ b/src/test/java/net/snowflake/client/jdbc/FileUploaderSessionlessTest.java
@@ -17,7 +17,7 @@
import org.junit.Test;
/** Tests for SnowflakeFileTransferAgent.expandFileNames. */
-public class FileUploaderSessionlessTest extends FileUploaderPrepIT {
+public class FileUploaderSessionlessTest extends FileUploaderPrep {
private ObjectMapper mapper = new ObjectMapper();
diff --git a/src/test/java/net/snowflake/client/jdbc/MaxLobSizeLatestIT.java b/src/test/java/net/snowflake/client/jdbc/MaxLobSizeLatestIT.java
index 8962b8141..fd2957528 100644
--- a/src/test/java/net/snowflake/client/jdbc/MaxLobSizeLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/MaxLobSizeLatestIT.java
@@ -11,10 +11,13 @@
import java.sql.Statement;
import net.snowflake.client.ConditionalIgnoreRule;
import net.snowflake.client.RunningOnGithubAction;
+import net.snowflake.client.category.TestCategoryStatement;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+@Category(TestCategoryStatement.class)
public class MaxLobSizeLatestIT extends BaseJDBCTest {
/**
diff --git a/src/test/java/net/snowflake/client/jdbc/SnowflakeChunkDownloaderLatestIT.java b/src/test/java/net/snowflake/client/jdbc/SnowflakeChunkDownloaderLatestIT.java
index b597c4dd0..7dca1028e 100644
--- a/src/test/java/net/snowflake/client/jdbc/SnowflakeChunkDownloaderLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/SnowflakeChunkDownloaderLatestIT.java
@@ -11,11 +11,40 @@
import java.sql.Statement;
import java.util.List;
import java.util.Properties;
+import net.snowflake.client.category.TestCategoryCore;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
import org.mockito.Mockito;
+@Category(TestCategoryCore.class)
public class SnowflakeChunkDownloaderLatestIT extends BaseJDBCTest {
+ private static String originalProxyHost;
+ private static String originalProxyPort;
+ private static String originalNonProxyHosts;
+ @BeforeClass
+ public static void setUp() throws Exception {
+ originalProxyHost = System.getProperty("https.proxyHost");
+ originalProxyPort = System.getProperty("https.proxyPort");
+ originalNonProxyHosts = System.getProperty("https.nonProxyHosts");
+ }
+
+ private static void restoreProperty(String key, String value) {
+ if (value != null) {
+ System.setProperty(key, value);
+ } else {
+ System.clearProperty(key);
+ }
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ restoreProperty("https.proxyHost", originalProxyHost);
+ restoreProperty("https.proxyPort", originalProxyPort);
+ restoreProperty("https.nonProxyHosts", originalNonProxyHosts);
+ }
/**
* Tests that the chunk downloader uses the maxHttpRetries and doesn't enter and infinite loop of
* retries.
diff --git a/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java b/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java
index 93539005a..05050b669 100644
--- a/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClientLatestIT.java
@@ -2,14 +2,18 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.spy;
+import com.amazonaws.services.kms.model.UnsupportedOperationException;
import com.microsoft.azure.storage.blob.ListBlobItem;
import java.sql.Connection;
import java.sql.SQLException;
+import java.util.ArrayList;
import net.snowflake.client.ConditionalIgnoreRule;
import net.snowflake.client.RunningOnGithubAction;
+import net.snowflake.client.category.TestCategoryOthers;
import net.snowflake.client.core.SFSession;
import net.snowflake.client.core.SFStatement;
import net.snowflake.client.jdbc.BaseJDBCTest;
@@ -18,7 +22,9 @@
import net.snowflake.client.jdbc.SnowflakeSQLLoggedException;
import net.snowflake.common.core.RemoteStoreFileEncryptionMaterial;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+@Category(TestCategoryOthers.class)
public class SnowflakeAzureClientLatestIT extends BaseJDBCTest {
@Test
@ConditionalIgnoreRule.ConditionalIgnore(condition = RunningOnGithubAction.class)
@@ -42,11 +48,11 @@ public void testAzureClientSetupInvalidEncryptionKeySize() throws SQLException {
@Test
public void testCloudExceptionTest() {
- Iterable mockList = null;
+ Iterable mockList = new ArrayList<>();
AzureObjectSummariesIterator iterator = new AzureObjectSummariesIterator(mockList);
AzureObjectSummariesIterator spyIterator = spy(iterator);
UnsupportedOperationException ex =
assertThrows(UnsupportedOperationException.class, () -> spyIterator.remove());
- assertEquals(ex.getMessage(), "remove() method not supported");
+ assertTrue(ex.getMessage().startsWith("remove() method not supported"));
}
}
diff --git a/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3ClientLatestIT.java b/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3ClientLatestIT.java
index de241162f..d9e1821c2 100644
--- a/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3ClientLatestIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3ClientLatestIT.java
@@ -15,6 +15,7 @@
import java.util.Properties;
import net.snowflake.client.ConditionalIgnoreRule;
import net.snowflake.client.RunningOnGithubAction;
+import net.snowflake.client.category.TestCategoryOthers;
import net.snowflake.client.core.SFSession;
import net.snowflake.client.core.SFStatement;
import net.snowflake.client.jdbc.BaseJDBCTest;
@@ -24,8 +25,10 @@
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
import org.mockito.Mockito;
+@Category(TestCategoryOthers.class)
public class SnowflakeS3ClientLatestIT extends BaseJDBCTest {
@Test
diff --git a/src/test/java/net/snowflake/client/log/JDK14LoggerWithClientLatestIT.java b/src/test/java/net/snowflake/client/log/JDK14LoggerWithClientLatestIT.java
index 232da8451..5c11cdf22 100644
--- a/src/test/java/net/snowflake/client/log/JDK14LoggerWithClientLatestIT.java
+++ b/src/test/java/net/snowflake/client/log/JDK14LoggerWithClientLatestIT.java
@@ -18,18 +18,33 @@
import java.util.Properties;
import java.util.logging.Level;
import net.snowflake.client.AbstractDriverIT;
+import net.snowflake.client.ConditionalIgnoreRule;
+import net.snowflake.client.RunningOnWin;
+import net.snowflake.client.category.TestCategoryOthers;
import net.snowflake.client.jdbc.SnowflakeSQLLoggedException;
import org.apache.commons.io.FileUtils;
+import org.junit.Ignore;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+@Category(TestCategoryOthers.class)
public class JDK14LoggerWithClientLatestIT extends AbstractDriverIT {
+ @Rule public TemporaryFolder tmpFolder = new TemporaryFolder();
+
String homePath = systemGetProperty("user.home");
@Test
- public void testJDK14LoggingWithClientConfig() {
- Path configFilePath = Paths.get("config.json");
- String configJson = "{\"common\":{\"log_level\":\"debug\",\"log_path\":\"logs\"}}";
+ @Ignore
+ public void testJDK14LoggingWithClientConfig() throws IOException {
+ File configFile = tmpFolder.newFile("config.json");
+ Path configFilePath = configFile.toPath();
+ File logFolder = tmpFolder.newFolder("logs");
+ Path logFolderPath = logFolder.toPath();
+ String configJson =
+ "{\"common\":{\"log_level\":\"debug\",\"log_path\":\"" + logFolderPath + "\"}}";
try {
Files.write(configFilePath, configJson.getBytes());
Properties properties = new Properties();
@@ -38,11 +53,8 @@ public void testJDK14LoggingWithClientConfig() {
Statement statement = connection.createStatement()) {
statement.executeQuery("select 1");
- File file = new File("logs/jdbc/");
+ File file = new File(Paths.get(logFolderPath.toString(), "jdbc").toString());
assertTrue(file.exists());
-
- Files.deleteIfExists(configFilePath);
- FileUtils.deleteDirectory(new File("logs"));
}
} catch (IOException e) {
fail("testJDK14LoggingWithClientConfig failed");
@@ -62,11 +74,15 @@ public void testJDK14LoggingWithClientConfigInvalidConfigFilePath() throws SQLEx
}
@Test
- public void testJDK14LoggingWithClientConfigPermissionError() throws IOException, SQLException {
- Path configFilePath = Paths.get("config.json");
- String configJson = "{\"common\":{\"log_level\":\"debug\",\"log_path\":\"logs\"}}";
- Path directoryPath = Files.createDirectory(Paths.get("logs"));
- File directory = directoryPath.toFile();
+ @Ignore
+ @ConditionalIgnoreRule.ConditionalIgnore(condition = RunningOnWin.class)
+ public void testJDK14LoggingWithClientConfigPermissionError() throws IOException {
+ File configFile = tmpFolder.newFile("config.json");
+ Path configFilePath = configFile.toPath();
+ File directory = tmpFolder.newFolder("logs");
+ Path directoryPath = directory.toPath();
+ String configJson =
+ "{\"common\":{\"log_level\":\"debug\",\"log_path\":\"" + directoryPath + "\"}}";
HashSet perms = new HashSet<>();
perms.add(PosixFilePermission.OWNER_READ);
perms.add(PosixFilePermission.GROUP_READ);
@@ -77,9 +93,6 @@ public void testJDK14LoggingWithClientConfigPermissionError() throws IOException
Properties properties = new Properties();
properties.put("client_config_file", configFilePath.toString());
assertThrows(SQLException.class, () -> getConnection(properties));
-
- Files.delete(configFilePath);
- directory.delete();
}
@Test
@@ -99,11 +112,15 @@ public void testJDK14LoggerWithQuotesInMessage() {
}
@Test
+ @Ignore
public void testJDK14LoggingWithMissingLogPathClientConfig() throws Exception {
- Path configFilePath = Paths.get("config.json");
+ File configFile = tmpFolder.newFile("config.json");
+ Path configFilePath = configFile.toPath();
String configJson = "{\"common\":{\"log_level\":\"debug\"}}";
+ Path home = tmpFolder.getRoot().toPath();
+ System.setProperty("user.home", home.toString());
- Path homeLogPath = Paths.get(homePath, "jdbc");
+ Path homeLogPath = Paths.get(home.toString(), "jdbc");
Files.write(configFilePath, configJson.getBytes());
Properties properties = new Properties();
properties.put("client_config_file", configFilePath.toString());
@@ -119,21 +136,23 @@ public void testJDK14LoggingWithMissingLogPathClientConfig() throws Exception {
Files.deleteIfExists(configFilePath);
FileUtils.deleteDirectory(new File(homeLogPath.toString()));
}
+ } finally {
+ System.setProperty("user.home", homePath);
}
}
@Test
+ @Ignore
public void testJDK14LoggingWithMissingLogPathNoHomeDirClientConfig() throws Exception {
System.clearProperty("user.home");
- Path configFilePath = Paths.get("config.json");
+ File configFile = tmpFolder.newFile("config.json");
+ Path configFilePath = configFile.toPath();
String configJson = "{\"common\":{\"log_level\":\"debug\"}}";
Files.write(configFilePath, configJson.getBytes());
Properties properties = new Properties();
properties.put("client_config_file", configFilePath.toString());
- try (Connection connection = getConnection(properties);
- Statement statement = connection.createStatement()) {
-
+ try (Connection connection = getConnection(properties)) {
fail("testJDK14LoggingWithMissingLogPathNoHomeDirClientConfig failed");
} catch (SnowflakeSQLLoggedException e) {
// Succeed