Skip to content

Commit aea4421

Browse files
fix: extended integrationtest run times [up-port #3560] (#3566)
Up-porting some of the fixes and optimizations applied to v1.14.0 branch. The total test count prior to optimizations: <img width="641" height="642" alt="image" src="https://github.com/user-attachments/assets/d45a0b22-a9ae-4674-b176-ec25646503ae" /> The total test count after optimizations: <img width="638" height="635" alt="image" src="https://github.com/user-attachments/assets/632897f6-9381-42b3-b5d0-b83e9e06cda9" /> ## Changelog NA ## Testing and Documentation - Includes integration test fixes and refactoring. - No documentation changes or additions were necessary. <!-- Uncomment and mark items off with a * if this PR deprecates any API: ### Deprecated API - [ ] An `[Obsolete]` attribute was added along with a `(RemovedAfter yyyy-mm-dd)` entry. - [ ] An [api updater] was added. - [ ] Deprecation of the API is explained in the CHANGELOG. - [ ] The users can understand why this API was removed and what they should use instead. --> ## Backport This is the up-port of #3560. <!-- If this is a backport: - Add the following to the PR title: "\[Backport\] ..." . - Link to the original PR. If this needs a backport - state this here If a backport is not needed please provide the reason why. If the "Backports" section is not present it will lead to a CI test failure. -->
1 parent bea303f commit aea4421

File tree

3 files changed

+747
-293
lines changed

3 files changed

+747
-293
lines changed

com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ public unsafe void Send(ulong clientId, NetworkDelivery delivery, FastBufferWrit
9090
break;
9191
}
9292
case TypeOfCorruption.CorruptBytes:
93-
batchData.Seek(batchData.Length - 2);
94-
var currentByte = batchData.GetUnsafePtr()[0];
95-
batchData.WriteByteSafe((byte)(currentByte == 0 ? 1 : 0));
96-
MessageQueue.Add(batchData.ToArray());
93+
for (int i = 0; i < 4; i++)
94+
{
95+
var currentByte = batchData.GetUnsafePtr()[i];
96+
currentByte = (byte)((currentByte + 1) % 255);
97+
batchData.WriteByteSafe(currentByte);
98+
MessageQueue.Add(batchData.ToArray());
99+
}
97100
break;
98101
case TypeOfCorruption.Truncated:
99102
batchData.Truncate(batchData.Length - 1);

com.unity.netcode.gameobjects/Tests/Runtime/Transports/UnityTransportTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public IEnumerator Cleanup()
5151

5252
// Need to destroy the GameObject (all assigned components will get destroyed too)
5353
UnityEngine.Object.DestroyImmediate(m_Server.gameObject);
54+
m_Server = null;
5455
}
5556

5657
if (m_Client1)
@@ -59,6 +60,7 @@ public IEnumerator Cleanup()
5960

6061
// Need to destroy the GameObject (all assigned components will get destroyed too)
6162
UnityEngine.Object.DestroyImmediate(m_Client1.gameObject);
63+
m_Client1 = null;
6264
}
6365

6466
if (m_Client2)
@@ -67,6 +69,7 @@ public IEnumerator Cleanup()
6769

6870
// Need to destroy the GameObject (all assigned components will get destroyed too)
6971
UnityEngine.Object.DestroyImmediate(m_Client2.gameObject);
72+
m_Client2 = null;
7073
}
7174
m_ServerEvents?.Clear();
7275
m_Client1Events?.Clear();
@@ -317,7 +320,7 @@ public IEnumerator DisconnectOnReliableSendQueueOverflow()
317320
m_Server.StartServer();
318321
m_Client1.StartClient();
319322

320-
yield return WaitForNetworkEvent(NetworkEvent.Connect, m_Client1Events);
323+
yield return WaitForNetworkEvent(NetworkEvent.Connect, m_Client1Events, 5.0f);
321324

322325
var serverClientId = m_Client1.ServerClientId;
323326

0 commit comments

Comments
 (0)