Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testiso: add unit to verify no failed service #3864

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
18 changes: 18 additions & 0 deletions mantle/cmd/kola/testiso.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,23 @@ RequiredBy=coreos-installer.target
# for target system
RequiredBy=multi-user.target`, nmConnectionId, nmConnectionFile)

// Unit to check that if there is any failed service
var verifyNoFailedService = `[Unit]
Description=TestISO Verify No Failed Service
OnFailure=emergency.target
OnFailureJobMode=isolate
After=rpm-ostree-fix-shadow-mode.service
Copy link
Contributor

Choose a reason for hiding this comment

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

Ordering after this specific one feel too specific. If we add another unit in the future it won't be covered.
Maybe we should add a systemd target, order after it and order all our unit before it.
e.g. coreos-sauce.target :)

Before=live-signal-ok.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c '[[ -z $(/usr/bin/systemctl list-units --state failed --quiet) ]]'
[Install]
# for install tests
RequiredBy=coreos-installer.target
# for iso-as-disk
RequiredBy=multi-user.target`

//go:embed resources/iscsi_butane_setup.yaml
var iscsi_butane_config string

Expand Down Expand Up @@ -985,6 +1002,7 @@ func testAsDisk(ctx context.Context, outdir string) (time.Duration, error) {
return 0, err
}

config.AddSystemdUnit("verify-no-failed-service.service", verifyNoFailedService, conf.Enable)
config.AddSystemdUnit("live-signal-ok.service", liveSignalOKUnit, conf.Enable)
config.AddSystemdUnit("verify-no-efi-boot-entry.service", verifyNoEFIBootEntry, conf.Enable)
builder.SetConfig(config)
Expand Down
Loading