]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/py-sample-test.py
authorAlain Spineux <alain@baculasystems.com>
Wed, 2 Sep 2020 13:31:32 +0000 (15:31 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 1 Mar 2022 14:36:18 +0000 (15:36 +0100)
This commit is the result of the squash of the following main commits:

Author: Alain Spineux <alain@baculasystems.com>
Date:   Fri Dec 23 11:01:56 2016 +0100

    regress: tweak chmox a+x of some test

Author: Alain Spineux <alain@baculasystems.com>
Date:   Fri Oct 21 16:11:47 2016 +0200

    regress: make regress python friendly

    - modules like bconsole.py and blab.py goes in regress/scrips
    - regress/tests/regress.py is a helper that load modules in scripts
      without boring with librady path
    - py-sample-test.py is the first sample
    - add new objects lab.{fd,sd,dir} that are manage the related Daemon
    - add lab.sd.dde of class DDE that provides some basic helper for the DDE
    - file FileReader can search a log  or trace file
    - lab.GetVolume(volname) return information about a volume

regress/tests/py-sample-test.py [new file with mode: 0755]

diff --git a/regress/tests/py-sample-test.py b/regress/tests/py-sample-test.py
new file mode 100755 (executable)
index 0000000..6aea364
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/env python3
+from regress import blab
+
+lab=blab.Lab(testname='py-sample-test', shell=True)
+lab.Shell('scripts/copy-confs')
+lab.Shell('start_test')
+lab.StartBacula()
+
+lab.BconsoleScript("""\
+@{out} /dev/null
+messages
+@{out} {tmp}/log1.out
+setdebug level=4 storage=File1
+label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
+show job=BackupClient1
+run job=BackupClient1 yes
+@sleep 1
+status storage=File1
+@sleep 1
+status storage=File1
+wait
+messages
+@#
+@# now do a restore
+@#
+@{out} {tmp}/log2.out
+setdebug level=4 storage=File1
+restore where={tmp}/bacula-restores select all done
+yes
+wait
+messages
+quit
+""")
+
+lab.Shell('check_for_zombie_jobs storage=File1')
+lab.Shell('stop_bacula')
+
+lab.Shell('check_two_logs')
+lab.Shell('check_restore_diff')
+lab.Shell('end_test')
+lab.shell.Close()