@@ -27,6 +27,8 @@ namespace Unity.Netcode.RuntimeTests
2727 /// The tests check if they can bind to a rust echo-server at the given address and port, if all tests are ignored.
2828 /// The rust echo-server is run using `cargo run --example ngo_echo_server -- --port {port}`
2929 /// The C# port can be configured using the environment variable "ECHO_SERVER_PORT"
30+ /// The default behaviour when unity fails to connect to the echo-server is to ignore all tests in this class.
31+ /// This can be overridden by setting the environment variable "ENSURE_CODEC_TESTS" to any value - then the tests will fail.
3032 /// </remarks>
3133 internal class DistributedAuthorityCodecTests : NetcodeIntegrationTest
3234 {
@@ -60,7 +62,7 @@ private static ushort GetPortToBind()
6062 internal class TestNetworkComponent : NetworkBehaviour
6163 {
6264 public NetworkList < int > MyNetworkList = new NetworkList < int > ( new List < int > { 1 , 2 , 3 } ) ;
63- public NetworkVariable < int > MyNetworkVar = new NetworkVariable < int > ( 3 ) ;
65+ public NetworkVariable < int > myNetworkVar = new NetworkVariable < int > ( 3 ) ;
6466
6567 [ Rpc ( SendTo . Authority ) ]
6668 public void TestAuthorityRpc ( byte [ ] _ )
@@ -76,7 +78,15 @@ protected override void OnOneTimeSetup()
7678#else
7779 if ( ! CanConnectToServer ( m_TransportHost , k_TransportPort ) )
7880 {
79- Assert . Ignore ( $ "ignoring DA codec tests because UTP transport cannot connect to the rust echo-server at ${ m_TransportHost } :{ k_TransportPort } ") ;
81+ var shouldFail = Environment . GetEnvironmentVariable ( "ENSURE_CODEC_TESTS" ) ;
82+ if ( ! string . IsNullOrEmpty ( shouldFail ) )
83+ {
84+ Assert . Fail ( $ "Failed to connect to the rust echo-server at { m_TransportHost } :{ k_TransportPort } ") ;
85+ }
86+ else
87+ {
88+ Assert . Ignore ( $ "ignoring DA codec tests because UTP transport cannot connect to the rust echo-server at { m_TransportHost } :{ k_TransportPort } ") ;
89+ }
8090 }
8191#endif
8292 base . OnOneTimeSetup ( ) ;
@@ -250,9 +260,9 @@ public IEnumerator NetworkVariableDelta_WithValueUpdate()
250260 var component = instance . GetComponent < TestNetworkComponent > ( ) ;
251261
252262 var newValue = 5 ;
253- component . MyNetworkVar . Value = newValue ;
263+ component . myNetworkVar . Value = newValue ;
254264 yield return m_ClientCodecHook . WaitForMessageReceived < NetworkVariableDeltaMessage > ( ) ;
255- Assert . AreEqual ( newValue , component . MyNetworkVar . Value ) ;
265+ Assert . AreEqual ( newValue , component . myNetworkVar . Value ) ;
256266 }
257267
258268 [ UnityTest ]
0 commit comments