Skip to content

Commit 8c9490b

Browse files
ci: Updating WhenManyObjectsAreSpawnedAtOnce_AllAreReceived test (Unity-Technologies#3406)
Starting investigation with MTT-8973 I noted that it relates to MTT-11360 and this specific test (WhenManyObjectsAreSpawnedAtOnce_AllAreReceived) was updated in develop-2.0.0 branch to account for this timeout. This PR aims to update the test on develop branch to the same definition which will allow to remove the [Timeout] parameter and fix both pointed tickets ## Backport As this issue exists only in develop branch (NGOv1.X) no backport is needed
1 parent c59035b commit 8c9490b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

com.unity.netcode.gameobjects/Tests/Runtime/NetworkObject/NetworkObjectSpawnManyObjectsTests.cs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Collections;
2-
using NUnit.Framework;
32
using Unity.Netcode.TestHelpers.Runtime;
43
using UnityEngine;
54
using UnityEngine.TestTools;
@@ -47,19 +46,23 @@ protected override void OnServerAndClientsCreated()
4746
}
4847

4948
[UnityTest]
50-
// When this test fails it does so without an exception and will wait the default ~6 minutes
51-
[Timeout(360000)] // Tracked in MTT-11360
5249
public IEnumerator WhenManyObjectsAreSpawnedAtOnce_AllAreReceived()
5350
{
51+
var timeStarted = Time.realtimeSinceStartup;
5452
for (int x = 0; x < k_SpawnedObjects; x++)
5553
{
5654
NetworkObject serverObject = Object.Instantiate(m_PrefabToSpawn.Prefab).GetComponent<NetworkObject>();
5755
serverObject.NetworkManagerOwner = m_ServerNetworkManager;
5856
serverObject.Spawn();
5957
}
58+
59+
var timeSpawned = Time.realtimeSinceStartup - timeStarted;
60+
// Provide plenty of time to spawn all 1500 objects in case the CI VM is running slow
61+
var timeoutHelper = new TimeoutHelper(30);
6062
// ensure all objects are replicated
61-
yield return WaitForConditionOrTimeOut(() => SpawnObjecTrackingComponent.SpawnedObjects == k_SpawnedObjects);
62-
AssertOnTimeout($"Timed out waiting for the client to spawn {k_SpawnedObjects} objects!");
63+
yield return WaitForConditionOrTimeOut(() => SpawnObjecTrackingComponent.SpawnedObjects == k_SpawnedObjects, timeoutHelper);
64+
65+
AssertOnTimeout($"Timed out waiting for the client to spawn {k_SpawnedObjects} objects! Time to spawn: {timeSpawned} | Time to timeout: {timeStarted - Time.realtimeSinceStartup}", timeoutHelper);
6366
}
6467
}
6568
}

0 commit comments

Comments
 (0)