@@ -28,19 +28,6 @@ public DistributedAuthorityConnectionTest() : base(NetworkTopologyTypes.Distribu
2828
2929 private GameObject m_SpawnObject ;
3030
31- internal class TestNetworkComponent : NetworkBehaviour
32- {
33- }
34-
35- /// <summary>
36- /// Add any additional components to default player prefab
37- /// </summary>
38- protected override void OnCreatePlayerPrefab ( )
39- {
40- m_PlayerPrefab . AddComponent < TestNetworkComponent > ( ) ;
41- base . OnCreatePlayerPrefab ( ) ;
42- }
43-
4431 /// <summary>
4532 /// Modify NetworkManager instances for settings specific to tests
4633 /// </summary>
@@ -50,13 +37,12 @@ protected override void OnServerAndClientsCreated()
5037 {
5138 client . NetworkConfig . EnableSceneManagement = false ;
5239 client . NetworkConfig . AutoSpawnPlayerPrefabClientSide = true ;
53- }
54- SessionOwner . LogLevel = LogLevel . Developer ;
5540
56- // Validate we are in distributed authority mode with client side spawning and using CMB Service
57- Assert . True ( SessionOwner . NetworkConfig . NetworkTopology == NetworkTopologyTypes . DistributedAuthority , "Distributed authority topology is not set!" ) ;
58- Assert . True ( SessionOwner . AutoSpawnPlayerPrefabClientSide , "Client side spawning is not set!" ) ;
59- Assert . True ( SessionOwner . CMBServiceConnection , "CMBServiceConnection is not set!" ) ;
41+ // Validate we are in distributed authority mode with client side spawning and using CMB Service
42+ Assert . True ( client . NetworkConfig . NetworkTopology == NetworkTopologyTypes . DistributedAuthority , "Distributed authority topology is not set!" ) ;
43+ Assert . True ( client . CMBServiceConnection , "CMBServiceConnection is not set!" ) ;
44+
45+ }
6046
6147 // Create a prefab for creating and destroying tests (auto-registers with NetworkManagers)
6248 m_SpawnObject = CreateNetworkObjectPrefab ( "TestObject" ) ;
@@ -94,8 +80,8 @@ private static string GetAddressToBind()
9480 return Dns . GetHostAddresses ( value ) . First ( ) . ToString ( ) ;
9581 }
9682
97- [ Test ]
98- public void CanConnectToServer ( )
83+ [ UnityTest ]
84+ public IEnumerator CanConnectToServer ( )
9985 {
10086 var address = Dns . GetHostAddresses ( k_TransportHost ) . First ( ) ;
10187 var endpoint = NetworkEndpoint . Parse ( address . ToString ( ) , k_TransportPort ) ;
@@ -117,6 +103,9 @@ public void CanConnectToServer()
117103 }
118104
119105 driver . Disconnect ( connection ) ;
106+
107+ // Ensure the rust server fully times out and disconnects
108+ yield return new WaitForSeconds ( 2f ) ;
120109 }
121110
122111
0 commit comments