Skip to content

Commit 511611c

Browse files
Add network check for rubygems.org accessibility in test script
1 parent ebf9d17 commit 511611c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/ruby-rails-postgres/test.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ fixTestProjectFolderPrivs
1010
# Run common tests
1111
checkCommon
1212

13+
1314
# Run devcontainer specific tests
1415
check "rails" rails --version
1516
check "rails installation path" gem which rails
1617
check "user has write permission to rvm gems" [ -w /usr/local/rvm/gems ]
1718
check "user has write permission to rvm gems default" [ -w /usr/local/rvm/gems/default ]
19+
# Check if we can reach rubygems.org before proceeding.
20+
# This uses curl to silently (-s) make a request to https://rubygems.org
21+
# Redirects output to /dev/null because we only care if the request succeeds, not the result itself.
22+
if ! curl -s https://rubygems.org > /dev/null; then
23+
echo "Network access to rubygems.org is unavailable. Please check network or proxy settings."
24+
exit 1
25+
fi
1826
check "user can install gems" gem install github-markup
1927

2028
# Report result

0 commit comments

Comments
 (0)