nixos.tests.printing: fix for new CUPS version

It looks like now queue is not immediately cleared from cancelled jobs.
Instead, files like "c00001" are left alongside "d00001-001", and
cleanup happens at some later point of time. Also, all new jobs are
assigned consecutive numbers now (00002, 00003 etc.). So when
original d00001 file is finally cleaned, it breaks the test. Fixed
by checking for any "d*" file inside the queue and cleaning it by
ourselves to ensure that each job works correctly.

Changed files
+4 -1
nixos
tests
+4 -1
nixos/tests/printing.nix
···
# (showing that the right filters have been applied). Of
# course, since there is no actual USB printer attached, the
# file will stay in the queue forever.
-
$server->waitForFile("/var/spool/cups/d00001-001");
$server->sleep(10);
$server->succeed("lpq -a") =~ /$fn/ or die;
···
Machine::retry sub {
return 1 if $server->succeed("lpq -a") =~ /no entries/;
};
};
}
'';
···
# (showing that the right filters have been applied). Of
# course, since there is no actual USB printer attached, the
# file will stay in the queue forever.
+
$server->waitForFile("/var/spool/cups/d*-001");
$server->sleep(10);
$server->succeed("lpq -a") =~ /$fn/ or die;
···
Machine::retry sub {
return 1 if $server->succeed("lpq -a") =~ /no entries/;
};
+
# The queue is empty already, so this should be safe.
+
# Otherwise, pairs of "c*"-"d*-001" files might persist.
+
$server->execute("rm /var/spool/cups/*");
};
}
'';