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-1640968 dispose disposable objects #1014

Merged
merged 7 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
11 changes: 6 additions & 5 deletions Snowflake.Data.Tests/UnitTests/ConcatenatedStreamTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
* Copyright (c) 2023 Snowflake Computing Inc. All rights reserved.
*/

using Snowflake.Data.Tests.Util;
using NUnit.Framework;
using System;
using System.IO;
using System.Text;

namespace Snowflake.Data.Tests.UnitTests
{
using NUnit.Framework;
using Snowflake.Data.Core;
using System;
using System.IO;
using System.Text;

[TestFixture]
class ConcatenatedStreamTest
Expand Down
4 changes: 2 additions & 2 deletions Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
const bool IsAsync = true;

[SetUp]
public void BeforeTest()

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, AZURE)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, AWS)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.

Check warning on line 74 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, GCP)

'SFRemoteStorageClientTest.BeforeTest()' hides inherited member 'SFBaseTestAsync.BeforeTest()'. Use the new keyword if hiding was intended.
{
t_realSourceFilePath = TestNameWithWorker + "_realSrcFilePath.txt";
t_downloadFileName = TestNameWithWorker + "_mockFileName.txt";
Expand Down Expand Up @@ -122,7 +122,7 @@
}

[TearDown]
public void AfterTest()

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net8.0, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net6.0, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on MAC (net7.0, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net7.0, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net6.0, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net8.0, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Linux (net8.0, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net7.0, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net48, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net462, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net6.0, AZURE)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net481, AWS)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.

Check warning on line 125 in Snowflake.Data.Tests/UnitTests/SFRemoteStorageClientTest.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, GCP)

'SFRemoteStorageClientTest.AfterTest()' hides inherited member 'SFBaseTestAsync.AfterTest()'. Use the new keyword if hiding was intended.
{
// Delete temporary files from upload
if (File.Exists(_fileMetadata.realSrcFilePath))
Expand Down Expand Up @@ -527,14 +527,14 @@

// Get encrypted stream from file
SFEncryptionMetadata encryptionMetadata = new SFEncryptionMetadata();
Stream stream = EncryptionProvider.EncryptFile(
StreamPair streamPair = EncryptionProvider.EncryptFile(
t_downloadFileName,
_fileMetadata.encryptionMaterial,
encryptionMetadata,
FileTransferConfiguration.FromFileMetadata(_fileMetadata));

// Set up the stream and metadata for decryption
MockRemoteStorageClient.SetEncryptionData(stream, encryptionMetadata.iv, encryptionMetadata.key);
MockRemoteStorageClient.SetEncryptionData(streamPair.MainStream, encryptionMetadata.iv, encryptionMetadata.key);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright (c) 2012-2019 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
*/

using System;
using System.Collections.Generic;
using System.IO;

namespace Snowflake.Data.Core
namespace Snowflake.Data.Tests.Util
{
/// <summary>
/// Used to concat multiple streams without copying. Since we need to preappend '[' and append ']'
Expand Down
64 changes: 35 additions & 29 deletions Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,36 +100,29 @@
{
try
{
PemReader pr = null;
if (null != pkPwd)
using (PemReader pr = CreatePemReader(tr, pkPwd))

Check warning on line 103 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L103

Added line #L103 was not covered by tests
{
IPasswordFinder ipwdf = new PasswordFinder(pkPwd);
pr = new PemReader(tr, ipwdf);
}
else
{
pr = new PemReader(tr);
}

object key = pr.ReadObject();
// Infer what the pem reader is sending back based on the object properties
if (key.GetType().GetProperty("Private") != null)
{
// PKCS1 key
keypair = (AsymmetricCipherKeyPair)key;
rsaParams = DotNetUtilities.ToRSAParameters(
keypair.Private as RsaPrivateCrtKeyParameters);
}
else
{
// PKCS8 key
RsaPrivateCrtKeyParameters pk = (RsaPrivateCrtKeyParameters)key;
rsaParams = DotNetUtilities.ToRSAParameters(pk);
keypair = DotNetUtilities.GetRsaKeyPair(rsaParams);
}
if (keypair == null)
{
throw new Exception("Unknown error.");
object key = pr.ReadObject();

Check warning on line 105 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L105

Added line #L105 was not covered by tests
// Infer what the pem reader is sending back based on the object properties
if (key.GetType().GetProperty("Private") != null)
{

Check warning on line 108 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L108

Added line #L108 was not covered by tests
// PKCS1 key
keypair = (AsymmetricCipherKeyPair)key;
rsaParams = DotNetUtilities.ToRSAParameters(
keypair.Private as RsaPrivateCrtKeyParameters);
}

Check warning on line 113 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L110-L113

Added lines #L110 - L113 were not covered by tests
else
{

Check warning on line 115 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L115

Added line #L115 was not covered by tests
// PKCS8 key
RsaPrivateCrtKeyParameters pk = (RsaPrivateCrtKeyParameters)key;
rsaParams = DotNetUtilities.ToRSAParameters(pk);
keypair = DotNetUtilities.GetRsaKeyPair(rsaParams);
}

Check warning on line 120 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L117-L120

Added lines #L117 - L120 were not covered by tests

if (keypair == null)
{
throw new Exception("Unknown error.");

Check warning on line 124 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L123-L124

Added lines #L123 - L124 were not covered by tests
}
}
}
catch (Exception e)
Expand Down Expand Up @@ -207,6 +200,19 @@
return jwtToken;
}

private PemReader CreatePemReader(TextReader textReader, string privateKeyPassword)
{

Check warning on line 204 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L204

Added line #L204 was not covered by tests
if (null != privateKeyPassword)
{
IPasswordFinder ipwdf = new PasswordFinder(privateKeyPassword);
return new PemReader(textReader, ipwdf);

Check warning on line 208 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L206-L208

Added lines #L206 - L208 were not covered by tests
}
else
{
return new PemReader(textReader);

Check warning on line 212 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L211-L212

Added lines #L211 - L212 were not covered by tests
}
}

Check warning on line 214 in Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/Authenticator/KeyPairAuthenticator.cs#L214

Added line #L214 was not covered by tests

/// <summary>
/// Helper class to handle the password for the certificate if there is one.
/// </summary>
Expand Down
143 changes: 85 additions & 58 deletions Snowflake.Data/Core/FileTransfer/EncryptionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Snowflake.Data.Core.FileTransfer
{
/// <summary>
/// The encryption materials.
/// The encryption materials.
/// </summary>
internal class MaterialDescriptor
{
Expand All @@ -22,7 +22,7 @@ internal class MaterialDescriptor
}

/// <summary>
/// The encryptor/decryptor for PUT/GET files.
/// The encryptor/decryptor for PUT/GET files.
/// </summary>
class EncryptionProvider
{
Expand All @@ -43,7 +43,7 @@ class EncryptionProvider
/// <param name="encryptionMetadata">Store the encryption metadata into</param>
/// <param name="transferConfiguration">Contains parameters used during encryption process</param>
/// <returns>The encrypted bytes of the file to upload.</returns>
public static Stream EncryptFile(
public static StreamPair EncryptFile(
string inFile,
PutGetEncryptionMaterial encryptionMaterial,
SFEncryptionMetadata encryptionMetadata,
Expand All @@ -63,7 +63,7 @@ public static Stream EncryptFile(
/// <param name="encryptionMetadata">Store the encryption metadata into</param>
/// <param name="transferConfiguration">Contains parameters used during encryption process</param>
/// <returns>The encrypted bytes of the file to upload.</returns>
public static Stream EncryptStream(
public static StreamPair EncryptStream(
Stream inputStream,
PutGetEncryptionMaterial encryptionMaterial,
SFEncryptionMetadata encryptionMetadata,
Expand All @@ -89,7 +89,7 @@ public static Stream EncryptStream(

// Encrypt file key
byte[] encryptedFileKey = encryptFileKey(decodedMasterKey, keyData);

// Store encryption metadata information
MaterialDescriptor matDesc = new MaterialDescriptor
{
Expand All @@ -116,17 +116,21 @@ public static Stream EncryptStream(
/// <returns>The encrypted key.</returns>
private static byte[] encryptFileKey(byte[] masterKey, byte[] unencryptedFileKey)
{
Aes aes = Aes.Create();
aes.Key = masterKey;
aes.Mode = CipherMode.ECB;
aes.Padding = PaddingMode.PKCS7;

MemoryStream cipherStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(cipherStream, aes.CreateEncryptor(), CryptoStreamMode.Write);
cryptoStream.Write(unencryptedFileKey, 0, unencryptedFileKey.Length);
cryptoStream.FlushFinalBlock();
using (Aes aes = Aes.Create())
{
aes.Key = masterKey;
aes.Mode = CipherMode.ECB;
aes.Padding = PaddingMode.PKCS7;

return cipherStream.ToArray();
using (MemoryStream cipherStream = new MemoryStream())
using (var encryptor = aes.CreateEncryptor())
using (CryptoStream cryptoStream = new CryptoStream(cipherStream, encryptor, CryptoStreamMode.Write))
{
cryptoStream.Write(unencryptedFileKey, 0, unencryptedFileKey.Length);
cryptoStream.FlushFinalBlock();
return cipherStream.ToArray();
}
}
}

/// <summary>
Expand All @@ -137,32 +141,41 @@ private static byte[] encryptFileKey(byte[] masterKey, byte[] unencryptedFileKey
/// <param name="iv">The encryption IV or null if it needs to be generated.</param>
/// <param name="transferConfiguration">Contains parameters used during encryption process</param>
/// <returns>The encrypted bytes.</returns>
private static Stream CreateEncryptedBytesStream(
private static StreamPair CreateEncryptedBytesStream(
Stream inputStream,
byte[] key,
byte[] iv,
FileTransferConfiguration transferConfiguration)
{
Aes aes = Aes.Create();
aes.Key = key;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.PKCS7;
aes.IV = iv;
inputStream.Position = 0;

var targetStream = new FileBackedOutputStream(transferConfiguration.MaxBytesInMemory, transferConfiguration.TempDir);
CryptoStream cryptoStream = new CryptoStream(targetStream, aes.CreateEncryptor(), CryptoStreamMode.Write);
byte[] buffer = new byte[transferConfiguration.MaxBytesInMemory];
int bytesRead;
while ((bytesRead = inputStream.Read(buffer, 0, buffer.Length)) > 0)
using (Aes aes = Aes.Create())
{
cryptoStream.Write(buffer, 0, bytesRead);
aes.Key = key;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.PKCS7;
aes.IV = iv;
inputStream.Position = 0;

var targetStream = new FileBackedOutputStream(transferConfiguration.MaxBytesInMemory, transferConfiguration.TempDir);
using (var encryptor = aes.CreateEncryptor())
{
CryptoStream cryptoStream = new CryptoStream(targetStream, encryptor, CryptoStreamMode.Write);
byte[] buffer = new byte[transferConfiguration.MaxBytesInMemory];
int bytesRead;
while ((bytesRead = inputStream.Read(buffer, 0, buffer.Length)) > 0)
{
cryptoStream.Write(buffer, 0, bytesRead);
}
cryptoStream.FlushFinalBlock();

return new StreamPair
{
MainStream = targetStream,
HelperStream = cryptoStream // cryptoStream cannot be closed here because it would close target stream as well
};
}
}
cryptoStream.FlushFinalBlock();

return targetStream;
}

/// <summary>
/// Decrypt data and write to the outStream.
/// </summary>
Expand Down Expand Up @@ -195,14 +208,15 @@ public static string DecryptFile(
byte[] decryptedFileKey = decryptFileKey(decodedMasterKey, keyBytes);

// Create key decipher with decoded key and AES ECB
using (var decryptedBytesStream = CreateDecryptedBytesStream(
using (var decryptedBytesStreamPair = CreateDecryptedBytesStream(
inFile,
decryptedFileKey,
ivBytes,
transferConfiguration))
{
using (var decryptedFileStream = File.Create(tempFileName))
{
var decryptedBytesStream = decryptedBytesStreamPair.MainStream;
decryptedBytesStream.Position = 0;
decryptedBytesStream.CopyTo(decryptedFileStream);
}
Expand All @@ -218,17 +232,22 @@ public static string DecryptFile(
/// <returns>The encrypted key.</returns>
private static byte[] decryptFileKey(byte[] masterKey, byte[] unencryptedFileKey)
{
Aes aes = Aes.Create();
aes.Key = masterKey;
aes.Mode = CipherMode.ECB;
aes.Padding = PaddingMode.PKCS7;
using (Aes aes = Aes.Create())
{
aes.Key = masterKey;
aes.Mode = CipherMode.ECB;
aes.Padding = PaddingMode.PKCS7;

MemoryStream cipherStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(cipherStream, aes.CreateDecryptor(), CryptoStreamMode.Write);
cryptoStream.Write(unencryptedFileKey, 0, unencryptedFileKey.Length);
cryptoStream.FlushFinalBlock();
using (MemoryStream cipherStream = new MemoryStream())
using (var decryptor = aes.CreateDecryptor())
using (CryptoStream cryptoStream = new CryptoStream(cipherStream, decryptor, CryptoStreamMode.Write))
{
cryptoStream.Write(unencryptedFileKey, 0, unencryptedFileKey.Length);
cryptoStream.FlushFinalBlock();

return cipherStream.ToArray();
return cipherStream.ToArray();
}
}
}

/// <summary>
Expand All @@ -238,28 +257,36 @@ private static byte[] decryptFileKey(byte[] masterKey, byte[] unencryptedFileKey
/// <param name="key">The encryption key.</param>
/// <param name="iv">The encryption IV or null if it needs to be generated.</param>
/// <returns>The decrypted bytes stream</returns>
private static Stream CreateDecryptedBytesStream(
private static StreamPair CreateDecryptedBytesStream(
string inFile,
byte[] key,
byte[] iv,
FileTransferConfiguration transferConfiguration)
{
Aes aes = Aes.Create();
aes.Key = key;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.PKCS7;
aes.IV = iv;

var targetStream = new FileBackedOutputStream(transferConfiguration.MaxBytesInMemory, transferConfiguration.TempDir);
CryptoStream cryptoStream = new CryptoStream(targetStream, aes.CreateDecryptor(), CryptoStreamMode.Write);

using(Stream inStream = File.OpenRead(inFile))
using (Aes aes = Aes.Create())
{
inStream.CopyTo(cryptoStream);
}
cryptoStream.FlushFinalBlock();
aes.Key = key;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.PKCS7;
aes.IV = iv;

return targetStream;
var targetStream = new FileBackedOutputStream(transferConfiguration.MaxBytesInMemory, transferConfiguration.TempDir);
using (var decryptor = aes.CreateDecryptor())
{
CryptoStream cryptoStream = new CryptoStream(targetStream, decryptor, CryptoStreamMode.Write);
using (Stream inStream = File.OpenRead(inFile))
{
inStream.CopyTo(cryptoStream);
}
cryptoStream.FlushFinalBlock();

return new StreamPair
{
MainStream = targetStream,
HelperStream = cryptoStream // cryptoStream cannot be closed here because it would close target stream as well
sfc-gh-mhofman marked this conversation as resolved.
Show resolved Hide resolved
};
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal bool IsUsingFileOutputStream()
{
return _fileOutputStream != null;
}

private void SwitchFromMemoryToTempFile()
{
_fileName = GenerateTempFilePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ internal static void DownloadOneFile(SFFileMetadata fileMetadata)
}

// Create stream object for reader and writer
Stream stream = new MemoryStream(File.ReadAllBytes(realSrcFilePath));
using (Stream stream = new MemoryStream(File.ReadAllBytes(realSrcFilePath)))
sfc-gh-knozderko marked this conversation as resolved.
Show resolved Hide resolved
using (var fileStream = File.Create(output))
{
// Write file
Expand Down
Loading
Loading