-
Notifications
You must be signed in to change notification settings - Fork 459
fix: refactor integration test infra, re-enable testproject-tools-integration
, fix flaky tests on desktop & console platforms
#1687
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
Changes from all commits
53d63e5
c95a6c6
b6bcfe0
6e52663
390be29
7e7f211
584d4cd
8203daa
c9d447b
fef818d
950023e
f28f462
f6ec1d1
77fa3da
a77e134
809afc3
92d486b
546ea1c
5738dc9
c96e782
6a8f01b
c201659
4881e1b
5dad53c
dfd3c0d
e8139fd
c7eb9b0
3d260c6
8352247
04e84eb
8f64a70
bf8237a
f7b4835
b3af97b
66ad260
14b5976
84bc6da
2bc1c5e
4558a8d
7f46e5e
6a21c03
2e44a95
22c3688
9735323
685a9a3
69dc998
730fbbd
8a23581
bc38e6c
2a48733
9a0eced
8030db3
0d5f10c
3e69152
ffcc4f1
64d8551
f83c5fe
eb966ec
dbaf4aa
a7ef8ce
c6ff94d
20d5a86
c949d5a
6d05bc2
87d37fb
76ab881
0da646a
5d683bb
0f9430f
5a86ca3
76a13c0
0a15db4
095d413
e1484f6
9ead2c0
071c717
0f7f11b
4736c2f
e4c6e1d
6fa55bd
ff9968a
e2673ea
56ec2f8
d937a40
b19497f
5954505
481ad98
c409112
66862fd
d74a24b
6101a9c
b815c76
dcc70eb
424addd
52a49ad
814b7cd
a4d5c94
90f9588
aca170f
451fe82
d70d84c
a15a867
d66437b
dbc3742
edf1e19
96429b6
a89a6eb
deec3d3
880e5cc
94dbecb
9cd5cca
5cd1c16
8e85cb9
a04fe6d
54d61a3
9a08548
8f96074
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,14 @@ | ||
{ | ||
"name": "Unity.Netcode.Adapter.UTP.Editor", | ||
"rootNamespace": "", | ||
"references": [ | ||
"Unity.Collections", | ||
"Unity.Jobs", | ||
"Unity.Burst", | ||
"Unity.Netcode.Runtime", | ||
"Unity.Networking.Transport" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": true, | ||
"overrideReferences": true, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
"name": "Unity.Netcode.Adapter.UTP.Editor", | ||
"rootNamespace": "Unity.Netcode.Adapter.UTP.Editor", | ||
"references": [ | ||
"Unity.Collections", | ||
"Unity.Jobs", | ||
"Unity.Burst", | ||
"Unity.Netcode.Runtime", | ||
"Unity.Networking.Transport" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("TestProject.EditorTests")] | ||
[assembly: InternalsVisibleTo("TestProject.RuntimeTests")] | ||
[assembly: InternalsVisibleTo("TestProject.ToolsIntegration.RuntimeTests")] | ||
[assembly: InternalsVisibleTo("Unity.Netcode.RuntimeTests")] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
|
||
namespace Unity.Netcode.TestHelpers.Runtime | ||
{ | ||
public class ObjectNameIdentifier : NetworkBehaviour | ||
{ | ||
private ulong m_CurrentOwner; | ||
private ulong m_CurrentNetworkObjectId; | ||
private bool m_IsRegistered; | ||
|
||
/// <summary> | ||
/// Keep a reference to the assigned NetworkObject | ||
/// <see cref="OnDestroy"/> | ||
/// </summary> | ||
private NetworkObject m_NetworkObject; | ||
|
||
public override void OnNetworkSpawn() | ||
{ | ||
RegisterAndLabelNetworkObject(); | ||
} | ||
|
||
protected void RegisterAndLabelNetworkObject() | ||
{ | ||
if (!m_IsRegistered) | ||
{ | ||
// This is required otherwise it will try to continue to update the NetworkBehaviour even if | ||
// it has been destroyed. | ||
m_NetworkObject = NetworkObject; | ||
m_CurrentOwner = OwnerClientId; | ||
m_CurrentNetworkObjectId = NetworkObjectId; | ||
var objectOriginalName = gameObject.name.Replace("(Clone)", ""); | ||
var serverOrClient = IsServer ? "Server" : "Client"; | ||
if (NetworkObject.IsPlayerObject) | ||
{ | ||
gameObject.name = NetworkManager.LocalClientId == OwnerClientId ? $"{objectOriginalName}({OwnerClientId})-Local{objectOriginalName}" : | ||
$"{objectOriginalName}({OwnerClientId})-On{serverOrClient}({NetworkManager.LocalClientId})"; | ||
} | ||
else | ||
{ | ||
gameObject.name = $"{objectOriginalName}({NetworkObjectId})-On{serverOrClient}({NetworkManager.LocalClientId})"; | ||
} | ||
|
||
// Don't add the player objects to the global list of NetworkObjects | ||
if (!NetworkObject.IsPlayerObject) | ||
{ | ||
NetcodeIntegrationTest.RegisterNetworkObject(NetworkObject); | ||
} | ||
m_IsRegistered = true; | ||
} | ||
} | ||
|
||
protected void DeRegisterNetworkObject() | ||
{ | ||
if (m_IsRegistered) | ||
{ | ||
NetcodeIntegrationTest.DeregisterNetworkObject(m_CurrentOwner, m_CurrentNetworkObjectId); | ||
m_IsRegistered = false; | ||
} | ||
} | ||
|
||
public override void OnLostOwnership() | ||
{ | ||
DeRegisterNetworkObject(); | ||
RegisterAndLabelNetworkObject(); | ||
} | ||
|
||
public override void OnGainedOwnership() | ||
{ | ||
DeRegisterNetworkObject(); | ||
RegisterAndLabelNetworkObject(); | ||
} | ||
|
||
public override void OnNetworkDespawn() | ||
{ | ||
DeRegisterNetworkObject(); | ||
} | ||
|
||
public override void OnDestroy() | ||
{ | ||
if (m_NetworkObject != null) | ||
{ | ||
DeRegisterNetworkObject(); | ||
// This is required otherwise it will try to continue to update the NetworkBehaviour even if | ||
// it has been destroyed (most likely integration test specific) | ||
if (m_NetworkObject.ChildNetworkBehaviours != null && m_NetworkObject.ChildNetworkBehaviours.Contains(this)) | ||
{ | ||
NetworkObject.ChildNetworkBehaviours.Remove(this); | ||
} | ||
m_NetworkObject = null; | ||
} | ||
base.OnDestroy(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.