Skip to content

Commit 35c8508

Browse files
Merge branch 'develop-3.x.x' into fix/testproject-test-wait-bugs
2 parents ce556e3 + 38a4a92 commit 35c8508

26 files changed

Lines changed: 475 additions & 169 deletions

‎com.unity.netcode.gameobjects/Tests/Runtime/ComponentControllerTests.cs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,21 @@ namespace Unity.Netcode.RuntimeTests
1212
[TestFixture(HostOrServer.Host)]
1313
[TestFixture(HostOrServer.Server)]
1414
[TestFixture(HostOrServer.DAHost)]
15+
#if UNIFIED_NETCODE
16+
[TestFixture(HostOrServer.UnifiedHost)]
17+
[TestFixture(HostOrServer.UnifiedServer)]
18+
#endif
1519
internal class ComponentControllerTests : NetcodeIntegrationTest
1620
{
1721
protected override int NumberOfClients => 2;
1822

23+
#if UNIFIED_NETCODE
24+
protected override bool UseUnifiedTests()
25+
{
26+
return true;
27+
}
28+
#endif
29+
1930
private StringBuilder m_ErrorLog = new StringBuilder();
2031
private GameObject m_TestPrefab;
2132

@@ -113,6 +124,7 @@ private bool AllComponentStatesMatch()
113124
if (!networkManager.SpawnManager.SpawnedObjects.ContainsKey(m_AuthorityController.NetworkObjectId))
114125
{
115126
m_ErrorLog.AppendLine($"[Client-{networkManager.LocalClientId}] Does not have a spawned instance of {m_AuthorityController.name}!");
127+
continue;
116128
}
117129
var controller = networkManager.SpawnManager.SpawnedObjects[m_AuthorityController.NetworkObjectId].GetComponent<ComponentController>();
118130
ControllerStateMatches(controller);
@@ -128,6 +140,7 @@ private bool AllComponentStatesAreCorrect(bool isEnabled)
128140
if (!networkManager.SpawnManager.SpawnedObjects.ContainsKey(m_AuthorityController.NetworkObjectId))
129141
{
130142
m_ErrorLog.AppendLine($"[Client-{networkManager.LocalClientId}] Does not have a spawned instance of {m_AuthorityController.name}!");
143+
continue;
131144
}
132145
var controller = networkManager.SpawnManager.SpawnedObjects[m_AuthorityController.NetworkObjectId].GetComponent<ComponentController>();
133146
for (int i = 0; i < controller.ValidComponents.Count; i++)

‎com.unity.netcode.gameobjects/Tests/Runtime/Connection/ClientApprovalDenied.cs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,23 @@
77

88
namespace Unity.Netcode.RuntimeTests
99
{
10+
[TestFixture(HostOrServer.Host)]
11+
#if UNIFIED_NETCODE
12+
[TestFixture(HostOrServer.UnifiedHost)]
13+
#endif
1014
internal class ClientApprovalDenied : NetcodeIntegrationTest
1115
{
1216
protected override int NumberOfClients => 2;
17+
18+
public ClientApprovalDenied(HostOrServer hostOrServer) : base(hostOrServer) { }
19+
20+
#if UNIFIED_NETCODE
21+
protected override bool UseUnifiedTests()
22+
{
23+
return true;
24+
}
25+
#endif
26+
1327
private bool m_ApproveConnection = true;
1428
private ulong m_PendingClientId = 0;
1529
private ulong m_DisconnectedClientId = 0;

‎com.unity.netcode.gameobjects/Tests/Runtime/Connection/ConnectionApproval.cs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ namespace Unity.Netcode.RuntimeTests
1313
[TestFixture(PlayerCreation.PrefabHash)]
1414
[TestFixture(PlayerCreation.NoPlayer)]
1515
[TestFixture(PlayerCreation.FailValidation)]
16+
#if UNIFIED_NETCODE
17+
[TestFixture(PlayerCreation.Prefab, HostOrServer.UnifiedHost)]
18+
[TestFixture(PlayerCreation.PrefabHash, HostOrServer.UnifiedHost)]
19+
[TestFixture(PlayerCreation.NoPlayer, HostOrServer.UnifiedHost)]
20+
[TestFixture(PlayerCreation.FailValidation, HostOrServer.UnifiedHost)]
21+
#endif
1622
internal class ConnectionApprovalTests : IntegrationTestWithApproximation
1723
{
1824
private const string k_InvalidToken = "Invalid validation token!";
@@ -36,6 +42,18 @@ public ConnectionApprovalTests(PlayerCreation playerCreation)
3642
m_PlayerCreation = playerCreation;
3743
}
3844

45+
#if UNIFIED_NETCODE
46+
public ConnectionApprovalTests(PlayerCreation playerCreation, HostOrServer hostOrServer) : base(hostOrServer)
47+
{
48+
m_PlayerCreation = playerCreation;
49+
}
50+
51+
protected override bool UseUnifiedTests()
52+
{
53+
return true;
54+
}
55+
#endif
56+
3957
protected override int NumberOfClients => 1;
4058

4159
private string m_ValidationToken;

‎com.unity.netcode.gameobjects/Tests/Runtime/Connection/ConnectionApprovalTimeoutTests.cs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ namespace Unity.Netcode.RuntimeTests
99
{
1010
[TestFixture(ApprovalTimedOutTypes.ServerDoesNotRespond)]
1111
[TestFixture(ApprovalTimedOutTypes.ClientDoesNotRequest)]
12+
#if UNIFIED_NETCODE
13+
[TestFixture(ApprovalTimedOutTypes.ServerDoesNotRespond, HostOrServer.UnifiedHost)]
14+
[TestFixture(ApprovalTimedOutTypes.ClientDoesNotRequest, HostOrServer.UnifiedHost)]
15+
#endif
1216
internal class ConnectionApprovalTimeoutTests : NetcodeIntegrationTest
1317
{
1418
protected override int NumberOfClients => 1;
@@ -26,6 +30,18 @@ public ConnectionApprovalTimeoutTests(ApprovalTimedOutTypes approvalFailureType)
2630
m_ApprovalFailureType = approvalFailureType;
2731
}
2832

33+
#if UNIFIED_NETCODE
34+
public ConnectionApprovalTimeoutTests(ApprovalTimedOutTypes approvalFailureType, HostOrServer hostOrServer) : base(hostOrServer)
35+
{
36+
m_ApprovalFailureType = approvalFailureType;
37+
}
38+
39+
protected override bool UseUnifiedTests()
40+
{
41+
return true;
42+
}
43+
#endif
44+
2945
// Must be >= 5 since this is an int value and the test waits for timeout - 1 to try to verify it doesn't
3046
// time out early
3147
private const int k_TestTimeoutPeriod = 3;

‎com.unity.netcode.gameobjects/Tests/Runtime/Messaging/MessageReceiveAllocationTests.cs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,20 @@ public void NotMeRpc()
2323

2424
[TestFixture(HostOrServer.Host)]
2525
[TestFixture(HostOrServer.DAHost)]
26+
#if UNIFIED_NETCODE
27+
[TestFixture(HostOrServer.UnifiedHost)]
28+
#endif
2629
internal class MessageReceiveAllocationTests : NetcodeIntegrationTest
2730
{
2831
protected override int NumberOfClients => 1;
2932

33+
#if UNIFIED_NETCODE
34+
protected override bool UseUnifiedTests()
35+
{
36+
return true;
37+
}
38+
#endif
39+
3040
public MessageReceiveAllocationTests(HostOrServer hostOrServer) : base(hostOrServer) { }
3141

3242
private GameObject m_Prefab;

‎com.unity.netcode.gameobjects/Tests/Runtime/NetworkBehaviourPrePostSpawnTests.cs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,20 @@ namespace Unity.Netcode.RuntimeTests
88
{
99
[TestFixture(HostOrServer.Host)]
1010
[TestFixture(HostOrServer.DAHost)]
11+
#if UNIFIED_NETCODE
12+
[TestFixture(HostOrServer.UnifiedHost)]
13+
#endif
1114
internal class NetworkBehaviourPrePostSpawnTests : NetcodeIntegrationTest
1215
{
1316
protected override int NumberOfClients => 0;
1417

18+
#if UNIFIED_NETCODE
19+
protected override bool UseUnifiedTests()
20+
{
21+
return true;
22+
}
23+
#endif
24+
1525
// TODO: [CmbServiceTests] Adapt to run with the service
1626
protected override bool UseCMBService()
1727
{

0 commit comments

Comments
 (0)