]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
cloud: test default object tier
authornorbert.bizet <norbert.bizet@baculasystems.com>
Tue, 26 Jul 2022 09:44:58 +0000 (05:44 -0400)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:58 +0000 (13:56 +0200)
regress/tests/cloud-object-tier-test [new file with mode: 0755]

diff --git a/regress/tests/cloud-object-tier-test b/regress/tests/cloud-object-tier-test
new file mode 100755 (executable)
index 0000000..1c9a29f
--- /dev/null
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# Copyright (C) 2000-2021 Kern Sibbald
+# Copyright (C) 2021-2022 Bacula Systems SA
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Cloud test. We run backups and restore with the "truncate cache" command in-between
+#
+TestName="cloud-object-tier-test"
+JobName=NightlySave
+. scripts/functions
+
+require_cloud
+
+#config is required for cloud cleanup
+scripts/copy-test-confs
+scripts/cleanup
+
+FORCE_FILE_SET=${FORCE_FILE_SET:-"${cwd}/build"}
+echo "$FORCE_FILE_SET" >${cwd}/tmp/file-list
+
+start_test
+
+$bperl -e 'add_attribute("$conf/bacula-sd.conf", "MaximumPartSize", "10000000", "Device")'
+$bperl -e 'add_attribute("$conf/bacula-sd.conf", "MaximumUploadBandwidth", "4MB/s", "Cloud")'
+$bperl -e 'add_attribute("$conf/bacula-sd.conf", "MaximumDownloadBandwidth", "4MB/s", "Cloud")'
+
+#   {"S3Standard", S3_STANDARD},   
+#   {"S3StandardIA", S3_STANDARD_IA},
+#   {"S3IntelligentTiering", S3_INTELLIGENT_TIERING},
+#   {"S3OneZoneIA", S3_ONE_ZONE_IA},
+#   {"S3GlacierInstantRetrieval", S3_GLACIER_INSTANT_RETRIEVAL},
+#   {"S3GlacierFlexibleRetrieval", S3_GLACIER_FLEXIBLE_RETRIEVAL},
+#   {"S3GlacierDeepArchive", S3_GLACIER_DEEP_ARCHIVE},
+#   {"S3Rrs", S3_RRS},
+
+declare -A tiers
+tiers[0]=S3Standard 
+tiers[1]=S3StandardIA 
+tiers[2]=S3IntelligentTiering
+tiers[3]=S3OneZoneIA
+tiers[4]=S3GlacierInstantRetrieval
+tiers[5]=S3GlacierFlexibleRetrieval
+tiers[6]=S3GlacierDeepArchive
+tiers[7]=S3Rrs
+                  
+test_tier()
+{
+#$1 : tier_index
+#$2 : tier value
+
+echo "  == checking tier[$1]: $2 =="
+
+$bperl -e 'add_attribute("$conf/bacula-sd.conf", "ObjectsDefaultTier", "'$2'", "Cloud")'
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out ${cwd}/tmp/log$1.out
+setdebug tags=cloud level=50 trace=1 storage
+label storage=File volume=Vol$1
+END_OF_DATA
+
+# do label
+run_bacula
+
+#cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+#run job=$JobName level=Full yes
+#wait
+#messages
+#END_OF_DATA
+
+#run_bconsole
+
+sleep 2
+check_for_zombie_jobs storage=File 
+stop_bacula
+
+# must check if the versioned part has been cleaned up
+grep "objects_default_tier: $1" $working/*-sd.trace > /dev/null
+if test $? -ne 0; then
+    echo "Error: could not find correct tier $2"
+    estat=1
+else 
+    echo "tier $2=$1 OK."
+fi
+}
+
+estat = 0
+
+for key in "${!tiers[@]}"; do test_tier $key ${tiers[$key]}; done
+
+end_test