-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring, tests and fix for SERVERNUM.
- Add a common place for functions to be used in entry_point.sh scripts. - Refactor the calls to "echo $DISPLAY | sed..." into a function named get_server_num. - Add tests for this function. - Fix regex used in sed call.
- Loading branch information
1 parent
e961ce7
commit 1b2786e
Showing
15 changed files
with
120 additions
and
12 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
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
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
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,7 @@ | ||
#!/bin/bash | ||
|
||
# https://github.com/SeleniumHQ/docker-selenium/issues/184 | ||
function get_server_num() { | ||
echo $(echo $DISPLAY | sed -r -e 's/([^:]+)?:([0-9]+)(\.[0-9]+)?/\2/') | ||
} | ||
|
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,52 @@ | ||
#!/usr/bin/env bats | ||
|
||
source "$BATS_TEST_DIRNAME"/functions.sh | ||
|
||
# Tests for function get_server_num | ||
# | ||
# Test data from http://askubuntu.com/questions/432255/what-is-display-environment-variable | ||
@test 'get_server_num of :99.1' { | ||
|
||
export DISPLAY=':99.1' | ||
expected_result='99' | ||
result="$(get_server_num)" | ||
echo "result: $result" | ||
[ "$result" == "$expected_result" ] | ||
} | ||
|
||
@test 'get_server_num of :0' { | ||
|
||
export DISPLAY=':0' | ||
expected_result='0' | ||
result="$(get_server_num)" | ||
echo "result: $result" | ||
[ "$result" == "$expected_result" ] | ||
} | ||
|
||
@test 'get_server_num of localhost:4' { | ||
|
||
export DISPLAY='localhost:4' | ||
expected_result='4' | ||
result="$(get_server_num)" | ||
echo "result: $result" | ||
[ "$result" == "$expected_result" ] | ||
} | ||
|
||
@test 'get_server_num of google.com:0' { | ||
|
||
export DISPLAY='google.com:0' | ||
expected_result='0' | ||
result="$(get_server_num)" | ||
echo "result: $result" | ||
[ "$result" == "$expected_result" ] | ||
} | ||
|
||
@test 'get_server_num of google.com:99.1' { | ||
|
||
export DISPLAY='google.com:99.1' | ||
expected_result='99' | ||
result="$(get_server_num)" | ||
echo "result: $result" | ||
[ "$result" == "$expected_result" ] | ||
} | ||
|
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
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
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
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
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
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
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
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
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
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
1b2786e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kayabendroth This breaks the images with
/opt/bin/entry_point.sh: line 3: /opt/bin/functions.sh: No such file or directory
see: #208
1b2786e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ +1
functions.sh does not exist in any of the docker images besides nodebase
NodeBase/functions.sh
!/bin/bash
#184
function get_server_num() {
echo $(echo $DISPLAY | sed -r -e 's/([^:]+)?:([0-9]+)(.[0-9]+)?/\2/')
}
1b2786e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This broke the
latest
images b/c of the way the images are built currently. I didn't want to merge those changes back into the 2.53.0 branch right away.Improving the image build process in order to avoid changes that break
latest
is on the list already.