-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26db411
commit 05e1754
Showing
3 changed files
with
135 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bats | ||
|
||
function setup() { | ||
load "$HOME/shell-testing/test_helper/bats-support/load" | ||
load "$HOME/shell-testing/test_helper/bats-assert/load" | ||
load ../../utils/constants.sh | ||
load ../../utils/common.sh | ||
LOG_FILE=/tmp/ovos-installer.log | ||
} | ||
|
||
@test "function_detect_display_x11" { | ||
function loginctl() { | ||
echo "x11" | ||
} | ||
sessions="3" | ||
export -f loginctl | ||
detect_display | ||
echo $DISPLAY_SERVER | ||
[ "$DISPLAY_SERVER" == "x11" ] | ||
unset loginctl | ||
} | ||
|
||
@test "function_detect_display_wayland" { | ||
function loginctl() { | ||
echo "wayland" | ||
} | ||
sessions="6" | ||
export -f loginctl | ||
detect_display | ||
echo $DISPLAY_SERVER | ||
[ "$DISPLAY_SERVER" == "wayland" ] | ||
unset loginctl | ||
} | ||
|
||
|
||
@test "function_detect_display_no_display" { | ||
function loginctl() { | ||
echo "tty" | ||
} | ||
sessions="11" | ||
export -f loginctl | ||
detect_display | ||
echo $DISPLAY_SERVER | ||
[ "$DISPLAY_SERVER" == "N/A" ] | ||
unset loginctl | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/env bats | ||
|
||
function setup() { | ||
load "$HOME/shell-testing/test_helper/bats-support/load" | ||
load "$HOME/shell-testing/test_helper/bats-assert/load" | ||
load ../../utils/constants.sh | ||
load ../../utils/common.sh | ||
LOG_FILE=/tmp/ovos-installer.log | ||
} | ||
|
||
@test "function_detect_existing_instance_docker_exists" { | ||
function docker() { | ||
echo "adf1dedc2025" | ||
} | ||
export -f docker | ||
detect_existing_instance | ||
echo "$EXISTING_INSTANCE" | ||
[ "$EXISTING_INSTANCE" == "true" ] | ||
unset docker | ||
} | ||
|
||
@test "function_detect_existing_instance_docker_non_exists" { | ||
function docker() { | ||
return 0 | ||
} | ||
export -f docker | ||
detect_existing_instance | ||
echo "$EXISTING_INSTANCE" | ||
[ "$EXISTING_INSTANCE" == "false" ] | ||
unset docker | ||
} | ||
|
||
@test "function_detect_existing_instance_podman_exists" { | ||
function docker() { | ||
return 0 | ||
} | ||
function podman() { | ||
echo "adf1dedc2025" | ||
} | ||
export -f docker podman | ||
detect_existing_instance | ||
echo "$EXISTING_INSTANCE" | ||
[ "$EXISTING_INSTANCE" == "true" ] | ||
unset docker podman | ||
} | ||
|
||
@test "function_detect_existing_instance_podman_non_exists" { | ||
function docker() { | ||
return 0 | ||
} | ||
function podman() { | ||
return 0 | ||
} | ||
export -f docker podman | ||
detect_existing_instance | ||
echo "$EXISTING_INSTANCE" | ||
[ "$EXISTING_INSTANCE" == "false" ] | ||
unset docker podman | ||
} | ||
|
||
@test "function_detect_existing_instance_venv_exists" { | ||
RUN_AS_HOME=$USER | ||
run mkdir -p "$RUN_AS_HOME/.venvs/ovos" | ||
function docker() { | ||
return 0 | ||
} | ||
function podman() { | ||
return 0 | ||
} | ||
export -f docker podman | ||
detect_existing_instance | ||
echo "$EXISTING_INSTANCE" | ||
[ "$EXISTING_INSTANCE" == "true" ] | ||
unset docker podman | ||
} | ||
|
||
@test "function_detect_existing_instance_venv_non_exists" { | ||
function docker() { | ||
return 0 | ||
} | ||
function podman() { | ||
return 0 | ||
} | ||
export -f docker podman | ||
detect_existing_instance | ||
echo "$EXISTING_INSTANCE" | ||
[ "$EXISTING_INSTANCE" == "false" ] | ||
unset docker podman | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters