Repository navigation
Commit 38a4a92
authored
feat: increase hybrid prefab test coverage (#4172)
* test: run hybrid test cases over the unified transport
N4E worlds and UnifiedNetcodeTransport only start when at least one hybrid
prefab is registered. Player prefabs are never hybrid, so a UnifiedHost or
UnifiedServer test case that spawns nothing but players silently ran as plain
NGO. CreateServerAndClients now registers a UnifiedSessionPrefab when a hybrid
test case registered no hybrid prefab of its own.
* test: opt existing integration tests into hybrid prefab mode
Adds UnifiedHost/UnifiedServer fixtures and the UseUnifiedTests opt-in to 25
fixtures covering RPCs, NetworkVariables and collections, connection approval,
spawn/despawn, ownership, late-join synchronization and NGO parenting of
hybrid objects.
Ghosts spawn from a snapshot, later than NGO's spawn message, so tests that
read SpawnedObjects immediately after a spawn or a late join now wait with
WaitForSpawnedOnAllOrTimeOut. ComponentControllerTests' predicates were
missing a continue and threw instead of waiting.
RpcTests, RpcTypeSerializationTests and ClientApprovalDenied gain explicit
Host/Server fixture arguments: NUnit drops a bare [TestFixture] when the class
also has parameterized fixtures.
NetworkObjectDeserializationFailure is ignored for hybrid prefabs: removing a
prefab from one client's NetworkConfig does not unregister its ghost prefab,
which all worlds in the process share.
* test: run NetworkBehaviourUpdaterTests cases in one session per mode
The fixture was expanded into 36 [TestFixture]s (mode x client count x NetVar
combination), each starting its own session for both of its two test cases.
It now has one fixture per HostOrServer mode, and a single test that walks
the NetVar combinations and spawn counts in arrays, adding a client between
passes and despawning each case's objects before the next. Failure messages
name the case.
The 1 and 2 client passes now include a late-joined client, where every
case previously ran against a freshly started session.
* test: loop NetworkVariableCollectionsChangingTests over its collection types
The collection type only selects which helper component the prefab carries,
so it no longer needs its own fixture. Both prefabs are registered up front
and each test runs List then Dictionary in one session, despawning the
instance from its current authority between them. Failure messages name the
collection type. 10 fixtures become 5.
* style: comment verbosity pass1 parent 81b9151 commit 38a4a92
26 files changed
Lines changed: 475 additions & 169 deletions
File tree
- com.unity.netcode.gameobjects/Tests/Runtime
- Connection
- Messaging
- NetworkObject
- NetworkTransform
- NetworkVariable
- Rpc
- TestHelpers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
19 | 30 | | |
20 | 31 | | |
21 | 32 | | |
| |||
113 | 124 | | |
114 | 125 | | |
115 | 126 | | |
| 127 | + | |
116 | 128 | | |
117 | 129 | | |
118 | 130 | | |
| |||
128 | 140 | | |
129 | 141 | | |
130 | 142 | | |
| 143 | + | |
131 | 144 | | |
132 | 145 | | |
133 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
13 | 27 | | |
14 | 28 | | |
15 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| |||
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
39 | 57 | | |
40 | 58 | | |
41 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
29 | 45 | | |
30 | 46 | | |
31 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
30 | 40 | | |
31 | 41 | | |
32 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
15 | 25 | | |
16 | 26 | | |
17 | 27 | | |
| |||
0 commit comments