[otrs-cvs] otrs/scripts/test/Scheduler Run.t,1.14,1.15

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/scripts/test/Scheduler
In directory lancelot:/tmp/cvs-serv28590/scripts/test/Scheduler

Modified Files:
	Run.t 
Log Message:
Added code to stop scheduler before register tasks to re-schedule and start it again after tasks are registered, this to prevent early execution of tasks.

Author: cr

Index: Run.t
===================================================================
RCS file: /home/cvs/otrs/scripts/test/Scheduler/Run.t,v
retrieving revision 1.14
retrieving revision 1.15
diff -2 -u -d -r1.14 -r1.15
--- Run.t	12 Dec 2012 05:41:45 -0000	1.14
+++ Run.t	12 Dec 2012 06:36:22 -0000	1.15
@@ -466,4 +466,44 @@
     );
 
+    # stop scheduler to prevent the early execution of tasks
+    my $ResultMessage = `$Scheduler -a stop -f 1 2>&1`;
+    $Self->Is(
+        $?,
+        0,
+        "Scheduler stop before register re-schedule tasks.",
+    );
+
+    # give some visibility if the test fail when it should not
+    if ($?) {
+        $Self->True(
+            0,
+            "Scheduler stop DETECTED $ResultMessage"
+        );
+    }
+
+    # wait for scheduler to stop
+    WAITSTOP:
+    for my $Wait ( 1 .. $TotalWaitToStop ) {
+        print "Waiting for Scheduler to stop, $Wait seconds\n";
+        sleep 1;
+
+        my $SchedulerStatus = `$Scheduler -a status`;
+
+        if ( $SchedulerStatus =~ m{\ANot}i ) {
+            $Self->True(
+                1,
+                "$Test->{Name} - Scheduler is stoped",
+            );
+            last WAITSTOP;
+        }
+
+        next WAITSTOP if $Wait < $TotalWaitToExecute;
+
+        $Self->True(
+            0,
+            "$Test->{Name} - Scheduler didn't stop after $TotalWaitToExecute seconds!",
+        );
+    }
+
     # register tasks
     my ( @RescheduleFileRemember, @FileRemember );
@@ -522,4 +562,20 @@
     );
 
+    # start scheduler again to execute tasks
+    $ResultMessage = `$Scheduler -a start 2>&1`;
+    $Self->Is(
+        $?,
+        0,
+        "Scheduler start after register re-schedule tasks.",
+    );
+
+    # give some visibility if the test fail when it should not
+    if ($?) {
+        $Self->True(
+            0,
+            "Scheduler start DETECTED $ResultMessage"
+        );
+    }
+
     # wait for scheduler to execute and reschedule the tasks
     WAITRESCHEDULE:
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.