mirror of
https://github.com/ConvoyPanel/panel.git
synced 2026-05-09 00:17:22 +08:00
25 lines
606 B
PHP
25 lines
606 B
PHP
<?php
|
|
|
|
use Convoy\Services\Nodes\ServerRateLimitsSyncService;
|
|
use Illuminate\Http\Client\Request;
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
rit('can rate limit servers if over limit', function () {
|
|
Http::fake([
|
|
'*' => Http::response(['data' => 'dummy-upid'], 200),
|
|
]);
|
|
|
|
[$_, $_, $node, $server] = createServerModel();
|
|
|
|
$server->update([
|
|
'bandwidth_usage' => 8192,
|
|
'bandwidth_limit' => 4092,
|
|
]);
|
|
|
|
app(ServerRateLimitsSyncService::class)->handle($node);
|
|
|
|
Http::assertSent(function (Request $request) {
|
|
return $request->method() === 'POST';
|
|
});
|
|
});
|