Skip to content

test: cover the Service API in the integration suite - #527

Merged
kke merged 4 commits into
mainfrom
test/service-integration
Nov 24, 2026
Merged

kke merged 4 commits into
mainfrom
test/service-integration

Conversation

@kke

@kke kke commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Adds an integration test that installs a small service and runs it through the Service API: enable, start, script path, logs, log streaming, environment, restart, stop and disable. systemd hosts use a unit file. OpenRC hosts use an openrc-run script with supervise-daemon log files.

The Logs and StreamLogs subtests are expected to fail on the Alpine hosts until #525 is merged. The other subtests should pass everywhere.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Approval is blocked by critical issues: the unconditional Alpine OpenRC log assertion fails until its prerequisite lands, and fixed system-wide test paths can overwrite and delete pre-existing host artifacts.

3 open issues
What changed in this PR

Adds integration coverage for the Service API across systemd and OpenRC hosts, including service installation, lifecycle operations, environment handling, script discovery, and log access.

Changes:

  • Adds systemd unit and OpenRC service fixtures.
  • Tests enable, start, restart, stop, disable, script paths, environment updates, and log retrieval/streaming.
  • Adds cleanup for service files, logs, binaries, and related state.
File Description
test/​rig_test.go Adds the cross-platform Service API integration test and supporting systemd/OpenRC service fixtures.

Review effort: Lite

Comment thread test/rig_test.go Resolved
Comment thread test/rig_test.go Resolved
Comment thread test/rig_test.go Resolved
kke added 2 commits November 24, 2026 10:23
Install a service that writes to stdout and stderr every second and
run it through Enable, Start, ScriptPath, Logs, StreamLogs,
SetEnvironment, Restart, Stop and Disable. systemd hosts get a unit
file. OpenRC hosts get an openrc-run script that sends the output to
log files with supervise-daemon.

Logs and StreamLogs fail on the Alpine hosts until OpenRC supports
them.

Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
A fixed name could overwrite a service that is already on the host,
and the cleanup would then remove it. StreamLogs is now also checked
for the stderr line, as Logs already was.

Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
@kke
kke force-pushed the test/service-integration branch from 18c8a27 to 6bd443f Compare November 24, 2026 08:24
@kke
kke requested a lite review from Copilot November 24, 2026 08:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An active moderate finding remains because a failed service-manager detection can abort the test before cleanup is registered, leaving files on the integration host.

1 open issue
3 resolved since last review

Review effort: Lite

Comment thread test/rig_test.go Resolved
A failed service lookup aborted the test after the program and the
service definition were written but before the cleanup was in place.

Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Active moderate and critical findings remain in test/rig_test.go: OpenRC detection can select an invalid provider, and the Alpine integration reaches unsupported log handling that deterministically fails.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Match OpenRC detection to the provider’s init-system check

test/​rig_test.go:532

Using command -v openrc-run here does not match the provider's OpenRC detection. On a host that has the OpenRC scripts installed but is booted under another init system, this selects the OpenRC setup and then h.Service(name) fails instead of skipping the test. Please use the same openrc-init//etc/inittab check as initsystem.RegisterOpenRC.

1 resolved since last review

Review effort: Lite

The test checked for systemd and OpenRC with commands of its own,
which did not match the checks of the providers. A host with OpenRC
installed but booted under another init system got an OpenRC
definition, and the service lookup then failed. The test now asks
the client which init system it detected.

Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The privileged remote integration and its systemd/OpenRC, journald, log-handling, escalation, and cleanup behavior require execution across the supported host matrix, which static review cannot validate.

No open issues 🎉

Review effort: Lite

@kke
kke merged commit e5aade1 into main Nov 24, 2026
18 checks passed
@kke
kke deleted the test/service-integration branch November 24, 2026 11:06
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