Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-astachowski committed Oct 31, 2024
2 parents 5f578b2 + e37f814 commit 4899819
Show file tree
Hide file tree
Showing 26 changed files with 145 additions and 53 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ['ResultSetTestSuite,OthersTestSuite,LoaderTestSuite,DiagnosticTestSuite', 'ConnectionTestSuite,StatementTestSuite', 'ArrowTestSuite,CoreTestSuite', 'FipsTestSuite']
category: ['ResultSetTestSuite,StatementTestSuite,LoaderTestSuite', 'OthersTestSuite', 'ArrowTestSuite,ConnectionTestSuite,CoreTestSuite,DiagnosticTestSuite', 'FipsTestSuite']
additionalMavenProfile: ['']
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -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: ['ResultSetTestSuite,OthersTestSuite,LoaderTestSuite,DiagnosticTestSuite', 'ConnectionTestSuite,StatementTestSuite', 'ArrowTestSuite,CoreTestSuite', 'FipsTestSuite']
category: ['ResultSetTestSuite,StatementTestSuite,LoaderTestSuite', 'OthersTestSuite', 'ArrowTestSuite,ConnectionTestSuite,CoreTestSuite,DiagnosticTestSuite', 'FipsTestSuite']
additionalMavenProfile: ['']
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
matrix:
image: [ 'jdbc-centos7-openjdk8', 'jdbc-centos7-openjdk11', 'jdbc-centos7-openjdk17', 'jdbc-centos7-openjdk21' ]
cloud: [ 'AWS', 'AZURE', 'GCP' ]
category: ['ResultSetTestSuite,OthersTestSuite,LoaderTestSuite,DiagnosticTestSuite', 'ConnectionTestSuite,StatementTestSuite', 'ArrowTestSuite,CoreTestSuite', 'FipsTestSuite']
category: ['ResultSetTestSuite,StatementTestSuite,LoaderTestSuite', 'OthersTestSuite', 'ArrowTestSuite,ConnectionTestSuite,CoreTestSuite,DiagnosticTestSuite', 'FipsTestSuite']
additionalMavenProfile: ['', '-Dthin-jar']
steps:
- uses: actions/checkout@v1
Expand All @@ -129,7 +129,7 @@ jobs:
matrix:
image: [ 'jdbc-centos7-openjdk8' ]
cloud: [ 'AWS' ]
category: ['ResultSetTestSuite,OthersTestSuite,LoaderTestSuite,DiagnosticTestSuite', 'ConnectionTestSuite,StatementTestSuite', 'ArrowTestSuite,CoreTestSuite']
category: ['OthersTestSuite', 'ConnectionTestSuite,StatementTestSuite', 'CoreTestSuite,LoaderTestSuite,ResultSetTestSuite']
is_old_driver: ['true']
steps:
- uses: actions/checkout@v1
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions FIPS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc-parent</artifactId>
<version>3.19.2-SNAPSHOT</version>
<version>3.20.1-SNAPSHOT</version>
<relativePath>../parent-pom.xml</relativePath>
</parent>

<artifactId>snowflake-jdbc-fips</artifactId>
<version>3.19.2-SNAPSHOT</version>
<version>3.20.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>snowflake-jdbc-fips</name>
Expand Down
2 changes: 1 addition & 1 deletion FIPS/scripts/check_content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions ci/scripts/check_content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions parent-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc-parent</artifactId>
<version>3.19.2-SNAPSHOT</version>
<version>3.20.1-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand Down Expand Up @@ -35,7 +35,7 @@
<commons.cli.version>1.2</commons.cli.version>
<commons.codec.version>1.17.0</commons.codec.version>
<commons.dbcp.version>1.4</commons.dbcp.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.io.version>2.17.0</commons.io.version>
<commons.logging.version>1.2</commons.logging.version>
<commons.pool.version>1.5.4</commons.pool.version>
<c3p0.version>0.9.5.4</c3p0.version>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc-parent</artifactId>
<version>3.19.2-SNAPSHOT</version>
<version>3.20.1-SNAPSHOT</version>
<relativePath>./parent-pom.xml</relativePath>
</parent>

<!-- Maven complains about using property here, but it makes install and deploy process easier to override final package names and localization -->
<artifactId>${artifactId}</artifactId>
<version>3.19.2-SNAPSHOT</version>
<version>3.20.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>${artifactId}</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1";

static int majorVersion = 0;
static int minorVersion = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ private SFPair<InputStream, Boolean> createUploadStream(
final InputStream stream;
FileInputStream srcFileStream = null;
try {
if (isEncrypting() && getEncryptionKeySize() < 256) {
if (isEncrypting() && getEncryptionKeySize() <= 256) {
try {
final InputStream uploadStream =
uploadFromStream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ private SFPair<InputStream, Boolean> createUploadStream(
final InputStream stream;
FileInputStream srcFileStream = null;
try {
if (isEncrypting() && getEncryptionKeySize() < 256) {
if (isEncrypting() && getEncryptionKeySize() <= 256) {
try {
final InputStream uploadStream =
uploadFromStream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import java.sql.Connection;
import java.sql.SQLException;
import net.snowflake.client.AbstractDriverIT;
import net.snowflake.client.category.TestTags;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Tag(TestTags.CONNECTION)
public class SnowflakeDriverIT extends AbstractDriverIT {

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.snowflake.client.jdbc;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.github.luben.zstd.ZstdInputStream;
import com.github.luben.zstd.ZstdOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
import java.sql.Types;
import java.util.Arrays;
import java.util.List;
import net.snowflake.client.category.TestCategoryResultSet;
import net.snowflake.client.category.TestTags;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Tag(TestTags.RESULT_SET)
public class DatabaseMetaDataResultSetLatestIT extends BaseJDBCTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public void testProcessFileNames() throws Exception {
new File(folder, "TestFileB").createNewFile();

String folderName = folder.getCanonicalPath();
String originalUserDir = System.getProperty("user.dir");
String originalUserHome = System.getProperty("user.home");
System.setProperty("user.dir", folderName);
System.setProperty("user.home", folderName);

Expand All @@ -55,6 +57,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
/** Tests for SnowflakeFileTransferAgent that require an active connection */
// @Category(TestCategoryOthers.class)
@Tag(TestTags.OTHERS)
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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.junit.jupiter.api.BeforeEach;

/** File uploader test prep reused by IT/connection tests and sessionless tests */
abstract class FileUploaderPrepIT extends BaseJDBCTest {
abstract class FileUploaderPrep extends BaseJDBCTest {
private ObjectMapper mapper = new ObjectMapper();

private final String exampleS3JsonStringWithStageEndpoint =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.junit.jupiter.api.Test;

/** Tests for SnowflakeFileTransferAgent.expandFileNames. */
public class FileUploaderSessionlessTest extends FileUploaderPrepIT {
public class FileUploaderSessionlessTest extends FileUploaderPrep {

private ObjectMapper mapper = new ObjectMapper();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*/
package net.snowflake.client.jdbc;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -47,8 +47,8 @@ public void shouldDownloadFileAndStreamFromGitRepository() throws Exception {
List<String> fetchedStreamContent =
getContentFromStream(connection, stageName, filePathInGitRepo);

assertFalse("File content cannot be empty", fetchedFileContent.isEmpty());
assertFalse("Stream content cannot be empty", fetchedStreamContent.isEmpty());
assertFalse(fetchedFileContent.isEmpty(), "File content cannot be empty");
assertFalse(fetchedStreamContent.isEmpty(), "Stream content cannot be empty");
assertEquals(fetchedFileContent, fetchedStreamContent);
}
}
Expand Down Expand Up @@ -79,7 +79,7 @@ private static List<String> getContentFromFile(
try (Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(command); ) {
// then
assertTrue("has result", rs.next());
assertTrue(rs.next(), "has result");
return Files.readAllLines(downloadedFile);
} finally {
Files.delete(downloadedFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
import java.sql.SQLException;
import java.sql.Statement;
import net.snowflake.client.annotations.DontRunOnGithubActions;
import net.snowflake.client.category.TestTags;
import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Tag(TestTags.STATEMENT)
public class MaxLobSizeLatestIT extends BaseJDBCTest {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,40 @@
import java.sql.Statement;
import java.util.List;
import java.util.Properties;
import net.snowflake.client.category.TestTags;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

@Tag(TestTags.CORE)
public class SnowflakeChunkDownloaderLatestIT extends BaseJDBCTest {
private static String originalProxyHost;
private static String originalProxyPort;
private static String originalNonProxyHosts;

@BeforeAll
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);
}
}

@AfterAll
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,29 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.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.annotations.DontRunOnGithubActions;
import net.snowflake.client.category.TestCategoryOthers;
import net.snowflake.client.category.TestTags;
import net.snowflake.client.core.SFSession;
import net.snowflake.client.core.SFStatement;
import net.snowflake.client.jdbc.BaseJDBCTest;
import net.snowflake.client.jdbc.SnowflakeConnectionV1;
import net.snowflake.client.jdbc.SnowflakeFileTransferAgent;
import net.snowflake.client.jdbc.SnowflakeSQLLoggedException;
import net.snowflake.common.core.RemoteStoreFileEncryptionMaterial;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Tag(TestTags.OTHERS)
public class SnowflakeAzureClientLatestIT extends BaseJDBCTest {
@Test
@DontRunOnGithubActions
Expand All @@ -41,11 +48,11 @@ public void testAzureClientSetupInvalidEncryptionKeySize() throws SQLException {

@Test
public void testCloudExceptionTest() {
Iterable<ListBlobItem> mockList = null;
Iterable<ListBlobItem> 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"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@
import java.sql.Statement;
import java.util.Properties;
import net.snowflake.client.annotations.DontRunOnGithubActions;
import net.snowflake.client.category.TestTags;
import net.snowflake.client.core.SFSession;
import net.snowflake.client.core.SFStatement;
import net.snowflake.client.jdbc.BaseJDBCTest;
import net.snowflake.client.jdbc.SnowflakeConnectionV1;
import net.snowflake.client.jdbc.SnowflakeFileTransferAgent;
import net.snowflake.common.core.RemoteStoreFileEncryptionMaterial;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

@Tag(TestTags.OTHERS)
public class SnowflakeS3ClientLatestIT extends BaseJDBCTest {

@Test
Expand Down
Loading

0 comments on commit 4899819

Please sign in to comment.