Skip to content

Commit 9b5d16a

Browse files
committed
Merge branch 'master' into mgemra/SNOW-2026116-remove-mono-unix
# Conflicts: # CHANGELOG.md
2 parents e50e485 + dfc1695 commit 9b5d16a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+8731
-8544
lines changed

.EditorConfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ indent_size = 4
66
insert_final_newline = true
77
trim_trailing_whitespace = true
88
charset = utf-8
9+
end_of_line = lf
910
max_line_length=150
1011

1112
# Interfaces should start with I and PascalCase

.gitattributes

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Set default behavior to automatically normalize line endings to LF
2+
* text=auto eol=lf
3+
4+
# Explicitly declare text files you want to always be normalized and converted to native line endings on checkout
5+
*.cs text eol=lf
6+
*.csproj text eol=lf
7+
*.sln text eol=lf
8+
*.config text eol=lf
9+
*.json text eol=lf
10+
*.xml text eol=lf
11+
*.md text eol=lf
12+
*.txt text eol=lf
13+
*.sh text eol=lf
14+
*.yml text eol=lf
15+
*.resx text eol=lf
16+
17+
# Denote all files that are truly binary and should not be modified
18+
*.dll binary
19+
*.exe binary
20+
*.gpg binary
21+
*.crt binary
22+
*.dmp binary

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Changelog
44
- v5.2.0
55
- Added multi-targeting support to eliminate prerelease Mono.Unix dependency on Windows .NET 5+.
6+
- Fixed CRL validation to reject newly downloaded CRLs if their NextUpdate has already expired.
67
- v5.1.0
78
- Added `APPLICATION_PATH` to `CLIENT_ENVIRONMENT` sent during authentication to identify the application connecting to Snowflake.
89
- Renew idle sessions in the pool if keep alive is enabled.

Snowflake.Data.Tests/IntegrationTests/FileUploadDownloadLargeFilesIT.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
using Snowflake.Data.Client;
66
using Snowflake.Data.Tests.Util;
77

8-
namespace Snowflake.Data.Tests
8+
namespace Snowflake.Data.Tests.IntegrationTests
99
{
10-
1110
[TestFixture]
1211
public class FileUploadDownloadLargeFilesIT : SFBaseTest
1312
{
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
using System;
2+
using System.Data;
3+
using NUnit.Framework;
4+
using Snowflake.Data.Client;
5+
6+
namespace Snowflake.Data.Tests.IntegrationTests
7+
{
8+
[SetUpFixture]
9+
public class IntegrationTestSetup
10+
{
11+
[OneTimeSetUp]
12+
public void SetupIntegrationTests()
13+
{
14+
var testConfig = TestEnvironment.TestConfig;
15+
ModifySchema(testConfig.schema, SchemaAction.Create);
16+
}
17+
18+
[OneTimeTearDown]
19+
public void CleanupIntegrationTests()
20+
{
21+
var testConfig = TestEnvironment.TestConfig;
22+
23+
if (testConfig == null)
24+
return;
25+
26+
ModifySchema(testConfig.schema, SchemaAction.Drop);
27+
}
28+
29+
private enum SchemaAction
30+
{
31+
Create,
32+
Drop
33+
}
34+
35+
private static void ModifySchema(string schemaName, SchemaAction schemaAction)
36+
{
37+
var testConfig = TestEnvironment.TestConfig;
38+
39+
using (IDbConnection conn = new SnowflakeDbConnection())
40+
{
41+
conn.ConnectionString = BuildConnectionString(testConfig);
42+
conn.Open();
43+
var dbCommand = conn.CreateCommand();
44+
45+
switch (schemaAction)
46+
{
47+
case SchemaAction.Create:
48+
dbCommand.CommandText = $"CREATE OR REPLACE SCHEMA {schemaName}";
49+
break;
50+
case SchemaAction.Drop:
51+
dbCommand.CommandText = $"DROP SCHEMA IF EXISTS {schemaName}";
52+
break;
53+
default:
54+
Assert.Fail($"Not supported action on schema: {schemaAction}");
55+
break;
56+
}
57+
58+
try
59+
{
60+
dbCommand.ExecuteNonQuery();
61+
}
62+
catch (InvalidOperationException e)
63+
{
64+
Assert.Fail($"Unable to {schemaAction.ToString().ToLower()} schema {schemaName}:\n{e.StackTrace}");
65+
}
66+
}
67+
}
68+
69+
private static string BuildConnectionString(TestConfig config)
70+
{
71+
return $"scheme={config.protocol};host={config.host};port={config.port};" +
72+
$"certRevocationCheckMode=enabled;account={config.account};role={config.role};" +
73+
$"db={config.database};warehouse={config.warehouse};" +
74+
$"user={config.user};password={config.password};";
75+
}
76+
}
77+
}
78+
Lines changed: 108 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,108 @@
1-
using NUnit.Framework;
2-
using System.Data;
3-
using System.Data.Common;
4-
5-
namespace Snowflake.Data.Tests.IntegrationTests
6-
{
7-
8-
[TestFixture]
9-
class SFDbFactoryIT : SFBaseTest
10-
{
11-
DbProviderFactory _factory;
12-
DbCommand _command;
13-
DbConnection _connection;
14-
15-
[SetUp]
16-
public new void BeforeTest()
17-
{
18-
#if NETFRAMEWORK
19-
_factory = DbProviderFactories.GetFactory("Snowflake.Data");
20-
#else
21-
// In .NET Standard, DbProviderFactories is gone.
22-
// Reference https://weblog.west-wind.com/posts/2017/Nov/27/Working-around-the-lack-of-dynamic-DbProviderFactory-loading-in-NET-Core
23-
// for more details
24-
_factory = Snowflake.Data.Client.SnowflakeDbFactory.Instance;
25-
#endif
26-
27-
_command = _factory.CreateCommand();
28-
_connection = _factory.CreateConnection();
29-
30-
_connection.ConnectionString = ConnectionString;
31-
_connection.Open();
32-
}
33-
34-
[TearDown]
35-
public new void AfterTest()
36-
{
37-
_connection.Close();
38-
}
39-
40-
[Test]
41-
public void TestSimpleDbFactory()
42-
{
43-
// set commnad's connection object
44-
_command.Connection = _connection;
45-
_command.CommandText = "select 1";
46-
47-
object res = _command.ExecuteScalar();
48-
49-
Assert.AreEqual(1, res);
50-
}
51-
52-
[Test]
53-
public void TestDbFactoryWithParameter()
54-
{
55-
int expectedIntValue = 1;
56-
57-
DbParameter parameter = _factory.CreateParameter();
58-
parameter.ParameterName = "1";
59-
parameter.Value = expectedIntValue;
60-
parameter.DbType = DbType.Int16;
61-
_command.Parameters.Add(parameter);
62-
63-
// set command's connection object
64-
_command.Connection = _connection;
65-
_command.CommandText = "select ?";
66-
67-
var result = _command.ExecuteScalar();
68-
69-
Assert.AreEqual(expectedIntValue, result);
70-
}
71-
72-
[Test]
73-
public void TestDbFactoryWithConnectionStringBuilder()
74-
{
75-
DbConnectionStringBuilder builder = _factory.CreateConnectionStringBuilder();
76-
builder.ConnectionString = ConnectionString;
77-
78-
_connection.ConnectionString = builder.ConnectionString;
79-
_connection.Open();
80-
81-
// set command's connection object
82-
_command.Connection = _connection;
83-
_command.CommandText = "select 1";
84-
85-
var result = _command.ExecuteScalar();
86-
87-
Assert.AreEqual(1, result);
88-
}
89-
90-
[Test]
91-
public void TestDbFactoryWithCommandBuilderAndAdapter()
92-
{
93-
// set command's connection object
94-
_command.Connection = _connection;
95-
_command.CommandText = "select 1";
96-
97-
DbDataAdapter adapter = _factory.CreateDataAdapter();
98-
adapter.SelectCommand = _command;
99-
DbCommandBuilder builder = _factory.CreateCommandBuilder();
100-
builder.DataAdapter = adapter;
101-
DataSet ds = new DataSet("ds");
102-
103-
adapter.Fill(ds);
104-
105-
Assert.AreEqual(1, ds.Tables[0].Rows[0].ItemArray[0]);
106-
}
107-
}
108-
}
1+
using NUnit.Framework;
2+
using System.Data;
3+
using System.Data.Common;
4+
5+
namespace Snowflake.Data.Tests.IntegrationTests
6+
{
7+
8+
[TestFixture]
9+
class SFDbFactoryIT : SFBaseTest
10+
{
11+
DbProviderFactory _factory;
12+
DbCommand _command;
13+
DbConnection _connection;
14+
15+
[SetUp]
16+
public new void BeforeTest()
17+
{
18+
#if NETFRAMEWORK
19+
_factory = DbProviderFactories.GetFactory("Snowflake.Data");
20+
#else
21+
// In .NET Standard, DbProviderFactories is gone.
22+
// Reference https://weblog.west-wind.com/posts/2017/Nov/27/Working-around-the-lack-of-dynamic-DbProviderFactory-loading-in-NET-Core
23+
// for more details
24+
_factory = Snowflake.Data.Client.SnowflakeDbFactory.Instance;
25+
#endif
26+
27+
_command = _factory.CreateCommand();
28+
_connection = _factory.CreateConnection();
29+
30+
_connection.ConnectionString = ConnectionString;
31+
_connection.Open();
32+
}
33+
34+
[TearDown]
35+
public new void AfterTest()
36+
{
37+
_connection.Close();
38+
}
39+
40+
[Test]
41+
public void TestSimpleDbFactory()
42+
{
43+
// set commnad's connection object
44+
_command.Connection = _connection;
45+
_command.CommandText = "select 1";
46+
47+
object res = _command.ExecuteScalar();
48+
49+
Assert.AreEqual(1, res);
50+
}
51+
52+
[Test]
53+
public void TestDbFactoryWithParameter()
54+
{
55+
int expectedIntValue = 1;
56+
57+
DbParameter parameter = _factory.CreateParameter();
58+
parameter.ParameterName = "1";
59+
parameter.Value = expectedIntValue;
60+
parameter.DbType = DbType.Int16;
61+
_command.Parameters.Add(parameter);
62+
63+
// set command's connection object
64+
_command.Connection = _connection;
65+
_command.CommandText = "select ?";
66+
67+
var result = _command.ExecuteScalar();
68+
69+
Assert.AreEqual(expectedIntValue, result);
70+
}
71+
72+
[Test]
73+
public void TestDbFactoryWithConnectionStringBuilder()
74+
{
75+
DbConnectionStringBuilder builder = _factory.CreateConnectionStringBuilder();
76+
builder.ConnectionString = ConnectionString;
77+
78+
_connection.ConnectionString = builder.ConnectionString;
79+
_connection.Open();
80+
81+
// set command's connection object
82+
_command.Connection = _connection;
83+
_command.CommandText = "select 1";
84+
85+
var result = _command.ExecuteScalar();
86+
87+
Assert.AreEqual(1, result);
88+
}
89+
90+
[Test]
91+
public void TestDbFactoryWithCommandBuilderAndAdapter()
92+
{
93+
// set command's connection object
94+
_command.Connection = _connection;
95+
_command.CommandText = "select 1";
96+
97+
DbDataAdapter adapter = _factory.CreateDataAdapter();
98+
adapter.SelectCommand = _command;
99+
DbCommandBuilder builder = _factory.CreateCommandBuilder();
100+
builder.DataAdapter = adapter;
101+
DataSet ds = new DataSet("ds");
102+
103+
adapter.Fill(ds);
104+
105+
Assert.AreEqual(1, ds.Tables[0].Rows[0].ItemArray[0]);
106+
}
107+
}
108+
}

0 commit comments

Comments
 (0)