Closed InfluxOW closed 7 months ago
I'm not sure what you wish to achieve here? You're preventing all stray requests and then invoking concurrently
. That won't ever work since concurrently
dispatches requests. These two cannot be combined unless you instruct the Http::fake
to mock the /octane/resolve-tasks
request.
@driesvints
I understand that concurrently
dispatches requests. But it dispatches requests within the same app. It doesn't make any third-party requests.
Doesn't it seem logical that this example should work?
\Illuminate\Support\Facades\Http::preventStrayRequests();
\Laravel\Octane\Facades\Octane::concurrently([fn (): int => 1]);
And this one shouldn't?
\Illuminate\Support\Facades\Http::preventStrayRequests();
\Laravel\Octane\Facades\Octane::concurrently([fn () => \Illuminate\Support\Facades\Http::get('example.com'))]);
For me, it seams reasonable to fake only example.com
response. But additional layer of faking /octane/resolve-tasks
seems overwhelming.
No because Swoole's HTTP task dispatcher doesn't operates on the same app url. It dispatches either from a custom host or 127.0.0.1
on its specific port.
Octane Version
2.3.8
Laravel Version
11.5.0
PHP Version
8.3
What server type are you using?
Swoole
Server Version
Laravel Sail
Database Driver & Version
No response
Description
I'm not sure if it's more of a Laravel or Laravel Octane issue, but I decided to start here. Using
Http::preventStrayRequests()
andOctane::concurrently(<tasks>)
in a test leads toRuntimeException: Attempted request to [http://0.0.0.0/octane/resolve-tasks] without a matching fake
. I guess, Octane-related routes should be excluded from routes with matching fakes or you should have an option to allow performing real requests on some routes. Currently, I have to setHttp::allowStrayRequests()
in a tests with actions that usesOctane::concurrently(<tasks>)
under the hood.Steps To Reproduce
Use Laravel Sail.
.env
test