1#!/bin/sh
2#
3# This test uses two pools, two tapes, and
4#  an autochanger. Note, the Director has three Pools in its
5#  conf:  Default, Full, and Inc.  Default is used in the
6#  NightlySave job by default.  What is backed up is what
7#  is in ${cwd}/tmp/file-list.
8#
9TestName="two-pool-changer"
10JobName=twopoolchanger
11. scripts/functions
12
13require_tape_drive
14require_autochanger
15
16scripts/cleanup
17scripts/copy-2tape-confs
18echo "Prepare two tapes"
19scripts/prepare-two-tapes
20echo "Done prepare two tapes"
21
22
23
24# Directory to backup.
25# This directory will be created by setup_data().
26BackupDirectory="${tmp}/data"
27
28# Use a tgz to setup data to be backuped.
29# Data will be placed at "${tmp}/data/".
30# TODO: us a larger data set.
31setup_data data/small.tgz
32
33# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
34# Make a relatively large backup set multiple times the source directory
35echo "${BackupDirectory}" >${tmp}/file-list
36echo "${BackupDirectory}" >>${tmp}/file-list
37echo "${BackupDirectory}" >>${tmp}/file-list
38echo "${BackupDirectory}" >>${tmp}/file-list
39echo "${BackupDirectory}" >>${tmp}/file-list
40
41
42start_test
43
44# Write out bconsole commands to a file
45cat <<END_OF_DATA >tmp/bconcmds
46@$out /dev/null
47messages
48@$out tmp/log1.out
49label storage=tape volume=TestVolume001 slot=$SLOT1 pool=Full drive=$DRIVE1
50label storage=tape volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1
51list volumes
52@# Start job with Client run before and sleep
53run job=NightlySave1 level=Full pool=Default yes
54run job=NightlySave1 level=Full pool=Default yes
55#run job=NightlySave1 level=Full pool=Default yes
56@# wait between starting jobs
57@sleep 60
58setdebug level=190 storage=tape
59run job=NightlySave2 level=Full pool=Full yes
60run job=NightlySave2 level=Full pool=Full yes
61#run job=NightlySave2 level=Full pool=Full yes
62@sleep 10
63status storage=tape
64messages
65wait
66list volumes
67messages
68@#
69@# now do a restore
70@#
71@$out tmp/log2.out
72restore where=${cwd}/tmp/bareos-restores select all storage=tape done
73yes
74wait
75messages
76quit
77END_OF_DATA
78
79run_bareos
80check_for_zombie_jobs storage=tape
81stop_bareos
82
83check_two_logs
84check_restore_diff
85end_test
86