added commands for starting, stopping app

added command for updating tests from specific branch
This commit is contained in:
ekonstantinov
2013-07-10 13:02:03 +03:00
parent e0d97a3790
commit d126756078
3 changed files with 38 additions and 8 deletions

5
functional/run_functional_tests.sh Normal file → Executable file
View File

@@ -1 +1,4 @@
nosetests test_general_flow.py:adapter_tests --with-xunit
#!/bin/bash
echo $WORKSPACE
[[ ! -z $WORKSPACE ]] || export WORKSPACE=$(pwd)
nosetests -q test_general_flow.py:adapter_tests --with-xunit --xunit-file=$WORKSPACE/functional.xml

View File

@@ -1,6 +1,5 @@
__author__ = 'ekonstantinov'
import unittest
import requests
import time
from client import TestingAdapterClient
@@ -18,10 +17,11 @@ class adapter_tests(unittest.TestCase):
.format(test=test['id'], item=item, actual=test.get(item).capitalize(), expected=items.get(item).capitalize())
self.assertTrue(items[item] == test.get(item), msg)
def setUp(self):
@classmethod
def setUpClass(cls):
url = 'http://172.18.164.69:8989/v1'
self.adapter = TestingAdapterClient(url)
self.tests = {
cls.adapter = TestingAdapterClient(url)
cls.tests = {
'fast_pass': 'functional.dummy_tests.general_test.Dummy_test.test_fast_pass',
'fast_error': 'functional.dummy_tests.general_test.Dummy_test.test_fast_error',
'fast_fail': 'functional.dummy_tests.general_test.Dummy_test.test_fast_fail',
@@ -31,7 +31,7 @@ class adapter_tests(unittest.TestCase):
'so_long': 'functional.dummy_tests.stopped_test.dummy_tests_stopped.test_one_no_so_long'
}
self.testsets = [
cls.testsets = [
"fuel_smoke",
"fuel_sanity",
"plugin_general",
@@ -52,7 +52,8 @@ class adapter_tests(unittest.TestCase):
def test_general_testset(self):
"""Send start_testrun
wait
wait for 5 sec
check status: expected
"""
testset = "plugin_general"
config = {}
@@ -68,7 +69,8 @@ class adapter_tests(unittest.TestCase):
}
self._verify_json(assertions, json)
time.sleep(15)
assertions[self.tests['fast_pass']]['status'] = 'success'
json = self.adapter.testruns_last(cluster_id)
assertions[self.tests['not_long']]['status'] = 'success'
self._verify_json(assertions, json)
def test_stopped_testset(self):

25
test_utils/commands Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
function killapp {
declare app_pid=$(netstat -nplt | grep 8989 | grep -o [0-9]*/python | grep -o [0-9]*)
echo "Ostf-adapter pid is: $app_pid"
kill -9 $app_pid
}
function startapp {
! netstat -nplt | grep 8989 | grep -o [0-9]*/python | grep -o [0-9]* &> /dev/null || { echo "Server exists" && return 1; }
nohup ostf-server --log_file testing.log --host 0.0.0.0 &
sleep 3
nc -xvw 2 0.0.0.0 8989 &> /dev/null || echo "Not working"
}
function update_tests {
if [[ -z $1 && -z $OSTF_TESTS_BRANCH ]] ; then echo "Please specify a branch"; return 1; fi
if [[ ! -z $1 ]] ; then
git ls-remote --heads git@github.com:Mirantis/fuel-ostf-tests.git $1 | grep $1 &> /dev/null || { echo "No branch" && return 1; }
export OSTF_TESTS_BRANCH=$1
fi
! pip freeze | grep ostf-tests &> /dev/null || pip uninstall -y ostf-tests
pip install -e git+ssh://git@github.com/Mirantis/fuel-ostf-tests.git@"$OSTF_TESTS_BRANCH"#egg=ostf-tests
}