feat: Add local_target variable and tests
This commit is contained in:
2
tests/files/basic.plan
Normal file
2
tests/files/basic.plan
Normal file
@ -0,0 +1,2 @@
|
||||
sources=('file:/home/user')
|
||||
targets=('file:/var/backup')
|
7
tests/files/multiple_file_targets.plan
Normal file
7
tests/files/multiple_file_targets.plan
Normal file
@ -0,0 +1,7 @@
|
||||
sources=('file:/home/user')
|
||||
targets=(
|
||||
'file:///home/backups'
|
||||
'file:/var/backup'
|
||||
'file:/backups'
|
||||
's3://bucket'
|
||||
)
|
@ -39,7 +39,7 @@ setup() {
|
||||
assert_output --partial 'Error: targets array is not set'
|
||||
}
|
||||
|
||||
@test "No targets with file URI scheme" {
|
||||
@test "No targets with 'file' URI scheme" {
|
||||
. script.sh
|
||||
run source_script $DIR/files/no_file_target.plan
|
||||
assert_output --partial "Error: 'file' scheme is not set in targets. You must provide one or more targets with 'file' scheme."
|
||||
@ -56,3 +56,15 @@ setup() {
|
||||
run source_script $DIR/files/unsupported_target_scheme.plan
|
||||
assert_output --partial 'Error: Unsupported URI scheme: scp'
|
||||
}
|
||||
|
||||
@test "Set local target" {
|
||||
. script.sh
|
||||
source_script $DIR/files/basic.plan
|
||||
[ "$local_target" == 'file:/var/backup' ]
|
||||
}
|
||||
|
||||
@test "Set local target from multiple 'file' targets" {
|
||||
. script.sh
|
||||
source_script $DIR/files/multiple_file_targets.plan
|
||||
[ "$local_target" == 'file:///home/backups' ]
|
||||
}
|
||||
|
Reference in New Issue
Block a user