Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions features/COVERAGE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# site-command Behat coverage

Suite for `easyengine/site-command` (the `ee site` command and the html site type, plus `ee site php-compat` on php and wp sites). 19 features, 200 scenarios (240 with outlines expanded): main lane 214, `@wp` 15, `@le` 11. Run it the CI way (`.github/workflows/behat.yml`): the files are copied into a core checkout's `features/` and core's `vendor/bin/behat` runs from the core root as root.
Suite for `easyengine/site-command` (the `ee site` command and the html site type, plus `ee site php-compat` on php and wp sites). 19 features, 205 scenarios (245 with outlines expanded): main lane 219, `@wp` 15, `@le` 11. Run it the CI way (`.github/workflows/behat.yml`): the files are copied into a core checkout's `features/` and core's `vendor/bin/behat` runs from the core root as root.

## Tags

| Tag | Scenarios | Meaning |
|---|---|---|
| (none of the tags below) | 187 | Local only: `*.test` sites, no public DNS, no remote storage, no global restarts. This is the default safe run. The php-compat scenarios pull the scanner image from Docker Hub when it isn't present. |
| (none of the tags below) | 192 | Local only: `*.test` sites, no public DNS, no remote storage, no global restarts. This is the default safe run. The php-compat scenarios pull the scanner image from Docker Hub when it isn't present. |
| `@known-bug` | 0 | Scenarios that expose open bugs are kept outside this suite and come back with their fixes. The CI lanes still exclude the tag. |
| `@destructive` | 12 | Restarts the GLOBAL nginx-proxy (proxy cache) or runs `ssl-renew --all` (refuses to start when an enabled LE site that isn't the suite's exists). Every scenario leaves the proxy running. |
| `@remote` | 10 | Uses the REAL rclone remote (`rclone-path` in config.yml). Touches only `<rclone-path>/bh-site-command-*`: the rclone path is listed first and only listed suite directories are purged (per site before a scenario, all of them after the feature). |
Expand Down Expand Up @@ -225,7 +225,7 @@ Every scan scenario needs core's `img-versions.json` to pin `easyengine/compat-s
| Item | Status | Scenarios |
|---|---|---|
| `--format=json` on a wp and a php site: one-line summary, exit 0, no findings | covered (wp part @wp) | compat: The JSON summary of a WordPress site; The JSON summary of a php site |
| Table: verdict line first ("Not safe", or "No PHP <v> problems found in …" scoped to what was checked; never "Safe to upgrade"), every error with file, line and sniff, static-analysis line last | covered ("Not safe" part @wp) | compat: The table starts with the verdict line...; The table of a php site without errors says what was checked, never "safe" |
| Table: the estimate first ("Estimating …", the estimate, "Checking …"), then the verdict line ("Not safe", or "No PHP <v> problems found in …" scoped to what was checked; never "Safe to upgrade"), every error with file, line and sniff, static-analysis line last | covered ("Not safe" part @wp) | compat: The table says how long the check should take, then starts with the verdict line...; The table of a php site without errors says what was checked, never "safe" |
| WordPress core gate: version.php read, too-old core is "Not safe", undeclared PHP (8.6) is "Can't confirm", JSON `wordpress` object | covered @wp | compat: A WordPress site's verdict covers what was checked, and core by its version |
| "Can't confirm" verdict line from unchecked files | not covered | needs a file uid 33 can't read; the scanner side is in the dockerfiles fixture test |
| "Can't confirm" from the php container a user compose file changes: a PHP config directory mounted over /usr/local/etc/php with a prepend in its conf.d, `group_add`, and a `user:` with another group | covered @wp | compat: PHP config, extra groups and another group a user compose file gives the php container make the verdict "can't confirm" |
Expand All @@ -240,6 +240,11 @@ Every scan scenario needs core's `img-versions.json` to pin `easyengine/compat-s
| html site refused, bad or missing `--php` (dispatcher and command checks), flags `--cancel` doesn't take | covered | compat: An html site is refused; A bad --php value, a missing one, or a flag --cancel does not take is rejected (outline) |
| `busy` while a scan of the same site runs (json and table) | covered | compat: A second check while one of the same site runs reports busy |
| `--estimate` while a check of the same site runs: `busy` with `estimate: true` | covered | compat: An estimate while a check of the same site runs is busy, and --cancel stops that check |
| Table check whose estimate fails: one line, then the check runs | covered | compat: A table check whose estimate fails says so and checks anyway |
| Table check whose estimate times out: its container is removed before the check starts | covered | compat: A table check whose estimate times out removes the estimate container, then checks |
| `ee site delete` during the estimate a table check runs first: the check reports `cancelled` | covered | compat: Deleting a site during the estimate a table check runs first stops the check |
| `--cancel` during the estimate a table check runs first: `cancelled`, no estimate container left | covered | compat: --cancel during the estimate a table check runs first stops the check |
| On a terminal: the self-updating elapsed-time line, cleared before the result | covered | compat: On a terminal a table check shows the time elapsed, and clears that line before the result |
| `--timeout`: `tool_error`, exit 0, no temporary directory or container left | covered | compat: No temporary directory or container is left behind... |
| Leftover temporary directory and stopped container of a killed run removed | covered | compat: A leftover of a killed check is removed by the next check |
| `--cancel`: `not_running` with nothing running (json and table); `cancelled` for a running scan container, which is removed with the temporary directory, and a normal check afterwards; a stopped leftover removed; a missing site refused ("Could not find the site…") | covered | compat: --cancel with nothing running says so; --cancel stops the container of a check and removes its temporary directory; --cancel removes the stopped container and directory of a killed check; --cancel of a site that doesn't exist is refused |
Expand All @@ -254,7 +259,7 @@ DB and container migrations under `migrations/` (core upgrade flow), the AcmePhp

## Coverage estimate

Counting the rows above as items: 144 items, 109 covered, 1 partial, 34 not covered (8 of them, marked "not covered yet", are open bugs whose scenarios come back with their fixes), i.e. about 76% of the inventory. Every user-facing subcommand and option of the html type has at least one scenario except `ssl-renew --force`, `clone --ssl/--wildcard` and a live `share`.
Counting the rows above as items: 149 items, 114 covered, 1 partial, 34 not covered (8 of them, marked "not covered yet", are open bugs whose scenarios come back with their fixes), i.e. about 76% of the inventory. Every user-facing subcommand and option of the html type has at least one scenario except `ssl-renew --force`, `clone --ssl/--wildcard` and a live `share`.

## Known bugs left out

Expand Down
8 changes: 8 additions & 0 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,14 @@ private static function purge_compat_leftovers()
EE::launch( 'docker rm -f ' . escapeshellarg( $name ), false, true );
}
}
// Estimate containers have no name: a killed run can leave one, even paused, which the next pause step would trip over.
$estimates = EE::launch( "docker ps -a --format '{{.ID}} {{.Label \"ee-php-compat-estimate-site\"}}' --filter label=ee-php-compat-estimate-site", false, true );
foreach ( array_filter( explode( "\n", trim( $estimates->stdout ) ) ) as $line ) {
list( $id, $site ) = explode( ' ', "$line ", 2 );
if ( 0 === strpos( trim( $site ), self::SITE_PREFIX ) ) {
EE::launch( 'docker rm -f ' . escapeshellarg( $id ), false, true );
}
}
// A directory whose container is still there may still be in use: keep it and say so.
$ps = EE::launch( "docker ps -a --format '{{.Names}}'", false, true );
if ( 0 !== $ps->return_code ) {
Expand Down
Loading