Migrates many tests to errors_test

This commit is contained in:
Tai Groot
2021-05-16 22:00:50 -07:00
parent dd48d610dc
commit e941c90f0d
6 changed files with 188 additions and 85 deletions

View File

@@ -144,6 +144,9 @@ func IsFailed(ctx context.Context, unit string, opts Options) (bool, error) {
// Mask one or more units, as specified on the command line. This will link
// these unit files to /dev/null, making it impossible to start them.
//
// Notably, Mask may return ErrDoesNotExist if a unit doesn't exist, but it will
// ocntinue masking anyway.
func Mask(ctx context.Context, unit string, opts Options) error {
var args = []string{"mask", "--system", unit}
if opts.UserMode {
@@ -213,6 +216,11 @@ func Stop(ctx context.Context, unit string, opts Options) error {
// Unmask one or more unit files, as specified on the command line.
// This will undo the effect of Mask.
//
// In line with systemd, Unmask will return ErrDoesNotExist if the unit
// doesn't exist, but only if it's not already masked.
// If the unit doesn't exist but it's masked anyway, no error will be
// returned. Gross, I know. Take it up with Poettering.
func Unmask(ctx context.Context, unit string, opts Options) error {
var args = []string{"unmask", "--system", unit}
if opts.UserMode {