Skip to content

Commit 96d3b6c

Browse files
authored
chore: fix minor typos in NetcodeIntegrationTest (#1767)
1 parent bdf229d commit 96d3b6c

14 files changed

+51
-51
lines changed

com.unity.netcode.gameobjects/TestHelpers/Runtime/NetcodeIntegrationTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
namespace Unity.Netcode.TestHelpers.Runtime
1212
{
1313
/// <summary>
14-
/// The default Netcode For GameObjects integration test helper class
14+
/// The default Netcode for GameObjects integration test helper class
1515
/// </summary>
1616
public abstract class NetcodeIntegrationTest
1717
{
18-
static protected TimeoutHelper s_GloabalTimeoutHelper = new TimeoutHelper(4.0f);
19-
static protected WaitForSeconds s_DefaultWaitForTick = new WaitForSeconds(1.0f / k_DefaultTickRate);
18+
protected static TimeoutHelper s_GlobalTimeoutHelper = new TimeoutHelper(4.0f);
19+
protected static WaitForSeconds s_DefaultWaitForTick = new WaitForSeconds(1.0f / k_DefaultTickRate);
2020

2121
/// <summary>
2222
/// Registered list of all NetworkObjects spawned.
@@ -288,9 +288,9 @@ protected IEnumerator StartServerAndClients()
288288
// Wait for all clients to connect
289289
yield return WaitForClientsConnectedOrTimeOut();
290290

291-
Assert.False(s_GloabalTimeoutHelper.TimedOut, $"{nameof(StartServerAndClients)} timed out waiting for all clients to be connected!");
291+
Assert.False(s_GlobalTimeoutHelper.TimedOut, $"{nameof(StartServerAndClients)} timed out waiting for all clients to be connected!");
292292

293-
if (s_GloabalTimeoutHelper.TimedOut)
293+
if (s_GlobalTimeoutHelper.TimedOut)
294294
{
295295
yield return null;
296296
}
@@ -534,7 +534,7 @@ public static IEnumerator WaitForConditionOrTimeOut(Func<bool> checkForCondition
534534
// If none is provided we use the default global time out helper
535535
if (timeOutHelper == null)
536536
{
537-
timeOutHelper = s_GloabalTimeoutHelper;
537+
timeOutHelper = s_GlobalTimeoutHelper;
538538
}
539539

540540
// Start checking for a timeout
@@ -568,7 +568,7 @@ public static IEnumerator WaitForConditionOrTimeOut(IConditionalPredicate condit
568568
// If none is provided we use the default global time out helper
569569
if (timeOutHelper == null)
570570
{
571-
timeOutHelper = s_GloabalTimeoutHelper;
571+
timeOutHelper = s_GlobalTimeoutHelper;
572572
}
573573

574574
conditionalPredicate.Started();

com.unity.netcode.gameobjects/Tests/Runtime/IntegrationTestExamples.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public IEnumerator MyFirstIntegationTest()
3333
Object.FindObjectsOfType<NetworkVisibilityComponent>().Where(
3434
(c) => c.IsSpawned).Count() == 2);
3535

36-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out waiting for instances " +
36+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out waiting for instances " +
3737
"to be detected!");
3838
}
3939
}
@@ -68,7 +68,7 @@ public IEnumerator MyFirstIntegationTest()
6868
Object.FindObjectsOfType<NetworkVisibilityComponent>().Where(
6969
(c) => c.IsSpawned).Count() == 2);
7070

71-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out waiting for instances " +
71+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out waiting for instances " +
7272
"to be detected!");
7373
}
7474
}
@@ -151,7 +151,7 @@ public IEnumerator TestRelativeNetworkObjects()
151151
var expected = m_NumberToSpawn * TotalClients;
152152
// Wait for all clients to have spawned all instances
153153
yield return WaitForConditionOrTimeOut(() => SpawnTest.TotalSpawned == expected);
154-
Assert.False(s_GloabalTimeoutHelper.TimedOut, $"Timed out waiting for all to " +
154+
Assert.False(s_GlobalTimeoutHelper.TimedOut, $"Timed out waiting for all to " +
155155
$"spawn! Total Spawned: {SpawnTest.TotalSpawned}");
156156

157157
var client1Relative = s_GlobalNetworkObjects[1].Values.Where((c) =>
@@ -177,7 +177,7 @@ public IEnumerator TestDespawnNetworkObjects()
177177
}
178178
// Wait for all clients to have spawned all instances
179179
yield return WaitForConditionOrTimeOut(() => SpawnTest.TotalSpawned == 0);
180-
Assert.False(s_GloabalTimeoutHelper.TimedOut, $"Timed out waiting for all to " +
180+
Assert.False(s_GlobalTimeoutHelper.TimedOut, $"Timed out waiting for all to " +
181181
$"despawn! Total Spawned: {SpawnTest.TotalSpawned}");
182182
}
183183
}

com.unity.netcode.gameobjects/Tests/Runtime/Metrics/RttMetricsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public IEnumerator TrackRttMetricServerToClient()
6565
}
6666

6767
yield return WaitForConditionOrTimeOut(() => waitForMetricValues.MetricFound());
68-
Assert.False(s_GloabalTimeoutHelper.TimedOut, $"{nameof(TrackRttMetricServerToClient)} timed out waiting for metric to be found for {m_ClientCount} clients!");
68+
Assert.False(s_GlobalTimeoutHelper.TimedOut, $"{nameof(TrackRttMetricServerToClient)} timed out waiting for metric to be found for {m_ClientCount} clients!");
6969

7070
var rttValue = waitForMetricValues.AssertMetricValueHaveBeenFound();
7171
Assert.AreEqual(0f, rttValue);
@@ -87,7 +87,7 @@ public IEnumerator TrackRttMetricClientToServer()
8787
}
8888

8989
yield return WaitForConditionOrTimeOut(() => clientGaugeMetricValues.Where((c) => c.MetricFound()).Count() == NumberOfClients);
90-
Assert.False(s_GloabalTimeoutHelper.TimedOut, $"{nameof(TrackRttMetricClientToServer)} timed out waiting for metric to be found for {m_ClientCount} clients!");
90+
Assert.False(s_GlobalTimeoutHelper.TimedOut, $"{nameof(TrackRttMetricClientToServer)} timed out waiting for metric to be found for {m_ClientCount} clients!");
9191

9292
foreach (var clientGaugeMetricValue in clientGaugeMetricValues)
9393
{

com.unity.netcode.gameobjects/Tests/Runtime/NetworkAnimator/NetworkAnimatorTests.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ public IEnumerator AnimationTriggerReset([Values(true, false)] bool asHash)
8585

8686
// verify trigger is set for client and server
8787
yield return WaitForConditionOrTimeOut(() => asHash ? m_PlayerOnServerAnimator.GetBool(triggerHash) : m_PlayerOnServerAnimator.GetBool(triggerString));
88-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out on server trigger set check");
88+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out on server trigger set check");
8989

9090
yield return WaitForConditionOrTimeOut(() => asHash ? m_PlayerOnClientAnimator.GetBool(triggerHash) : m_PlayerOnClientAnimator.GetBool(triggerString));
91-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out on client trigger set check");
91+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out on client trigger set check");
9292

9393
// reset the trigger
9494
if (asHash)
@@ -102,10 +102,10 @@ public IEnumerator AnimationTriggerReset([Values(true, false)] bool asHash)
102102

103103
// verify trigger is reset for client and server
104104
yield return WaitForConditionOrTimeOut(() => asHash ? m_PlayerOnServerAnimator.GetBool(triggerHash) == false : m_PlayerOnServerAnimator.GetBool(triggerString) == false);
105-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out on server reset check");
105+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out on server reset check");
106106

107107
yield return WaitForConditionOrTimeOut(() => asHash ? m_PlayerOnClientAnimator.GetBool(triggerHash) == false : m_PlayerOnClientAnimator.GetBool(triggerString) == false);
108-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out on client reset check");
108+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out on client reset check");
109109
}
110110

111111

@@ -122,11 +122,11 @@ public IEnumerator AnimationStateSyncTest()
122122

123123
// ...and now we should be in the AlphaState having triggered the AlphaParameter
124124
yield return WaitForConditionOrTimeOut(() => m_PlayerOnServerAnimator.GetCurrentAnimatorStateInfo(0).IsName("AlphaState"));
125-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Server failed to reach its animation state");
125+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Server failed to reach its animation state");
126126

127127
// ...and now the client should also have sync'd and arrived at the correct state
128128
yield return WaitForConditionOrTimeOut(() => m_PlayerOnClientAnimator.GetCurrentAnimatorStateInfo(0).IsName("AlphaState"));
129-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Client failed to sync its animation state from the server");
129+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Client failed to sync its animation state from the server");
130130
}
131131

132132
[UnityTest]
@@ -143,11 +143,11 @@ public IEnumerator AnimationLayerStateSyncTest()
143143

144144
// ...and now we should be in the AlphaState having triggered the AlphaParameter
145145
yield return WaitForConditionOrTimeOut(() => m_PlayerOnServerAnimator.GetCurrentAnimatorStateInfo(layer).IsName("Layer2AlphaState"));
146-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Server failed to reach its animation state");
146+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Server failed to reach its animation state");
147147

148148
// ...and now the client should also have sync'd and arrived at the correct state
149149
yield return WaitForConditionOrTimeOut(() => m_PlayerOnClientAnimator.GetCurrentAnimatorStateInfo(layer).IsName("Layer2AlphaState"));
150-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Client failed to sync its animation state from the server");
150+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Client failed to sync its animation state from the server");
151151
}
152152

153153
[UnityTest]
@@ -166,13 +166,13 @@ public IEnumerator AnimationLayerWeightTest()
166166
yield return WaitForConditionOrTimeOut(() =>
167167
Mathf.Approximately(m_PlayerOnServerAnimator.GetLayerWeight(layer), targetWeight)
168168
);
169-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Server failed to reach its animation state");
169+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Server failed to reach its animation state");
170170

171171
// ...and now the client should also have sync'd and arrived at the correct state
172172
yield return WaitForConditionOrTimeOut(() =>
173173
Mathf.Approximately(m_PlayerOnClientAnimator.GetLayerWeight(layer), targetWeight)
174174
);
175-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Server failed to reach its animation state");
175+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Server failed to reach its animation state");
176176
}
177177

178178

@@ -202,11 +202,11 @@ public IEnumerator AnimationStateSyncTriggerTest([Values(true, false)] bool asHa
202202

203203
// ...and now we should be in the AlphaState having triggered the AlphaParameter
204204
yield return WaitForConditionOrTimeOut(() => m_PlayerOnServerAnimator.GetCurrentAnimatorStateInfo(0).IsName("TriggeredState"));
205-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Server failed to reach its animation state via trigger");
205+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Server failed to reach its animation state via trigger");
206206

207207
// ...and now the client should also have sync'd and arrived at the correct state
208208
yield return WaitForConditionOrTimeOut(() => m_PlayerOnClientAnimator.GetCurrentAnimatorStateInfo(0).IsName("TriggeredState"));
209-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Client failed to sync its animation state from the server via trigger");
209+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Client failed to sync its animation state from the server via trigger");
210210
}
211211

212212
[UnityTest]
@@ -227,11 +227,11 @@ public IEnumerator AnimationStateSyncTestWithOverride()
227227

228228
// ...and now we should be in the AlphaState having set the AlphaParameter
229229
yield return WaitForConditionOrTimeOut(() => HasClip(m_PlayerOnServerAnimator, "OverrideAlphaAnimation"));
230-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Server failed to reach its overriden animation state");
230+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Server failed to reach its overriden animation state");
231231

232232
// ...and now the client should also have sync'd and arrived at the correct state
233233
yield return WaitForConditionOrTimeOut(() => HasClip(m_PlayerOnServerAnimator, "OverrideAlphaAnimation"));
234-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Client failed to reach its overriden animation state");
234+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Client failed to reach its overriden animation state");
235235
}
236236
}
237237
}

com.unity.netcode.gameobjects/Tests/Runtime/NetworkBehaviourUpdaterTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public IEnumerator BehaviourUpdaterAllTests([Values] bool useHost,
290290
{
291291
// Waits for all clients to spawn the NetworkObjects
292292
yield return WaitForConditionOrTimeOut(() => numberOfObjectsToSpawnOnClients == s_ClientSpawnedNetworkObjects.Count);
293-
Assert.IsFalse(s_GloabalTimeoutHelper.TimedOut, $"Timed out waiting for clients to report spawning objects! " +
293+
Assert.IsFalse(s_GlobalTimeoutHelper.TimedOut, $"Timed out waiting for clients to report spawning objects! " +
294294
$"Total reported client-side spawned objects {s_ClientSpawnedNetworkObjects.Count}");
295295
}
296296

@@ -335,7 +335,7 @@ public IEnumerator BehaviourUpdaterAllTests([Values] bool useHost,
335335
yield return WaitForConditionOrTimeOut(() =>
336336
clientSideNetVarContainers.Where(d =>
337337
d.HaveAllValuesChanged(NetVarValueToSet)).Count() == clientSideNetVarContainers.Count);
338-
Assert.IsFalse(s_GloabalTimeoutHelper.TimedOut, $"Timed out waiting for client side NetVarContainers to report all NetworkVariables have been updated!");
338+
Assert.IsFalse(s_GlobalTimeoutHelper.TimedOut, $"Timed out waiting for client side NetVarContainers to report all NetworkVariables have been updated!");
339339
}
340340

341341
Object.DestroyImmediate(prefabToSpawn);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ bool HasConditionBeenMet()
125125
// now verify that all clients have been spawned
126126
checkSpawnCondition = true;
127127
yield return WaitForConditionOrTimeOut(HasConditionBeenMet);
128-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out while waiting for client side spawns!");
128+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out while waiting for client side spawns!");
129129

130130
// despawn on server. However, since we'll be using this object later in the test, don't delete it
131131
serverInstance.GetComponent<NetworkObject>().Despawn(false);
@@ -140,7 +140,7 @@ bool HasConditionBeenMet()
140140
checkSpawnCondition = false;
141141
yield return WaitForConditionOrTimeOut(HasConditionBeenMet);
142142

143-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out while waiting for client side despawns!");
143+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out while waiting for client side despawns!");
144144

145145
//----------- step 2 check spawn and destroy again
146146
serverInstance.GetComponent<NetworkObject>().Spawn();
@@ -152,7 +152,7 @@ bool HasConditionBeenMet()
152152
checkSpawnCondition = true;
153153
yield return WaitForConditionOrTimeOut(HasConditionBeenMet);
154154

155-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out while waiting for client side spawns! (2nd pass)");
155+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out while waiting for client side spawns! (2nd pass)");
156156

157157
// destroy the server object
158158
Object.Destroy(serverInstance.gameObject);
@@ -165,7 +165,7 @@ bool HasConditionBeenMet()
165165
checkSpawnCondition = false;
166166
yield return WaitForConditionOrTimeOut(HasConditionBeenMet);
167167

168-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out while waiting for client side despawns! (2nd pass)");
168+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out while waiting for client side despawns! (2nd pass)");
169169
}
170170

171171
private class TrackOnSpawnFunctions : NetworkBehaviour

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public IEnumerator WhenManyObjectsAreSpawnedAtOnce_AllAreReceived()
5959
}
6060
// ensure all objects are replicated before spawning more
6161
yield return WaitForConditionOrTimeOut(() => SpawnObjecTrackingComponent.SpawnedObjects < k_SpawnedObjects);
62-
Assert.False(s_GloabalTimeoutHelper.TimedOut, $"Timed out waiting for the client to spawn {k_SpawnedObjects} objects!");
62+
Assert.False(s_GlobalTimeoutHelper.TimedOut, $"Timed out waiting for the client to spawn {k_SpawnedObjects} objects!");
6363
}
6464
}
6565
}

com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransform/NetworkTransformTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected override IEnumerator OnServerAndClientsConnected()
7878
// Wait for the client-side to notify it is finished initializing and spawning.
7979
yield return WaitForConditionOrTimeOut(() => otherSideNetworkTransformComponent.ReadyToReceivePositionUpdate == true);
8080

81-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "Timed out waiting for client-side to notify it is ready!");
81+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "Timed out waiting for client-side to notify it is ready!");
8282

8383
yield return base.OnServerAndClientsConnected();
8484
}
@@ -115,7 +115,7 @@ public IEnumerator TestAuthoritativeTransformChangeOneAtATime([Values] bool test
115115

116116
yield return WaitForConditionOrTimeOut(() => otherSideNetworkTransform.transform.position.x > approximation);
117117

118-
Assert.False(s_GloabalTimeoutHelper.TimedOut, $"timeout while waiting for position change! Otherside value {otherSideNetworkTransform.transform.position.x} vs. Approximation {approximation}");
118+
Assert.False(s_GlobalTimeoutHelper.TimedOut, $"timeout while waiting for position change! Otherside value {otherSideNetworkTransform.transform.position.x} vs. Approximation {approximation}");
119119

120120
Assert.True(new Vector3(10, 20, 30) == otherSideNetworkTransform.transform.position, $"wrong position on ghost, {otherSideNetworkTransform.transform.position}"); // Vector3 already does float approximation with ==
121121

@@ -125,7 +125,7 @@ public IEnumerator TestAuthoritativeTransformChangeOneAtATime([Values] bool test
125125

126126
yield return WaitForConditionOrTimeOut(() => otherSideNetworkTransform.transform.rotation.eulerAngles.x > approximation);
127127

128-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "timeout while waiting for rotation change");
128+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "timeout while waiting for rotation change");
129129

130130
// approximation needed here since eulerAngles isn't super precise.
131131
Assert.LessOrEqual(Math.Abs(45 - otherSideNetworkTransform.transform.rotation.eulerAngles.x), approximation, $"wrong rotation on ghost on x, got {otherSideNetworkTransform.transform.rotation.eulerAngles.x}");
@@ -140,7 +140,7 @@ public IEnumerator TestAuthoritativeTransformChangeOneAtATime([Values] bool test
140140

141141
yield return WaitForConditionOrTimeOut(() => otherSideNetworkTransform.transform.lossyScale.x > 1f + approximation);
142142

143-
Assert.False(s_GloabalTimeoutHelper.TimedOut, "timeout while waiting for scale change");
143+
Assert.False(s_GlobalTimeoutHelper.TimedOut, "timeout while waiting for scale change");
144144

145145
UnityEngine.Assertions.Assert.AreApproximatelyEqual(2f, otherSideNetworkTransform.transform.lossyScale.x, "wrong scale on ghost");
146146
UnityEngine.Assertions.Assert.AreApproximatelyEqual(3f, otherSideNetworkTransform.transform.lossyScale.y, "wrong scale on ghost");

0 commit comments

Comments
 (0)