fixing timing
fixing commands adding scenarios updating client
This commit is contained in:
@@ -109,8 +109,8 @@ class BaseAdapterTest(TestCase):
|
||||
if item == 'tests':
|
||||
continue
|
||||
if response.test_sets[test_set][item] != test_set_data[item]:
|
||||
msg = '"{0}" != "{1}" in {2}.{3}'.format(response.test_sets[test_set][item],
|
||||
test_set_data[item], test_set, item)
|
||||
msg = 'Actual "{0}" != expected "{1}" in {2}.{3}'.format(response.test_sets[test_set][item],
|
||||
test_set_data[item], test_set, item)
|
||||
diff.append(msg)
|
||||
|
||||
for test_name, test in tests.iteritems():
|
||||
@@ -118,8 +118,8 @@ class BaseAdapterTest(TestCase):
|
||||
if t == 'id':
|
||||
continue
|
||||
if response._tests[test_name][t] != test[t]:
|
||||
msg = '"{0}" != "{1}" in {2}.{3}.{4}'.format(response._tests[test_name][t],
|
||||
test[t], test_set, test_name, t)
|
||||
msg = 'Actual "{0}" != expected"{1}" in {2}.{3}.{4}'.format(response._tests[test_name][t],
|
||||
test[t], test_set, test_name, t)
|
||||
diff.append(msg)
|
||||
if diff:
|
||||
raise AssertionError(diff)
|
||||
|
||||
@@ -94,16 +94,25 @@ class TestingAdapterClient(object):
|
||||
time.sleep(5)
|
||||
|
||||
current_response = self.testruns_last(cluster_id)
|
||||
current_status = [item['status'] for item in current_response.json()
|
||||
if item['testset'] == testset][0]
|
||||
print '!!!', current_response.json()
|
||||
current_status, current_tests = [(item['status'], item['tests']) for item in current_response.json()
|
||||
if item['testset'] == testset][0]
|
||||
|
||||
if current_status == 'finished':
|
||||
break
|
||||
else:
|
||||
current_response = self.stop_testrun_last(testset, cluster_id)
|
||||
self.stop_testrun_last(testset, cluster_id)
|
||||
stopped_response = self.testruns_last(cluster_id)
|
||||
stopped_status = [item['status'] for item in stopped_response.json()
|
||||
if item['testset'] == testset][0]
|
||||
|
||||
msg = '{0} is still in {1} state. Now the state is {2}'.format(testset, current_status, stopped_status)
|
||||
msg_tests = '\n'.join(['{0} -> {1}, {2}'.format(item['id'], item['status'], item['taken']) for item in current_tests])
|
||||
raise AssertionError('\n'.join([msg, msg_tests]))
|
||||
return current_response
|
||||
|
||||
|
||||
|
||||
def run_with_timeout(self, testset, tests, cluster_id, timeout):
|
||||
action = lambda: self.start_testrun_tests(testset, tests, cluster_id)
|
||||
return self._with_timeout(action, testset, cluster_id, timeout)
|
||||
|
||||
@@ -20,6 +20,7 @@ import time
|
||||
class ScenarioTests(BaseAdapterTest):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
||||
url = 'http://0.0.0.0:8989/v1'
|
||||
mapping = {}
|
||||
|
||||
@@ -45,8 +46,12 @@ class ScenarioTests(BaseAdapterTest):
|
||||
|
||||
def test_run_fuel_sanity(self):
|
||||
testset = "fuel_sanity"
|
||||
cluster_id = 3
|
||||
tests = []
|
||||
cluster_id = 2
|
||||
tests = ['fuel_health.tests.sanity.test_sanity_compute.SanityComputeTest.test_list_volumes',
|
||||
'fuel_health.tests.sanity.test_sanity_identity.ServicesTestJSON.test_list_users',
|
||||
'fuel_health.tests.sanity.test_sanity_networking.NetworksTest.test_list_ports']
|
||||
tests = ['functional.dummy_tests.general_test.Dummy_test.test_fast_pass',
|
||||
'functional.dummy_tests.general_test.Dummy_test.test_fast_fail']
|
||||
timeout = 240
|
||||
|
||||
r = self.client.run_with_timeout(testset, tests, cluster_id, timeout)
|
||||
|
||||
@@ -22,7 +22,9 @@ class AdapterTests(BaseAdapterTest):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
url = 'http://0.0.0.0:8989/v1'
|
||||
|
||||
url = 'http:/0.0.0.0:8989/v1'
|
||||
|
||||
cls.mapping = {
|
||||
'functional.dummy_tests.general_test.Dummy_test.test_fast_pass': 'fast_pass',
|
||||
'functional.dummy_tests.general_test.Dummy_test.test_fast_error': 'fast_error',
|
||||
@@ -69,7 +71,7 @@ class AdapterTests(BaseAdapterTest):
|
||||
cluster_id = 1
|
||||
|
||||
self.client.start_testrun(testset, cluster_id)
|
||||
time.sleep(2)
|
||||
time.sleep(3)
|
||||
|
||||
r = self.client.testruns_last(cluster_id)
|
||||
|
||||
@@ -84,8 +86,11 @@ class AdapterTests(BaseAdapterTest):
|
||||
{'id': 'fast_error', 'message': '', 'status': 'error'},
|
||||
{'id': 'fast_fail', 'message': 'Something goes wroooong', 'status': 'failure'}]}])
|
||||
|
||||
print r
|
||||
print assertions
|
||||
|
||||
self.compare(r, assertions)
|
||||
time.sleep(5)
|
||||
time.sleep(10)
|
||||
|
||||
r = self.client.testruns_last(cluster_id)
|
||||
|
||||
@@ -212,7 +217,7 @@ class AdapterTests(BaseAdapterTest):
|
||||
disabled_test = ['functional.dummy_tests.general_test.Dummy_test.test_fast_error', ]
|
||||
cluster_id = 70
|
||||
|
||||
self.client.run_with_timeout(testset, tests, cluster_id, 10)
|
||||
self.client.run_with_timeout(testset, tests, cluster_id, 70)
|
||||
self.client.restart_with_timeout(testset, tests, cluster_id, 10)
|
||||
|
||||
r = self.client.restart_tests_last(testset, disabled_test, cluster_id)
|
||||
@@ -224,6 +229,7 @@ class AdapterTests(BaseAdapterTest):
|
||||
{'status': 'failure', 'id': 'fast_fail'},
|
||||
{'status': 'success', 'id': 'fast_pass'},
|
||||
{'status': 'disabled', 'id': 'long_pass'}]}])
|
||||
print r
|
||||
self.compare(r, assertions)
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
@@ -38,14 +38,14 @@ function update_tests {
|
||||
pip install -e git+ssh://git@github.com/Mirantis/fuel-ostf-tests.git@"$OSTF_TESTS_BRANCH"#egg=ostf-tests
|
||||
}
|
||||
|
||||
function update_adapter {
|
||||
function update_adapters {
|
||||
if [[ -z $1 && -z $OSTF_ADAPTER_BRANCH ]] ; then echo "Please specify a branch"; return 1; fi
|
||||
if [[ ! -z $1 ]] ; then
|
||||
git ls-remote --heads git@github.com:Mirantis/fuel-ostf-adapter.git $1 | grep $1 &> /dev/null || { echo "No branch" && return 1; }
|
||||
git ls-remote --heads git@github.com:Mirantis/fuel-ostf-plugin.git $1 | grep $1 &> /dev/null || { echo "No branch" && return 1; }
|
||||
export OSTF_ADAPTER_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-adapter.git@"$OSTF_ADAPTER_BRANCH"#egg=ostf-tests
|
||||
! pip freeze | grep ostf-tests &> /dev/null || pip uninstall -y testing_adapter
|
||||
pip install -e git+ssh://git@github.com/Mirantis/fuel-ostf-plugin.git@"$OSTF_ADAPTER_BRANCH"#egg=ostf-plugin
|
||||
}
|
||||
|
||||
function migrate_db {
|
||||
|
||||
@@ -20,14 +20,14 @@ def main():
|
||||
with open('ostf_adapter/commands.json', 'rw+') as commands:
|
||||
data = loads(commands.read())
|
||||
for item in data:
|
||||
if data[item].get('argv') and item in ['fuel_sanity', 'fuel_smoke']:
|
||||
if 'argv' in data[item] and item in ['fuel_sanity', 'fuel_smoke']:
|
||||
if "--with-xunit" not in data[item]['argv']:
|
||||
data[item]['argv'].extend(["--with-xunit", '--xunit-file={0}.xml'.format(item)])
|
||||
else:
|
||||
elif item in ['fuel_sanity', 'fuel_smoke']:
|
||||
data[item]['argv'] = ["--with-xunit", ]
|
||||
test_apps = {"plugin-general": {"test_path": "tests/functional/dummy_tests/general_test.py", "driver": "nose"},
|
||||
"plugin-stopped": {"test_path": "tests/functional/dummy_tests/stopped_test.py", "driver": "nose"}}
|
||||
if 'plugin-general' not in data or 'plugin_stopped' not in data:
|
||||
test_apps = {"plugin_general": {"test_path": "tests/functional/dummy_tests/general_test.py", "driver": "nose"},
|
||||
"plugin_stopped": {"test_path": "tests/functional/dummy_tests/stopped_test.py", "driver": "nose"}}
|
||||
if 'plugin_general' not in data or 'plugin_stopped' not in data:
|
||||
data.update(test_apps)
|
||||
commands.seek(0)
|
||||
commands.write(dumps(data))
|
||||
|
||||
Reference in New Issue
Block a user