forked from adamlaska/machine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscp.bats
More file actions
32 lines (26 loc) · 1021 Bytes
/
scp.bats
File metadata and controls
32 lines (26 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bats
load ${BASE_TEST_DIR}/helpers.bash
use_shared_machine
export SECOND_MACHINE="$NAME-2"
@test "$DRIVER: test machine scp command from remote to host" {
machine ssh $NAME 'echo A file created remotely! >/tmp/foo.txt'
machine scp $NAME:/tmp/foo.txt .
[[ $(cat foo.txt) == "A file created remotely!" ]]
}
@test "$DRIVER: test machine scp command from host to remote" {
teardown () {
rm foo.txt
}
echo A file created locally! >foo.txt
machine scp foo.txt $NAME:/tmp/foo.txt
[[ $(machine ssh $NAME cat /tmp/foo.txt) == "A file created locally!" ]]
}
@test "$DRIVER: create machine to test transferring files from machine to machine" {
run machine create -d $DRIVER $SECOND_MACHINE
[[ ${status} -eq 0 ]]
}
@test "$DRIVER: scp from one machine to another" {
run machine ssh $NAME 'echo A file hopping around! >/tmp/foo.txt'
run machine scp $NAME:/tmp/foo.txt $SECOND_MACHINE:/tmp/foo.txt
[[ $(machine ssh ${SECOND_MACHINE} cat /tmp/foo.txt) == "A file hopping around!" ]]
}