Skip to content

Commit d000e5a

Browse files
committed
Remove can connect test, we can connect. Run only CreateObjectNew()
1 parent b08c482 commit d000e5a

File tree

1 file changed

+0
-48
lines changed

1 file changed

+0
-48
lines changed

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

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -53,54 +53,6 @@ public IEnumerator CreateObjectNew()
5353
AssertOnTimeout("failed to spawn object!");
5454
}
5555

56-
private static readonly string k_TransportHost = GetAddressToBind();
57-
private static readonly ushort k_TransportPort = GetPortToBind();
58-
59-
/// <summary>
60-
/// Configures the port to look for the rust service.
61-
/// </summary>
62-
/// <returns>The port from the environment variable "CMB_SERVICE_PORT" if it is set and valid; otherwise uses port 7789</returns>
63-
private static ushort GetPortToBind()
64-
{
65-
var value = Environment.GetEnvironmentVariable("CMB_SERVICE_PORT");
66-
return ushort.TryParse(value, out var configuredPort) ? configuredPort : (ushort)7789;
67-
}
68-
69-
/// <summary>
70-
/// Configures the address to look for the rust service.
71-
/// </summary>
72-
/// <returns>The address from the environment variable "NGO_HOST" if it is set and valid; otherwise uses "127.0.0.1"</returns>
73-
private static string GetAddressToBind()
74-
{
75-
var value = Environment.GetEnvironmentVariable("NGO_HOST") ?? "127.0.0.1";
76-
return Dns.GetHostAddresses(value).First().ToString();
77-
}
78-
79-
[Test]
80-
public void CanConnectToServer()
81-
{
82-
var address = Dns.GetHostAddresses(k_TransportHost).First();
83-
var endpoint = NetworkEndpoint.Parse(address.ToString(), k_TransportPort);
84-
85-
var driver = NetworkDriver.Create();
86-
var connection = driver.Connect(endpoint);
87-
88-
var start = DateTime.Now;
89-
var ev = Networking.Transport.NetworkEvent.Type.Empty;
90-
while (ev != Networking.Transport.NetworkEvent.Type.Connect)
91-
{
92-
driver.ScheduleUpdate().Complete();
93-
ev = driver.PopEventForConnection(connection, out _, out _);
94-
95-
if (DateTime.Now - start > TimeSpan.FromMilliseconds(100))
96-
{
97-
Assert.Fail("Failed to connect to comb service within time!");
98-
}
99-
}
100-
101-
driver.Disconnect(connection);
102-
}
103-
10456

10557
private bool CheckObjectExists()
10658
{

0 commit comments

Comments
 (0)