This is an automated email from the ASF dual-hosted git repository.
CurtHagenlocher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new cd9d83797 fix(csharp): fix other flaky tests (#4326)
cd9d83797 is described below
commit cd9d837971db8cf1a95a0cc406c07fb479bb0d85
Author: davidhcoe <[email protected]>
AuthorDate: Tue May 19 16:41:02 2026 -0400
fix(csharp): fix other flaky tests (#4326)
- Fix other collections used in device manager tests
Co-authored-by: David Coe <>
---
.../DriverManager/ColocatedManifestTests.cs | 9 +++++++++
.../DriverManager/DriverManagerSecurityTests.cs | 14 ++++++++++++--
.../DriverManager/TomlConnectionProfileTests.cs | 10 ++++++++++
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git
a/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/ColocatedManifestTests.cs
b/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/ColocatedManifestTests.cs
index e9427b473..4c72c40cb 100644
---
a/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/ColocatedManifestTests.cs
+++
b/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/ColocatedManifestTests.cs
@@ -26,6 +26,15 @@ namespace Apache.Arrow.Adbc.Tests.DriverManager
/// <summary>
/// Tests for co-located manifest file auto-discovery.
/// </summary>
+ /// <remarks>
+ /// These tests load drivers via <c>AdbcDriverManager</c>, whose hot path
reads
+ /// the process-wide <c>DriverManagerSecurity.Allowlist</c> and fans every
load
+ /// attempt into <c>DriverManagerSecurity.AuditLogger</c>. Joining the
+ /// <see cref="DriverManagerSecurityCollection"/> serializes us against
tests
+ /// that mutate those static values, preventing flaky "collection was
modified" /
+ /// "not permitted by the configured allowlist" failures.
+ /// </remarks>
+ [Collection(DriverManagerSecurityCollection.Name)]
public class ColocatedManifestTests : IDisposable
{
private readonly List<string> _tempFiles = new List<string>();
diff --git
a/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/DriverManagerSecurityTests.cs
b/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/DriverManagerSecurityTests.cs
index 6c319a09e..8004817a2 100644
---
a/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/DriverManagerSecurityTests.cs
+++
b/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/DriverManagerSecurityTests.cs
@@ -574,11 +574,21 @@ namespace Apache.Arrow.Adbc.Tests.DriverManager
private class TestAuditLogger : IDriverLoadAuditLogger
{
- public List<DriverLoadAttempt> Attempts { get; } = new
List<DriverLoadAttempt>();
+ private readonly object _gate = new object();
+ private readonly List<DriverLoadAttempt> _attempts = new
List<DriverLoadAttempt>();
+
+ // Snapshot under lock so concurrent fan-in from other tests
(which xUnit
+ // serializes against us via the DriverManagerSecurity collection,
but is
+ // possible if a future test class forgets to opt in) cannot tear
this
+ // list mid-enumeration on Assert.Single / foreach.
+ public IReadOnlyList<DriverLoadAttempt> Attempts
+ {
+ get { lock (_gate) { return _attempts.ToArray(); } }
+ }
public void LogDriverLoadAttempt(DriverLoadAttempt attempt)
{
- Attempts.Add(attempt);
+ lock (_gate) { _attempts.Add(attempt); }
}
}
diff --git
a/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/TomlConnectionProfileTests.cs
b/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/TomlConnectionProfileTests.cs
index a794961a9..a6a0f35dc 100644
---
a/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/TomlConnectionProfileTests.cs
+++
b/csharp/test/Apache.Arrow.Adbc.Tests/DriverManager/TomlConnectionProfileTests.cs
@@ -26,6 +26,16 @@ namespace Apache.Arrow.Adbc.Tests.DriverManager
/// <summary>
/// Tests for <see cref="FilesystemProfileProvider"/> TOML parsing and the
internal <see cref="TomlParser"/>.
/// </summary>
+ /// <remarks>
+ /// Some tests in this class load drivers via <c>AdbcDriverManager</c>,
whose
+ /// hot path reads the process-wide <c>DriverManagerSecurity.Allowlist</c>
and
+ /// fans every load attempt into <c>DriverManagerSecurity.AuditLogger</c>.
+ /// Joining the <see cref="DriverManagerSecurityCollection"/> serializes us
+ /// against tests that mutate those static values, preventing flaky
+ /// "collection was modified" / "not permitted by the configured allowlist"
+ /// failures.
+ /// </remarks>
+ [Collection(DriverManagerSecurityCollection.Name)]
public class TomlConnectionProfileTests : IDisposable
{
//
-----------------------------------------------------------------------