Copilot commented on code in PR #3860:
URL: https://github.com/apache/avro/pull/3860#discussion_r3567559889


##########
lang/csharp/src/apache/test/IO/BinaryCodecTests.cs:
##########
@@ -38,6 +39,24 @@ namespace Avro.Test
     [TestFixture]
     public class BinaryCodecTests
     {
+        private string _previousMaxCollectionItems;
+
+        // The collection-limit tests assume the default caps. 
AVRO_MAX_COLLECTION_ITEMS
+        // overrides them, so a value set in the shell/CI could make these 
tests
+        // flaky (or reject a legitimate array). Clear it for each test and 
restore
+        // it afterward so the tests are deterministic against the defaults.
+        [SetUp]
+        public void ClearCollectionItemsEnv()
+        {
+            _previousMaxCollectionItems = 
Environment.GetEnvironmentVariable("AVRO_MAX_COLLECTION_ITEMS");
+            Environment.SetEnvironmentVariable("AVRO_MAX_COLLECTION_ITEMS", 
null);
+        }

Review Comment:
   Clearing AVRO_MAX_COLLECTION_ITEMS in [SetUp] may not reliably make these 
tests deterministic because GenericReader caches the env var into static 
readonly fields (MaxCollectionItems/MaxCollectionStructural) at first type 
initialization. If any other test fixture touches GenericReader before this 
fixture runs, these limits will already be fixed and changing the env var here 
won’t affect behavior, reintroducing flakiness when the env var is set in 
CI/shell. Consider moving the env-var override into a test-assembly/namespace 
[SetUpFixture] that runs before any tests (or otherwise ensuring GenericReader 
is initialized only after unsetting the variable).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to