File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Assets/Tests/Runtime/RateLimit Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,14 @@ public UniTask<int> AsyncServerRpcWithRateLimit()
3333 AsyncCount ++ ;
3434 return UniTask . FromResult ( AsyncCount ) ;
3535 }
36+
37+ public int UnattributedCount ;
38+
39+ [ ServerRpc ( requireAuthority = false ) ]
40+ public void UnattributedRpc ( )
41+ {
42+ UnattributedCount ++ ;
43+ }
3644 }
3745
3846 public class RpcRateLimitTests : ClientServerSetup < RpcRateLimitBehaviour >
@@ -173,6 +181,20 @@ public IEnumerator RpcDoesNotRefillBeforeInterval() => UniTask.ToCoroutine(async
173181
174182 Assert . That ( serverComponent . Count , Is . EqualTo ( 2 ) , "Call should be dropped because interval hasn't accumulated enough time for a refill" ) ;
175183 } ) ;
184+
185+ [ UnityTest ]
186+ public IEnumerator RpcWithoutAttributeIsNotRateLimited ( ) => UniTask . ToCoroutine ( async ( ) =>
187+ {
188+ for ( int i = 0 ; i < 1000 ; i ++ )
189+ {
190+ clientComponent . UnattributedRpc ( ) ;
191+ }
192+
193+ await UniTask . Delay ( 100 ) ; // adjust delay if needed
194+
195+ Assert . That ( serverComponent . UnattributedCount , Is . EqualTo ( 1000 ) , "RPC without attribute should not be rate limited" ) ;
196+ Assert . That ( serverPlayer . ErrorFlags , Is . Not . EqualTo ( PlayerErrorFlags . RateLimit ) ) ;
197+ } ) ;
176198 }
177199
178200 public class RpcRateLimitHostTests : HostSetup < RpcRateLimitBehaviour >
You can’t perform that action at this time.
0 commit comments