torture/spoolss: cleanup print_job_enum test jobs
authorDavid Disseldorp <ddiss@samba.org>
Wed, 29 Oct 2014 10:54:19 +0000 (11:54 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 29 Oct 2014 13:31:52 +0000 (14:31 +0100)
Purge print queue on startup to ensure that the test is not affected by
jobs queued for prior tests. Also, empty the queue at the end of the
test to play nice with others.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Oct 29 14:31:52 CET 2014 on sn-devel-104

source4/torture/rpc/spoolss.c

index dea55491ec14526eb33583b858358ab119edcd84..20e86fc16a733523fdf5ca490a6bba8e8fc93957 100644 (file)
@@ -8867,6 +8867,11 @@ static bool test_print_job_enum(struct torture_context *tctx,
                test_PausePrinter(tctx, b, &t->handle),
                "failed to pause printer");
 
+       /* purge in case of any jobs from previous tests */
+       torture_assert(tctx,
+               test_printer_purge(tctx, b, &t->handle),
+               "failed to purge printer");
+
        /* enum before jobs, valid level */
        torture_assert(tctx,
                       test_EnumJobs_args(tctx, b, &t->handle, 1, WERR_OK,
@@ -8912,6 +8917,11 @@ static bool test_print_job_enum(struct torture_context *tctx,
                                          &count, &info),
                       "EnumJobs with invalid level");
 
+       for (i = 0; i < num_jobs; i++) {
+               test_SetJob(tctx, b, &t->handle, job_ids[i], NULL,
+                           SPOOLSS_JOB_CONTROL_DELETE);
+       }
+
        torture_assert(tctx,
                test_ResumePrinter(tctx, b, &t->handle),
                "failed to resume printer");