]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Add maxwaitime, maxruntime, maxstartdelay non-regression test
authorEric Bollengier <eric@eb.homelinux.org>
Sat, 5 May 2007 13:31:01 +0000 (13:31 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Sat, 5 May 2007 13:31:01 +0000 (13:31 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4704 91ce42f0-d328-0410-95d8-f526ca767f89

regress/scripts/bacula-dir.conf.maxtime.in
regress/tests/maxtime-test [new file with mode: 0755]

index 239d6d7790435582fa585ea4f3270f29e6db4740..88d1172f60620cbf7ce41307e0849959763e8935 100644 (file)
@@ -19,7 +19,7 @@ Director {                            # define myself
   WorkingDirectory = "@working_dir@"
   PidDirectory = "@piddir@"
   SubSysDirectory = "@subsysdir@"
-  Maximum Concurrent Jobs = 4
+  Maximum Concurrent Jobs = 1
   Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3"         # Console password
   Messages = Standard
 }
@@ -50,7 +50,10 @@ FileSet {
    Options {
      read fifo = yes
    }
+   # wait 60s per fifo
    File=/tmp/fifo
+   File=/tmp/fifo2
+   File=/tmp/fifo3
  }
 }
 
@@ -65,8 +68,9 @@ Job {
   Name = "RUN_MAXSTARTDELAY"
   JobDefs = DefaultJob
   FileSet = FS_TESTJOB
-  MaxStartDelay = 1min
+  MaxStartDelay = 30sec
   Pool = PoolA
+  # TODO: il faut un when=
 }
 
 Job {
diff --git a/regress/tests/maxtime-test b/regress/tests/maxtime-test
new file mode 100755 (executable)
index 0000000..685a40f
--- /dev/null
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+#  Test RunScript
+#
+
+TestName="maxtime-test"
+JobName=backup
+
+. scripts/functions
+set_debug 0
+copy_test_confs
+
+rm -f bin/bacula-dir.conf
+rm -f tmp/RUN*log
+/bin/cp -f scripts/bacula-dir.conf.maxtime bin/bacula-dir.conf
+WHEN=$(date '+%Y-%m-%d %H:%M:%S')
+
+echo "${cwd}/build/po" >/tmp/file-list
+
+start_test
+
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
+messages
+label volume=TestVolume001 pool=PoolA
+@$out tmp/RUN_MAXTIME.log
+@# no media => have to wait
+run job=RUN_MAXWAITTIME pool=Default yes
+@sleep 2
+@# storage is used by RUN_MAXWAITTIME => have to wait
+run job=RUN_MAXSTARTDELAY pool=PoolA when="$WHEN" yes
+wait
+messages
+run job=RUN_MAXRUNTIME pool=PoolA yes
+wait
+messages
+st dir
+quit
+END_OF_DATA
+
+(mkfifo /tmp/fifo 
+ mkfifo /tmp/fifo2
+ mkfifo /tmp/fifo3) 2> /dev/null
+
+bin/bacula start
+cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf > /dev/null
+stop_bacula
+
+rm /tmp/fifo /tmp/fifo2 /tmp/fifo3
+
+export dstat=0
+export bstat=0
+export rstat=0
+
+if grep -q -e 'RUN_MAXWAITTIME.* Fatal error: Max wait time exceeded. Job canceled.' tmp/RUN_MAXTIME.log
+then
+    [ "$debug" = 1 ] && echo MAXWAITTIME ok
+else
+   echo "MAXWAITTIME in error"
+   rstat=1
+fi
+
+if grep -q -e 'RUN_MAXSTARTDELAY.* Fatal error: Job canceled because max start delay time exceeded.' tmp/RUN_MAXTIME.log
+then
+    [ "$debug" = 1 ] && echo MAXSTARTDELAY ok
+else
+   echo "MAXSTARTDELAY in error"
+   rstat=1
+fi
+
+if grep -q -e 'RUN_MAXRUNTIME.* Fatal error: Max run time exceeded. Job canceled.' tmp/RUN_MAXTIME.log
+then
+    [ "$debug" = 1 ] && echo MAXRUNTIME ok
+else
+   echo "MAXRUNTIME in error"
+   rstat=1
+fi
+
+end_test
\ No newline at end of file