···372372 return $info;
373373}
374374375375+# Fail if the given systemd unit is not in the "active" state.
376376+sub requireActiveUnit {
377377+ my ($self, $unit) = @_;
378378+ $self->nest("checking if unit ‘$unit’ has reached state 'active'", sub {
379379+ my $info = $self->getUnitInfo($unit);
380380+ my $state = $info->{ActiveState};
381381+ if ($state ne "active") {
382382+ die "Expected unit ‘$unit’ to to be in state 'active' but it is in state ‘$state’\n";
383383+ };
384384+ });
385385+}
375386376387# Wait for a systemd unit to reach the "active" state.
377388sub waitForUnit {