58
58
import org .junit .jupiter .api .Tag ;
59
59
import org .junit .jupiter .api .Test ;
60
60
import org .junit .jupiter .api .io .TempDir ;
61
+ import org .junit .jupiter .params .ParameterizedTest ;
62
+ import org .junit .jupiter .params .provider .ValueSource ;
61
63
62
64
/** General integration tests */
63
65
@ Tag (TestTags .OTHERS )
@@ -730,9 +732,14 @@ public void testDBMetadata() throws Throwable {
730
732
}
731
733
}
732
734
733
- @ Test
735
+ @ ParameterizedTest
736
+ @ ValueSource (booleans = {true , false })
734
737
@ DontRunOnGithubActions
735
- public void testPutWithWildcardGCP () throws Throwable {
738
+ public void testPutWithWildcardGCP (boolean useAwsSDKStrategy ) throws Throwable {
739
+ if (useAwsSDKStrategy ) {
740
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "true" );
741
+ }
742
+
736
743
Properties _connectionProperties = new Properties ();
737
744
_connectionProperties .put ("inject_wait_in_put" , 5 );
738
745
_connectionProperties .put ("ssl" , "off" );
@@ -784,6 +791,8 @@ public void testPutWithWildcardGCP() throws Throwable {
784
791
} finally {
785
792
statement .execute ("DROP STAGE IF EXISTS wildcard_stage" );
786
793
}
794
+ } finally {
795
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "false" );
787
796
}
788
797
}
789
798
@@ -805,9 +814,13 @@ private void copyContentFrom(File file1, File file2) throws Exception {
805
814
}
806
815
}
807
816
808
- @ Test
817
+ @ ParameterizedTest
818
+ @ ValueSource (booleans = {true , false })
809
819
@ DontRunOnGithubActions
810
- public void testPutGetLargeFileGCP () throws Throwable {
820
+ public void testPutGetLargeFileGCP (boolean useAwsSDKStrategy ) throws Throwable {
821
+ if (useAwsSDKStrategy ) {
822
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "true" );
823
+ }
811
824
try (Connection connection = getConnection ("gcpaccount" );
812
825
Statement statement = connection .createStatement ()) {
813
826
try {
@@ -882,6 +895,8 @@ public void testPutGetLargeFileGCP() throws Throwable {
882
895
statement .execute ("DROP STAGE IF EXISTS extra_stage" );
883
896
statement .execute ("DROP TABLE IF EXISTS large_table" );
884
897
}
898
+ } finally {
899
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "false" );
885
900
}
886
901
}
887
902
@@ -909,9 +924,15 @@ public void testPutOverwrite() throws Throwable {
909
924
String destFolderCanonicalPath = destFolder .getCanonicalPath ();
910
925
String destFolderCanonicalPathWithSeparator = destFolderCanonicalPath + File .separator ;
911
926
912
- List <String > accounts = Arrays .asList (null , "s3testaccount" , "azureaccount" , "gcpaccount" );
927
+ List <String > accounts =
928
+ Arrays .asList (null , "s3testaccount" , "azureaccount" , "gcpaccount" , "gcpaccount_awssdk" );
913
929
for (int i = 0 ; i < accounts .size (); i ++) {
914
- try (Connection connection = getConnection (accounts .get (i ));
930
+ String accountName = accounts .get (i );
931
+ if (accounts .get (i ) != null && accounts .get (i ).equals ("gcpaccount_awssdk" )) {
932
+ accountName = "gcpaccount" ;
933
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "true" );
934
+ }
935
+ try (Connection connection = getConnection (accountName );
915
936
Statement statement = connection .createStatement ()) {
916
937
try {
917
938
statement .execute ("alter session set ENABLE_GCP_PUT_EXCEPTION_FOR_OLD_DRIVERS=false" );
@@ -954,6 +975,8 @@ public void testPutOverwrite() throws Throwable {
954
975
} finally {
955
976
statement .execute ("DROP TABLE IF EXISTS testLoadToLocalFS" );
956
977
}
978
+ } finally {
979
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "false" );
957
980
}
958
981
}
959
982
}
@@ -962,9 +985,18 @@ public void testPutOverwrite() throws Throwable {
962
985
@ DontRunOnGithubActions
963
986
public void testPut () throws Throwable {
964
987
965
- List <String > accounts = Arrays .asList (null , "s3testaccount" , "azureaccount" , "gcpaccount" );
988
+ List <String > accounts =
989
+ Arrays .asList (null , "s3testaccount" , "azureaccount" , "gcpaccount" , "gcpaccount_awssdk" );
966
990
for (int i = 0 ; i < accounts .size (); i ++) {
967
- try (Connection connection = getConnection (accounts .get (i ));
991
+ String accountName = accounts .get (i );
992
+ if (accounts .get (i ) != null && accounts .get (i ).equals ("gcpaccount_awssdk" )) {
993
+ accountName = "gcpaccount" ;
994
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "true" );
995
+ }
996
+ if (accounts .get (i ) == null || !accounts .get (i ).startsWith (("gcp" ))) {
997
+ continue ;
998
+ }
999
+ try (Connection connection = getConnection (accountName );
968
1000
Statement statement = connection .createStatement ()) {
969
1001
try {
970
1002
// load file test
@@ -1023,6 +1055,8 @@ public void testPut() throws Throwable {
1023
1055
} finally {
1024
1056
statement .execute ("DROP TABLE IF EXISTS testLoadToLocalFS" );
1025
1057
}
1058
+ } finally {
1059
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "false" );
1026
1060
}
1027
1061
}
1028
1062
}
@@ -2613,9 +2647,15 @@ public void testSnow31104() throws Throwable {
2613
2647
@ DontRunOnGithubActions
2614
2648
public void testPutGet () throws Throwable {
2615
2649
2616
- List <String > accounts = Arrays .asList (null , "s3testaccount" , "azureaccount" , "gcpaccount" );
2650
+ List <String > accounts =
2651
+ Arrays .asList (null , "s3testaccount" , "azureaccount" , "gcpaccount" , "gcpaccount_awssdk" );
2617
2652
for (int i = 0 ; i < accounts .size (); i ++) {
2618
- try (Connection connection = getConnection (accounts .get (i ));
2653
+ String accountName = accounts .get (i );
2654
+ if (accounts .get (i ) != null && accounts .get (i ).equals ("gcpaccount_awssdk" )) {
2655
+ accountName = "gcpaccount" ;
2656
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "true" );
2657
+ }
2658
+ try (Connection connection = getConnection (accountName );
2619
2659
Statement statement = connection .createStatement ()) {
2620
2660
try {
2621
2661
String sourceFilePath = getFullPathFileInResource (TEST_DATA_FILE );
@@ -2655,6 +2695,8 @@ public void testPutGet() throws Throwable {
2655
2695
} finally {
2656
2696
statement .execute ("DROP STAGE IF EXISTS testGetPut_stage" );
2657
2697
}
2698
+ } finally {
2699
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "false" );
2658
2700
}
2659
2701
}
2660
2702
}
@@ -2669,9 +2711,15 @@ public void testPutGet() throws Throwable {
2669
2711
@ DontRunOnGithubActions
2670
2712
public void testPutGetToUnencryptedStage () throws Throwable {
2671
2713
2672
- List <String > accounts = Arrays .asList (null , "s3testaccount" , "azureaccount" , "gcpaccount" );
2714
+ List <String > accounts =
2715
+ Arrays .asList (null , "s3testaccount" , "azureaccount" , "gcpaccount" , "gcpaccount_awssdk" );
2673
2716
for (int i = 0 ; i < accounts .size (); i ++) {
2674
- try (Connection connection = getConnection (accounts .get (i ));
2717
+ String accountName = accounts .get (i );
2718
+ if (accounts .get (i ) != null && accounts .get (i ).equals ("gcpaccount_awssdk" )) {
2719
+ accountName = "gcpaccount" ;
2720
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "true" );
2721
+ }
2722
+ try (Connection connection = getConnection (accountName );
2675
2723
Statement statement = connection .createStatement ()) {
2676
2724
try {
2677
2725
String sourceFilePath = getFullPathFileInResource (TEST_DATA_FILE );
@@ -2712,6 +2760,8 @@ public void testPutGetToUnencryptedStage() throws Throwable {
2712
2760
} finally {
2713
2761
statement .execute ("DROP STAGE IF EXISTS testPutGet_unencstage" );
2714
2762
}
2763
+ } finally {
2764
+ SnowflakeUtil .systemSetEnv ("SNOWFLAKE_GCS_FORCE_VIRTUAL_STYLE_DOMAINS" , "false" );
2715
2765
}
2716
2766
}
2717
2767
}
0 commit comments