@@ -26,7 +26,7 @@ teardown() {
2626}
2727
2828@test "invoking backup with valid config file" {
29- run backup $confdir/valid.conf
29+ run backup -f $confdir/valid.conf
3030 [ "$status" -eq 0 ]
3131 [ "${lines[2]}" = "[OK] S01command" ]
3232 [ "${lines[3]}" = "Start to synchronize files to cloud." ]
@@ -37,25 +37,51 @@ teardown() {
3737}
3838
3939@test "invoking backup with config file that does not exist" {
40- run backup notexists.conf
40+ run backup -f notexists.conf
4141 [ "$status" -eq 1 ]
4242 [ "${lines[0]}" = "Config file not found!" ]
4343}
4444
4545@test "invoking backup with config where buckets is not defined " {
46- run backup $confdir/no-bucket.conf
46+ run backup -f $confdir/no-bucket.conf
4747 [ "$status" -eq 1 ]
4848 [ "${lines[0]}" = "Buckets not defined!" ]
4949}
5050
5151@test "invoking backup with config where backup temp dir is not defined " {
52- run backup $confdir/no-tmpdir.conf
52+ run backup -f $confdir/no-tmpdir.conf
5353 [ "$status" -eq 1 ]
5454 [ "${lines[0]}" = "Backup temp dir not defined!" ]
5555}
5656
5757@test "invoking backup with config where backup temp dirname is invalid" {
58- run backup $confdir/invalid-tmpdir.conf
58+ run backup -f $confdir/invalid-tmpdir.conf
5959 [ "$status" -eq 1 ]
6060 [ "${lines[0]}" = "Backup temp dirname must end with 'temp' or 'tmp'!" ]
6161}
62+
63+ @test "invoking dry run backup" {
64+ run backup -n
65+ [ "$status" -eq 0 ]
66+ [ "${lines[0]}" = "Dry run!" ]
67+ [ "${lines[3]}" = "[OK] S01command" ]
68+ [ "${lines[4]}" = "Start to synchronize files to cloud." ]
69+ [ "${lines[5]}" = "srcdir : /tmp/backup-temp" ]
70+ [ "${lines[6]}" = "bucket : storage" ]
71+ [ "${lines[7]}" = "destdir: destination" ]
72+ [ "${lines[8]}" = "dry run backup" ]
73+ [ "${lines[9]}" = "[OK] Sync" ]
74+ }
75+
76+ @test "invoking dry run backup with config file" {
77+ run backup -n -f $confdir/valid.conf
78+ [ "$status" -eq 0 ]
79+ [ "${lines[0]}" = "Dry run!" ]
80+ [ "${lines[3]}" = "[OK] S01command" ]
81+ [ "${lines[4]}" = "Start to synchronize files to cloud." ]
82+ [ "${lines[5]}" = "srcdir : /tmp/backup-temp" ]
83+ [ "${lines[6]}" = "bucket : storage" ]
84+ [ "${lines[7]}" = "destdir: destination" ]
85+ [ "${lines[8]}" = "dry run backup" ]
86+ [ "${lines[9]}" = "[OK] Sync" ]
87+ }
0 commit comments