added commands for starting, stopping app
added command for updating tests from specific branch
This commit is contained in:
5
functional/run_functional_tests.sh
Normal file → Executable file
5
functional/run_functional_tests.sh
Normal file → Executable 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
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
__author__ = 'ekonstantinov'
|
__author__ = 'ekonstantinov'
|
||||||
import unittest
|
import unittest
|
||||||
import requests
|
|
||||||
import time
|
import time
|
||||||
from client import TestingAdapterClient
|
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())
|
.format(test=test['id'], item=item, actual=test.get(item).capitalize(), expected=items.get(item).capitalize())
|
||||||
self.assertTrue(items[item] == test.get(item), msg)
|
self.assertTrue(items[item] == test.get(item), msg)
|
||||||
|
|
||||||
def setUp(self):
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
url = 'http://172.18.164.69:8989/v1'
|
url = 'http://172.18.164.69:8989/v1'
|
||||||
self.adapter = TestingAdapterClient(url)
|
cls.adapter = TestingAdapterClient(url)
|
||||||
self.tests = {
|
cls.tests = {
|
||||||
'fast_pass': 'functional.dummy_tests.general_test.Dummy_test.test_fast_pass',
|
'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_error': 'functional.dummy_tests.general_test.Dummy_test.test_fast_error',
|
||||||
'fast_fail': 'functional.dummy_tests.general_test.Dummy_test.test_fast_fail',
|
'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'
|
'so_long': 'functional.dummy_tests.stopped_test.dummy_tests_stopped.test_one_no_so_long'
|
||||||
|
|
||||||
}
|
}
|
||||||
self.testsets = [
|
cls.testsets = [
|
||||||
"fuel_smoke",
|
"fuel_smoke",
|
||||||
"fuel_sanity",
|
"fuel_sanity",
|
||||||
"plugin_general",
|
"plugin_general",
|
||||||
@@ -52,7 +52,8 @@ class adapter_tests(unittest.TestCase):
|
|||||||
|
|
||||||
def test_general_testset(self):
|
def test_general_testset(self):
|
||||||
"""Send start_testrun
|
"""Send start_testrun
|
||||||
wait
|
wait for 5 sec
|
||||||
|
check status: expected
|
||||||
"""
|
"""
|
||||||
testset = "plugin_general"
|
testset = "plugin_general"
|
||||||
config = {}
|
config = {}
|
||||||
@@ -68,7 +69,8 @@ class adapter_tests(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
self._verify_json(assertions, json)
|
self._verify_json(assertions, json)
|
||||||
time.sleep(15)
|
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)
|
self._verify_json(assertions, json)
|
||||||
|
|
||||||
def test_stopped_testset(self):
|
def test_stopped_testset(self):
|
||||||
|
|||||||
25
test_utils/commands
Normal file
25
test_utils/commands
Normal 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
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user