Skip to content

Commit 2eafbf5

Browse files
committed
Make port configurable
1 parent b4c85ee commit 2eafbf5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/DistributedAuthorityCodecTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ internal class DistributedAuthorityCodecTests : NetcodeIntegrationTest
3030
private NetworkManager Client => m_ClientNetworkManagers[0];
3131

3232
private string m_TransportHost = Environment.GetEnvironmentVariable("NGO_HOST") ?? "127.0.0.1";
33-
private const int k_TransportPort = 7777;
33+
private static readonly ushort k_TransportPort = GetPortToBind(7777);
3434
private const int k_ClientId = 0;
3535

36+
private static ushort GetPortToBind(ushort defaultPort)
37+
{
38+
var value = Environment.GetEnvironmentVariable("ECHO_SERVER_PORT");
39+
return ushort.TryParse(value, out var configuredPort) ? configuredPort : defaultPort;
40+
}
41+
3642
private GameObject m_SpawnObject;
3743

3844
internal class TestNetworkComponent : NetworkBehaviour

0 commit comments

Comments
 (0)