Skip to content

8670: Rewrite the fixtures to cover all content - #168

Merged
turegjorup merged 5 commits into
developfrom
chore/8670-advisory-fixtures
Oct 26, 2026
Merged

turegjorup merged 5 commits into
developfrom
chore/8670-advisory-fixtures

Conversation

@turegjorup

@turegjorup turegjorup commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Link to ticket

https://leantime.itkdev.dk/#/tickets/showTicket/8670

Description

Rewrite the fixtures so they cover all content with realistic, made-up data. This gives the "not affected" feature in 8670, and every admin page, data to work against.

Changes:

  • One fixture file per area:
    • server.yaml: one server of each type (prod, stg, devops, gpu), on Hetzner and in the DMZ. gpu-01 has never been harvested.
    • site.yaml: detection results of every type (dir, docker, nginx, git, drupal, symfony), with the installations, sites and domains built from them. Each result's data is defined as a YAML parameter and stored as JSON, as the harvester sends it.
    • git.yaml: repos and tags. One repo is checked out on stg at a branch and on prod at a tag.
    • package.yaml: packages, versions, advisories and Drupal modules (previously advisory.yaml).
    • docker.yaml: images and tags, including an official image and one from ghcr.io.
    • project.yaml: projects with code owners, git repos and security contracts, now with fixtures for all three.
    • oidc.yaml and service_certificates.yaml: point at the new sites.
  • tests/DataFixtures/FixturesTest.php checks:
    • every entity, detection type, server type and site type has fixtures;
    • replaying the detection results rebuilds the same installations and sites;
    • each server's latest dir result lists all its installations, so a replay keeps them;
    • the advisory cases from before are still covered;
    • only example data is used: example.com hosts and emails, private and documentation IP ranges, the example-org organization, and CVE ids from 2099.
  • Tests that relied on the old fixtures:
    • SiteFilterTest now uses the shop sites;
    • DirectoryHandlerTest uses the never-harvested gpu-01;
    • PaginationTest tops up from the current server count;
    • the Docker registry filter test checks its own images instead of a row count;
    • the module sort test checks the count order;
    • the link command and linker tests count relative to the fixtures.

Why: the old fixtures had ten random Faker servers and two nginx sites without the detection results behind them. They had no packages, advisories, git repos, Docker images or projects. The shapes follow the production database; the values are all made up.

Checklist

  • My code is covered by test cases.
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

The site filter test now removes the fixture sites it does not set up, the link command test counts from what the fixtures already link, the module sort test checks the order of the counts, and the linker test checks the module is not linked by name rather than not linked at all.
Made-up data shaped like production: a repo checked out at two versions with overlapping advisories, a repo without advisories, a release deployment without a repo, drupal.org and Packagist advisories with and without a CVE, one CVE under two advisory ids, and Drupal modules linked to their Composer packages. A test pins these cases and that only example data is used.
@codecov-commenter

codecov-commenter commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.74%. Comparing base (d139191) to head (6b42c15).
⚠️ Report is 20 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #168      +/-   ##
=============================================
+ Coverage      66.70%   75.74%   +9.03%     
- Complexity      1295     1300       +5     
=============================================
  Files            168      168              
  Lines           3998     3987      -11     
=============================================
+ Hits            2667     3020     +353     
+ Misses          1331      967     -364     
Flag Coverage Δ
unittests 75.74% <ø> (+9.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

One file per area: servers, sites with the detection results behind them, git repos, packages and advisories, Docker images, projects with code owners and security contracts, OIDC and service certificates. Every entity, detection type, server type and site type is represented, with made-up values shaped like production.

FixturesTest pins the scenarios, that replaying the detection results rebuilds the same installations and sites, that each server's dir result lists all its installations, and that only example data is used. Tests tied to the old fixtures now use the shop sites, the never-harvested gpu-01 server or counts relative to the fixtures.
@turegjorup turegjorup changed the title 8670: Add advisory, git repo and Drupal module fixtures 8670: Rewrite the fixtures to cover all content Oct 21, 2026
@turegjorup turegjorup self-assigned this Oct 26, 2026
@turegjorup
turegjorup merged commit a9cac0b into develop Oct 26, 2026
13 checks passed
@turegjorup
turegjorup deleted the chore/8670-advisory-fixtures branch October 26, 2026 15:34
@turegjorup turegjorup mentioned this pull request Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants