Skip to content

Commit f4c2765

Browse files
modifications to the test cases
1 parent 75556a8 commit f4c2765

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
#!/bin/bash
22

3-
# Run PowerShell command to check installation
4-
pwsh --version &> /dev/null
5-
6-
# Check if the command was successful
7-
if [ $? -eq 0 ]; then
8-
echo "PowerShell is installed."
9-
else
10-
echo "PowerShell is not installed."
11-
exit 1
12-
fi
3+
set -e
4+
5+
# Import test library for `check` command
6+
source dev-container-features-test-lib
7+
8+
# Extension-specific tests
9+
check "pwsh file is symlink" bash -c "[ -L /usr/bin/pwsh ]"
10+
check "pwsh symlink is registered as shell" bash -c "[ $(grep -c '/usr/bin/pwsh' /etc/shells) -ge 1 ]"
11+
check "pwsh target is correct" bash -c "[ $(readlink /usr/bin/pwsh) = /opt/microsoft/powershell/7/pwsh ]"
12+
check "pwsh owner is root" bash -c "[ $(stat -c %U /opt/microsoft/powershell/7/pwsh) = root ]"
13+
check "pwsh group is root" bash -c "[ $(stat -c %G /opt/microsoft/powershell/7/pwsh) = root ]"
14+
check "pwsh file mode is -rwxr-xr-x" bash -c "[ $(stat -c '%A' /opt/microsoft/powershell/7/pwsh) = '-rwxr-xr-x' ]"
15+
check "pwsh is in PATH" bash -c "command -v pwsh"
16+
17+
# Report result
18+
reportResults

0 commit comments

Comments
 (0)