Skip to content

Commit

Permalink
tests/integration: Rename DEVICE_PASS to DEVICE_PASSWORD on tests
Browse files Browse the repository at this point in the history
AVAL already defines the device password as the variable DEVICE_PASSWORD, so
the change is made to use the same standards and avoid duplication of variables
with the same functionality.

Signed-off-by: Lucas Bernardes <[email protected]>
  • Loading branch information
lucasbernardestoradex committed Nov 26, 2024
1 parent 04b64ba commit eed168f
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 28 deletions.
4 changes: 2 additions & 2 deletions tests/integration/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ export -f torizoncore-builder-clean-storage
# $@ = command to be executed
device-shell() {
local OPTS="-o ConnectTimeout=5 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
sshpass -p $DEVICE_PASS ssh -p $DEVICE_PORT -n -q $OPTS $DEVICE_USER@$DEVICE_ADDR "$@"
sshpass -p $DEVICE_PASSWORD ssh -p $DEVICE_PORT -n -q $OPTS $DEVICE_USER@$DEVICE_ADDR "$@"
}
export -f device-shell

# run command in the device via SSH using sudo
# $@ = command to be executed with sudo
device-shell-root() {
device-shell "echo $DEVICE_PASS | sudo -S $@"
device-shell "echo $DEVICE_PASSWORD | sudo -S $@"
}
export -f device-shell-root

Expand Down
1 change: 0 additions & 1 deletion tests/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export SAMPLES_DIR=samples
# device address and credentials
export DEVICE_ADDR=$TCB_DEVICE
export DEVICE_USER="torizon"
export DEVICE_PASS=$DEVICE_PASSWORD

export WIC_MACHINES="intel-corei7-64 qemux86-64 raspberrypi4-64"

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/testcases/build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ teardown_file() {
# Deploy custom image.
run torizoncore-builder deploy --remote-host "$DEVICE_ADDR" \
--remote-username "$DEVICE_USER" \
--remote-password "$DEVICE_PASS" \
--remote-password "$DEVICE_PASSWORD" \
--remote-port "$DEVICE_PORT" \
--reboot "$COMMIT"
assert_success
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/testcases/deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ load 'lib/common.bash'

run torizoncore-builder deploy --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT \
--reboot some_branch
assert_failure
Expand All @@ -74,7 +74,7 @@ load 'lib/common.bash'

run torizoncore-builder deploy --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT \
--reboot branch1
assert_success
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/testcases/dt.bats
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ load 'lib/common.bash'
torizoncore-builder union branch1
run torizoncore-builder deploy --remote-host "$DEVICE_ADDR" \
--remote-username "$DEVICE_USER" \
--remote-password "$DEVICE_PASS" \
--remote-password "$DEVICE_PASSWORD" \
--remote-port "$DEVICE_PORT" \
--reboot branch1
assert_success
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/testcases/dto.bats
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bats_load_library 'bats/bats-file/load.bash'
torizoncore-builder union branch1
run torizoncore-builder deploy \
--remote-host $DEVICE_ADDR --remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS --remote-port $DEVICE_PORT --reboot branch1
--remote-password $DEVICE_PASSWORD --remote-port $DEVICE_PORT --reboot branch1
assert_success
assert_output --partial "Deploying successfully finished"

Expand Down Expand Up @@ -137,7 +137,7 @@ bats_load_library 'bats/bats-file/load.bash'
torizoncore-builder union branch2
run torizoncore-builder deploy \
--remote-host $DEVICE_ADDR --remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS --remote-port $DEVICE_PORT --reboot branch2
--remote-password $DEVICE_PASSWORD --remote-port $DEVICE_PORT --reboot branch2
assert_success
assert_output --partial "Deploying successfully finished"

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/testcases/images-download.bats
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ load 'lib/common.bash'

run torizoncore-builder images download --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT
assert_success
assert_output --partial "Unpacked OSTree from Toradex Easy Installer image"
Expand Down
22 changes: 11 additions & 11 deletions tests/integration/testcases/isolate.bats
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ load 'lib/isolate.bash'
run torizoncore-builder isolate --changes-directory $ISOLATE_DIR \
--remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT
assert_success
assert_output --partial "Changes in /etc successfully isolated."
Expand Down Expand Up @@ -61,7 +61,7 @@ load 'lib/isolate.bash'
--force \
--remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT
assert_success
assert_output --partial "Changes in /etc successfully isolated."
Expand All @@ -86,7 +86,7 @@ load 'lib/isolate.bash'
run torizoncore-builder isolate --changes-directory $ISOLATE_DIR \
--remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT
assert_failure
assert_output --partial "There is already a directory with isolated changes. If you want to replace it, please use --force."
Expand All @@ -112,7 +112,7 @@ load 'lib/isolate.bash'

run torizoncore-builder isolate --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT
assert_failure
assert_output --partial "There is already a directory with isolated changes. If you want to replace it, please use --force."
Expand All @@ -138,7 +138,7 @@ load 'lib/isolate.bash'

run torizoncore-builder isolate --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT \
--force
assert_success
Expand Down Expand Up @@ -173,7 +173,7 @@ load 'lib/isolate.bash'
--force \
--remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT
assert_success
assert_output --partial "Changes in /etc successfully isolated."
Expand Down Expand Up @@ -205,7 +205,7 @@ load 'lib/isolate.bash'
torizoncore-builder images --remove-storage unpack $DEFAULT_TEZI_IMAGE
run torizoncore-builder isolate --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT
assert_success
assert_output --partial "Changes in /etc successfully isolated."
Expand All @@ -229,7 +229,7 @@ load 'lib/isolate.bash'
torizoncore-builder images --remove-storage unpack $DEFAULT_TEZI_IMAGE
run torizoncore-builder isolate --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT
assert_success
assert_output --partial "Changes in /etc successfully isolated."
Expand All @@ -251,7 +251,7 @@ load 'lib/isolate.bash'
run torizoncore-builder isolate --changes-directory $ISOLATE_DIR \
--remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT
assert_success
assert_output --partial "Changes in /etc successfully isolated."
Expand All @@ -270,7 +270,7 @@ load 'lib/isolate.bash'

run torizoncore-builder isolate --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT \
--force
assert_success
Expand All @@ -287,7 +287,7 @@ load 'lib/isolate.bash'
run torizoncore-builder isolate --changes-directory $ISOLATE_DIR \
--remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT \
--force
assert_success
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/testcases/union.bats
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ load 'lib/union.bash'

run torizoncore-builder isolate --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT

make-changes-to-validate-tcattr-acls "/storage/changes"
Expand Down Expand Up @@ -129,7 +129,7 @@ load 'lib/union.bash'
--force \
--remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT

add-files-to-check-default-credentials "/workdir/$ISOLATE_DIR"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/testcases/wic/build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ teardown_file() {
# Deploy custom image.
run torizoncore-builder deploy --remote-host "$DEVICE_ADDR" \
--remote-username "$DEVICE_USER" \
--remote-password "$DEVICE_PASS" \
--remote-password "$DEVICE_PASSWORD" \
--remote-port "$DEVICE_PORT" \
--reboot "$COMMIT"
assert_success
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/testcases/wic/deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ load '../lib/common.bash'

run torizoncore-builder deploy --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT \
--reboot some_branch
assert_failure
Expand All @@ -85,7 +85,7 @@ load '../lib/common.bash'

run torizoncore-builder deploy --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT \
--reboot branch1
assert_success
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/testcases/wic/union.bats
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ load '../lib/union.bash'

run torizoncore-builder isolate --remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT

make-changes-to-validate-tcattr-acls "/storage/changes"
Expand Down Expand Up @@ -129,7 +129,7 @@ load '../lib/union.bash'
--force \
--remote-host $DEVICE_ADDR \
--remote-username $DEVICE_USER \
--remote-password $DEVICE_PASS \
--remote-password $DEVICE_PASSWORD \
--remote-port $DEVICE_PORT

add-files-to-check-default-credentials "/workdir/$ISOLATE_DIR"
Expand Down

0 comments on commit eed168f

Please sign in to comment.