-
Notifications
You must be signed in to change notification settings - Fork 592
[desktop-lite] - vnc_resolution - set thru env var #1112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
samruddhikhandale
merged 7 commits into
devcontainers:main
from
gauravsaini04:desktop-lite_vnc-resolution_test_env_var
Sep 9, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8b1294a
[desktop-lite] - vnc_resolution - set thru env var
gauravsaini04 08a2c8b
Merge branch 'main' into desktop-lite_vnc-resolution_test_env_var
gauravsaini04 a302402
mistake in scenarios.json corrected
gauravsaini04 71bf03e
small change of function addition in desktop-init.sh file
gauravsaini04 ca1ed17
Merge branch 'main' into desktop-lite_vnc-resolution_test_env_var
gauravsaini04 4388820
changes as requested (review pr)
gauravsaini04 bf0c206
changes as suggested
gauravsaini04 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
47 changes: 47 additions & 0 deletions
47
test/desktop-lite/test_vnc_resolution_as_container_env_var.sh
This file contains hidden or 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,47 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| # Optional: Import test library | ||
| source dev-container-features-test-lib | ||
|
|
||
| GREEN='\033[0;32m'; NC='\033[0m'; RED='\033[0;31m'; YELLOW='\033[0;33m'; | ||
|
|
||
| # Check if xtigervnc & noVnc processes are running after successful installation and initialization | ||
| check_process_running() { | ||
| port=$1 | ||
| # Get process id of process running on specific port | ||
| PID=$(lsof -i :$port | awk 'NR==2 {print $2}') | ||
| if [ -n "$PID" ]; then | ||
| CMD=$(ps -p $PID -o cmd --no-headers) | ||
| echo -e "${GREEN}Command running on port $port: ${YELLOW}$CMD${NC}" | ||
| else | ||
| echo -e "${RED}No process found listening on port $port.${NC}" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
gauravsaini04 marked this conversation as resolved.
|
||
|
|
||
| check_w_config_resolution() { | ||
| configResolution=$1 | ||
| actualResolution=$2 | ||
|
|
||
| if echo "$1" | grep -q "$2"; then | ||
| echo -e "\n👍👍 ${GREEN}Configured resolution i.e. ${YELLOW}$configResolution${GREEN} has been set as vnc resolution i.e. ${YELLOW}$actualResolution${GREEN} in container.${NC}" | ||
| else | ||
| echo -e "\n❌❌ ${GREEN}Configured resolution i.e. ${YELLOW}$configResolution${GREEN} couldn't be set as vnc resolution i.e. ${YELLOW}$actualResolution${GREEN} in container.${NC}" | ||
| fi | ||
| } | ||
|
|
||
| check "Whether xtigervnc is Running" check_process_running 5901 | ||
| resolution=$(ps -x -ww | grep Xtigervnc | awk "{for(i=1;i<=NF;i++) if (\$i ~ /-geometry/) {print \$(i+1); exit}}") | ||
| check "xtigervnc resolution" bash -c '$resolution' | ||
| check_w_config_resolution $VNC_RESOLUTION $resolution | ||
| sleep 2 | ||
| check "Whether no_vnc is Running" check_process_running 6080 | ||
|
|
||
| check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh" | ||
| check "log-exists" bash -c "ls /tmp/container-init.log" | ||
| check "log file contents" bash -c "cat /tmp/container-init.log" | ||
|
|
||
| # Report result | ||
| reportResults | ||
33 changes: 33 additions & 0 deletions
33
test/desktop-lite/test_vnc_resolution_as_remote_env_var.sh
This file contains hidden or 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,33 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| # Optional: Import test library | ||
| source dev-container-features-test-lib | ||
|
|
||
| # Check if xtigervnc & noVnc processes are running after successful installation and initialization | ||
| check_process_running() { | ||
| port=$1 | ||
| # Get process id of process running on specific port | ||
| PID=$(lsof -i :$port | awk 'NR==2 {print $2}') | ||
| GREEN='\033[0;32m'; NC='\033[0m'; RED='\033[0;31m'; YELLOW='\033[0;33m'; | ||
| if [ -n "$PID" ]; then | ||
| CMD=$(ps -p $PID -o cmd --no-headers) | ||
| echo -e "${GREEN}Command running on port $port: ${YELLOW}$CMD${NC}" | ||
| else | ||
| echo -e "${RED}No process found listening on port $port.${NC}" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| check "Whether xtigervnc is Running" check_process_running 5901 | ||
| check "xtigervnc resolution" bash -c 'ps -x -ww | grep Xtigervnc | awk "{for(i=1;i<=NF;i++) if (\$i ~ /-geometry/) {print \$(i+1); exit}}"' | ||
| sleep 2 | ||
| check "Whether no_vnc is Running" check_process_running 6080 | ||
|
|
||
| check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh" | ||
| check "log-exists" bash -c "ls /tmp/container-init.log" | ||
| check "log file contents" bash -c "cat /tmp/container-init.log" | ||
|
|
||
| # Report result | ||
| reportResults |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.