SERVER_PORT for UI and CLI tests depends on env variables

Nailgun web server listens on port depending on
FUELCLIENT_SERVER_PORT and UI_SERVER_PORT variables

Default port for UI tests - 5544
Default port for CLI tests - 8003

Each subproject should use its own server to guarantee
some environment isolation

Change-Id: I816958d31b51fcd16e5defbdf3e822eab3a085cd
Closes-Bug: #1282565
This commit is contained in:
Dima Shulyak 2014-06-24 14:34:49 +03:00
parent 4cf4347a48
commit 75e2e5330b
3 changed files with 10 additions and 7 deletions

View File

@ -102,7 +102,6 @@ class BaseTestCase(TestCase):
def run_cli_command(self, command_line, check_errors=False):
modified_env = os.environ.copy()
modified_env["LISTEN_PORT"] = "8003"
command_args = [" ".join((self.fuel_path, command_line))]
process_handle = subprocess.Popen(
command_args,

View File

@ -13,7 +13,10 @@
* License for the specific language governing permissions and limitations
* under the License.
**/
var baseUrl = 'http://127.0.0.1:5544/';
var system = require('system');
var port = system.env.SERVER_PORT || 5544;
var baseUrl = 'http://127.0.0.1:' + port + '/';
casper.on('page.error', function(msg) {
casper.echo(msg, 'ERROR');

View File

@ -86,6 +86,8 @@ FUELCLIENT_XUNIT=${FUELCLIENT_XUNIT:-"$ROOT/fuelclient.xml"}
FUELUPGRADE_XUNIT=${FUELUPGRADE_XUNIT:-"$ROOT/fuelupgrade.xml"}
FUELUPGRADEDOWNLOADER_XUNIT=${FUELUPGRADEDOWNLOADER_XUNIT:-"$ROOT/fuelupgradedownloader.xml"}
SHOTGUN_XUNIT=${SHOTGUN_XUNIT:-"$ROOT/shotgun.xml"}
UI_SERVER_PORT=${UI_SERVER_PORT:-5544}
FUELCLIENT_SERVER_PORT=${FUELCLIENT_SERVER_PORT:-8003}
# disabled/enabled flags that are setted from the cli.
# used for manipulating run logic.
@ -219,7 +221,7 @@ function run_nailgun_tests {
# $@ -- tests to be run; with no arguments all tests will be run
function run_webui_tests {
local COMPRESSED_STATIC_DIR=/tmp/static_compressed
local SERVER_PORT=5544
local SERVER_PORT=$UI_SERVER_PORT
local TESTS_DIR=$ROOT/nailgun/ui_tests
local TESTS=$TESTS_DIR/test_*.js
@ -253,8 +255,7 @@ function run_webui_tests {
local pid=$!
if [ $pid -ne 0 ]; then
${CASPERJS} test --includes="$TESTS_DIR/helpers.js" --fail-fast "$testcase"
SERVER_PORT=$SERVER_PORT ${CASPERJS} test --includes="$TESTS_DIR/helpers.js" --fail-fast "$testcase"
if [ $? -ne 0 ]; then
result=1
break
@ -286,7 +287,7 @@ function run_webui_tests {
# It is supposed that nailgun server is up and working.
# We are going to pass nailgun url to test runner.
function run_cli_tests {
local SERVER_PORT=8003
local SERVER_PORT=$FUELCLIENT_SERVER_PORT
local TESTS=$ROOT/fuelclient/tests
if [ $# -ne 0 ]; then
@ -306,7 +307,7 @@ function run_cli_tests {
pushd $ROOT/fuelclient >> /dev/null
# run tests
tox -epy26 -- -vv $testropts $TESTS --xunit-file $FUELCLIENT_XUNIT || result=1
LISTEN_PORT=$SERVER_PORT tox -epy26 -- -vv $testropts $TESTS --xunit-file $FUELCLIENT_XUNIT || result=1
popd >> /dev/null
kill $pid