88 lines
5.1 KiB
Gherkin
88 lines
5.1 KiB
Gherkin
Feature: Container-aware update guidance
|
|
|
|
As the owner of a RenewCMS site running in Docker
|
|
I want Settings to say "update by pulling a new image" instead of "Not prepared"
|
|
So that I never see a browser-update flow that cannot work in a container
|
|
|
|
Background:
|
|
Given browser updates need Linux with systemd and the helper that "renewcms enable-browser-updates" configures
|
|
And a binary replaced inside a container is lost when the container is recreated,
|
|
so in a container the update is a new image: "docker compose pull && docker compose up -d"
|
|
And config.Settings gains Container bool, read from the env var RENEWCMS_CONTAINER (default "false", set to "true" by the Dockerfile and docker-compose.yml)
|
|
And RENEWCMS_CONTAINER is added to envDefaults in cmd/server/main.go, to .env.example and to docs/configuration.md; it is not in requiredEnvVars
|
|
And only "true" (case-insensitive) enables container mode; any other value means false
|
|
And the update status use case receives the bool through its constructor from api/dependecyInjection.go; internal/domain/update stays stdlib only
|
|
And the update check, update-status.json and the release feed work unchanged in container mode
|
|
And GET /v1/system/update gains a 13th key, container (bool), after started_at; the other 12 keys are unchanged
|
|
And in container mode can_apply is false for everyone, even if update-helper.json exists in the data directory
|
|
And POST /v1/system/update/download and /restart keep their guards and answer 409 because can_apply is false (existing behaviour, not re-specified)
|
|
And errors stay plain text from http.Error
|
|
And the user approved the copy below and the 13th key on 2026-10-05; docs/design is read-only for agents, so the design files are updated by the user, and the visual gate for container states stays PENDING until a board frame exists
|
|
|
|
Scenario Outline: The status carries the container flag
|
|
Given RENEWCMS_CONTAINER is "<value>"
|
|
When a verified user sends GET /v1/system/update
|
|
Then the JSON key container is <flag>
|
|
|
|
Examples:
|
|
| value | flag |
|
|
| true | true |
|
|
| TRUE | true |
|
|
| false | false |
|
|
| | false |
|
|
| yes | false |
|
|
|
|
Scenario: Container mode disables apply even with a helper
|
|
Given RENEWCMS_CONTAINER is "true" and HelperDetector reports the helper installed
|
|
When the owner sends GET /v1/system/update
|
|
Then can_apply is false and container is true
|
|
And a newer stored result still reports available true, latest and notes
|
|
|
|
Scenario: The check still works in a container
|
|
Given container mode and a feed that reports "v2.9.0-beta" newer than the running "v2.8.0-beta"
|
|
When the owner sends POST /v1/system/update/check
|
|
Then the status is 200 and available is true and the result is stored in update-status.json
|
|
|
|
Scenario Outline: Download and restart are refused in a container
|
|
Given container mode and a stored newer release
|
|
When the owner sends POST <path>
|
|
Then the status is 409 and no job starts and the fetcher and the restart request writer are not called
|
|
|
|
Examples:
|
|
| path |
|
|
| /v1/system/update/download |
|
|
| /v1/system/update/restart |
|
|
|
|
Scenario: Host installs are unchanged
|
|
Given RENEWCMS_CONTAINER is unset
|
|
Then container is false and can_apply follows the helper as before
|
|
And "Not prepared" still shows its "renewcms enable-browser-updates" command
|
|
|
|
Scenario: Settings, owner, container, update available (route /settings)
|
|
Given GET /v1/system/update resolves available true, container true, can_apply false, latest "v2.9.0-beta"
|
|
Then the block uses the "Not prepared" frame's layout: icon info, tone info
|
|
And the title reads "Version 2.9.0-beta is available"
|
|
And the text reads "You have v2.8.0-beta. This site runs in Docker, so it updates by pulling a new image. Run the commands below on the server."
|
|
And a server-command block reads "docker compose pull && docker compose up -d" with the Copy button ("Copied" with a check for 2 s, announced)
|
|
And a link "How to update" with arrow-up-right points to docs/docker.md
|
|
And no Update, Restart or "Check for updates" button is rendered
|
|
And the "renewcms enable-browser-updates" command and its note are not rendered
|
|
|
|
Scenario: Settings, owner, container, up to date
|
|
Given container true and available false
|
|
Then "You're up to date" shows as in the existing Up to date state, the Restart button is not rendered and the container hint is not rendered
|
|
And "Check for updates" is still offered
|
|
|
|
Scenario: Settings, admin, container
|
|
Given the session role is "admin", container true and available true
|
|
Then the existing Admin view shows unchanged ("Only the owner can update RenewCMS.") with no command block
|
|
|
|
Scenario: Settings, non-container, no helper
|
|
Given container false and can_apply false
|
|
Then the existing "Not prepared" state shows unchanged
|
|
|
|
Scenario: The shipped Docker setup turns container mode on
|
|
Given the Dockerfile and docker-compose.yml
|
|
Then both set RENEWCMS_CONTAINER=true
|
|
And docs/docker.md and docs/configuration.md describe the variable
|