shadow_copy2: Add test case for snapprefix and delimiter
authorRajesh Joseph <rjoseph@redhat.com>
Wed, 13 Jul 2016 16:15:27 +0000 (16:15 +0000)
committerStefan Metzmacher <metze@samba.org>
Thu, 28 Jul 2016 08:06:13 +0000 (10:06 +0200)
Add test case for the newly addded option shadow:snapprefix
and shadow:delimiter

Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
selftest/target/Samba3.pm
source3/script/tests/test_shadow_copy.sh

index 5c3f8e150956849b8fc7a2031523b05ebe720d4d..e8f35e365759345332c19ffb8efbbafcdb05de13 100755 (executable)
@@ -1738,6 +1738,31 @@ sub provision($$$$$$$$)
        shadow:snapdir = $shadow_basedir/.snapshots
        shadow:format = \@GMT-%Y.%m.%d-%H_%M_%S-snap
 
+[shadow_fmt4]
+       comment = Testing shadow:snapprefix regex
+       vfs object = shadow_copy2
+       path = $shadow_shrdir
+       read only = no
+       guest ok = yes
+       shadow:mountpoint = $shadow_mntdir
+       shadow:basedir = $shadow_basedir
+       shadow:snapdir = $shadow_basedir/.snapshots
+       shadow:snapprefix = \^s[a-z]*p\$
+       shadow:format = _GMT-%Y.%m.%d-%H.%M.%S
+
+[shadow_fmt5]
+       comment = Testing shadow:snapprefix with delim regex
+       vfs object = shadow_copy2
+       path = $shadow_shrdir
+       read only = no
+       guest ok = yes
+       shadow:mountpoint = $shadow_mntdir
+       shadow:basedir = $shadow_basedir
+       shadow:snapdir = $shadow_basedir/.snapshots
+       shadow:delimiter = \@GMT
+       shadow:snapprefix = [a-z]*
+       shadow:format = \@GMT-%Y.%m.%d-%H.%M.%S
+
 [shadow_wl]
        path = $shadow_shrdir
        comment = previous versions with wide links allowed
index ef1f4e4881a0c7b6175c5afefcbe217752a49966..45d9cf1ef9254343acdf4b9a2ac27f51727dee67 100755 (executable)
@@ -40,6 +40,10 @@ SNAPSHOTS[12]='snap@GMT-2012.11.11-11.40.30'
 SNAPSHOTS[13]='@GMT-2013.11.11-11_40_33-snap'
 SNAPSHOTS[14]='@GMT-2014.11.11-11.40.30'
 SNAPSHOTS[15]='daily@GMT-2015.11.11-11.40.30'
+SNAPSHOTS[16]='snap_GMT-2016.11.11-11.40.30'
+SNAPSHOTS[17]='sysp_GMT-2017.11.11-11.40.30'
+SNAPSHOTS[18]='monthly@GMT-2018.11.11-11.40.30'
+SNAPSHOTS[19]='straps_GMT-2019.11.11-11.40.33'
 
 # build a hierarchy of files, symlinks, and directories
 build_files()
@@ -283,7 +287,7 @@ test_shadow_copy_format()
 
     #delete snapshots from previous tests
     find $WORKDIR -name ".snapshots" -exec rm -rf {} \; 1>/dev/null 2>&1
-    build_snapshots $WORKDIR/$where "$prefix" 10 15
+    build_snapshots $WORKDIR/$where "$prefix" 10 19
 
     testit "$msg - regular file" \
         test_count_versions $share foo $ncopies_allowed || \
@@ -322,5 +326,7 @@ test_shadow_copy_format shadow_fmt0 mount/base share 3 "basic shadow:format test
 test_shadow_copy_format shadow_fmt1 mount/base share 2 "shadow:format with only date"
 test_shadow_copy_format shadow_fmt2 mount/base share 2 "shadow:format with some prefix"
 test_shadow_copy_format shadow_fmt3 mount/base share 2 "shadow:format with modified format"
+test_shadow_copy_format shadow_fmt4 mount/base share 3 "shadow:format with snapprefix"
+test_shadow_copy_format shadow_fmt5 mount/base share 6 "shadow:format with delimiter"
 
 exit $failed