Commit Graph
2 Commits
Author SHA1 Message Date
DarkZmaj 13d7dfa819 Make the telemetry scheduler test independent of other nodes in the database (#7249)
## Problem

`Tests\Integration\Console\SchedulerTest` (telemetry is scheduled and
sent only when enabled, dataset true) fails when the whole integration
suite runs, with `Failed asserting that actual size 22 matches expected
size 2`. It passes when the file is run on its own.

## Reproduction

Run `vendor/bin/pest tests/Integration` on a fresh checkout of the 2.0
development branch with the settings from `.env.ci` (it fails the same
way on Linux with PHP 8.3 and 8.4 against MariaDB 11 and MySQL 8, and on
Windows). Run `vendor/bin/pest
tests/Integration/Console/SchedulerTest.php` alone and it passes.

## Root cause

The test creates one node and then asserts that exactly two HTTP
requests were recorded: the telemetry request and the request for that
node. When the scheduler test runs inside the full suite, other
integration tests have already left committed node rows in the database
(21 nodes existed when the test ran). The telemetry job fetches system
information from every node, so each of those nodes adds another
request. Only the telemetry URL was faked, so the extra requests were
real outbound connection attempts to the random addresses of the
leftover factory nodes.

## Fix

* Fake every other URL with an empty successful response, so the test
can never make real network requests.
* Assert what the test is about, which is that exactly one telemetry
request is sent, instead of the total number of requests. The existing
assertion that the telemetry payload contains the created node is kept.

## Testing

* `vendor/bin/pest tests/Integration/Console/SchedulerTest.php` passes.
* The full `vendor/bin/pest tests/Integration` run no longer reports
this test as failed (on Windows the remaining failures there come from
missing `pdo_sqlite` and POSIX file modes and are unrelated).

## Compatibility considerations

Test only change. No application code, configuration or behaviour is
touched.
2026-10-06 22:47:23 -04:00
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00