Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: universal rpc test timeout #2884

Draft
wants to merge 6 commits into
base: release/1.9.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions .yamato/project.metafile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
validation_editor: 2021.3
mobile_validation_editor: 2021.3
validation_editor: 2022.3
mobile_validation_editor: 2022.3

# Platforms that will be tested. The first entry in this array will also
# be used for validation
Expand Down Expand Up @@ -42,10 +42,7 @@ projects:
- name: com.unity.netcode.gameobjects
path: com.unity.netcode.gameobjects
test_editors:
- 2021.3
- 2022.2
- 2023.1
- trunk
- 2022.3
- name: minimalproject
path: minimalproject
validate: false
Expand All @@ -55,24 +52,21 @@ projects:
- name: com.unity.netcode.gameobjects
path: com.unity.netcode.gameobjects
test_editors:
- 2021.3
- 2022.3
- name: testproject-tools-integration
path: testproject-tools-integration
validate: false
publish: false
has_tests: true
test_editors:
- 2021.3
- 2022.2
- trunk
- 2022.3

# Package dependencies
dependencies:
- name: com.unity.transport
version: 2.0.0-pre.2
test_editors:
- 2022.2
- trunk
- 2022.3

# Scripting backends used by Standalone Playmode Tests
scripting_backends:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private void DrawAllPropertyFields()
private void DrawTransportField()
{
#if RELAY_INTEGRATION_AVAILABLE
var useRelay = EditorPrefs.GetBool(k_UseEasyRelayIntegrationKey, false);
var useRelay = EditorPrefs.GetBool(m_UseEasyRelayIntegrationKey, false);
#else
var useRelay = false;
#endif
Expand Down Expand Up @@ -257,7 +257,7 @@ private void DrawTransportField()
}

#if RELAY_INTEGRATION_AVAILABLE
private readonly string k_UseEasyRelayIntegrationKey = "NetworkManagerUI_UseRelay_" + Application.dataPath.GetHashCode();
private readonly string m_UseEasyRelayIntegrationKey = "NetworkManagerUI_UseRelay_" + Application.dataPath.GetHashCode();
private string m_JoinCode = "";
private string m_StartConnectionError = null;
private string m_Region = "";
Expand All @@ -272,7 +272,7 @@ private void ShowStartConnectionButtons()

#if RELAY_INTEGRATION_AVAILABLE
// use editor prefs to persist the setting when entering / leaving play mode / exiting Unity
var useRelay = EditorPrefs.GetBool(k_UseEasyRelayIntegrationKey, false);
var useRelay = EditorPrefs.GetBool(m_UseEasyRelayIntegrationKey, false);
GUILayout.BeginHorizontal();
useRelay = GUILayout.Toggle(useRelay, "Try Relay in the Editor");

Expand All @@ -284,7 +284,7 @@ private void ShowStartConnectionButtons()
}
GUILayout.EndHorizontal();

EditorPrefs.SetBool(k_UseEasyRelayIntegrationKey, useRelay);
EditorPrefs.SetBool(m_UseEasyRelayIntegrationKey, useRelay);
if (useRelay && !Application.isPlaying && !CloudProjectSettings.projectBound)
{
EditorGUILayout.HelpBox("To use relay, you need to setup your project in the Project Settings in the Services section.", MessageType.Warning);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ public unsafe void Send(ulong clientId, NetworkDelivery delivery, FastBufferWrit
break;
}
case TypeOfCorruption.CorruptBytes:
batchData.Seek(batchData.Length - 2);
var currentByte = batchData.GetUnsafePtr()[0];
batchData.WriteByteSafe((byte)(currentByte == 0 ? 1 : 0));
MessageQueue.Add(batchData.ToArray());
break;
{
batchData.Seek(batchData.Length - 4);
for (int i = 0; i < 4; i++)
{
var currentByte = batchData.GetUnsafePtr()[i];
batchData.WriteByteSafe((byte)(currentByte == 0 ? 1 : 0));
MessageQueue.Add(batchData.ToArray());
}
break;
}
case TypeOfCorruption.Truncated:
batchData.Truncate(batchData.Length - 1);
MessageQueue.Add(batchData.ToArray());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1285,23 +1285,31 @@ public enum AllocationType
List
}

// Extending timeout since the added yield return causes this test to commonly timeout
[Timeout(600000)]
[UnityTest]
public IEnumerator TestSendingWithGroupOverride()
{
var waitFor = new WaitForFixedUpdate();
foreach (var defaultSendTo in Enum.GetValues(typeof(SendTo)))
{
m_EnableVerboseDebug = true;
VerboseDebug($"Processing: {defaultSendTo}");
m_EnableVerboseDebug = false;

foreach (var recipient in RecipientGroups)
{
for (ulong objectOwner = 0u; objectOwner <= 2u; ++objectOwner)
{
for (ulong sender = 0u; sender <= 2u; ++sender)
{
yield return waitFor;
foreach (var allocationType in Enum.GetValues(typeof(AllocationType)))
{
if (++YieldCheck % YieldCycleCount == 0)
{
yield return null;
}
//if (++YieldCheck % YieldCycleCount == 0)
//{
// yield return null;
//}
OnInlineSetup();
var sendMethodName = $"DefaultTo{defaultSendTo}AllowOverrideRpc";

Expand Down Expand Up @@ -1378,23 +1386,32 @@ public enum AllocationType
List
}

// Extending timeout since the added yield return causes this test to commonly timeout
[Timeout(600000)]
[UnityTest]
public IEnumerator TestSendingWithGroupNotOverride()
{
var waitFor = new WaitForFixedUpdate();
foreach (var defaultSendTo in Enum.GetValues(typeof(SendTo)))
{
m_EnableVerboseDebug = true;
VerboseDebug($"Processing: {defaultSendTo}");
m_EnableVerboseDebug = false;
foreach (var recipient in RecipientGroups)
{
for (ulong objectOwner = 0u; objectOwner <= 2u; ++objectOwner)
{
for (ulong sender = 0u; sender <= 2u; ++sender)
{
yield return waitFor;

foreach (var allocationType in Enum.GetValues(typeof(AllocationType)))
{
if (++YieldCheck % YieldCycleCount == 0)
{
yield return null;
}
//if (++YieldCheck % YieldCycleCount == 0)
//{
// yield return waitFor;
//}

OnInlineSetup();
var sendMethodName = $"DefaultTo{defaultSendTo}AllowOverrideRpc";

Expand Down