Removing threading option
Gates are not reliably working with threading, leaving to some problems and gates flakiness. Removing it to make it more stable Depends-On: I35f3be8fc16d71d0d2ac01c5451d398dd631f118 Change-Id: I6522689fac6a7398cd78665a13daa6f5e46c6be2
This commit is contained in:
parent
6c4ac2bebd
commit
11463dda9e
|
@ -15,7 +15,6 @@ import six.moves
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import json
|
import json
|
||||||
from multiprocessing import pool
|
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -601,8 +600,7 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
|
||||||
'Got %s.' % cmd_outputs)
|
'Got %s.' % cmd_outputs)
|
||||||
|
|
||||||
def assert_backend_amount(self, server_ip, amount, server_port=None,
|
def assert_backend_amount(self, server_ip, amount, server_port=None,
|
||||||
protocol="TCP", headers=None, repetitions=100,
|
protocol="TCP", headers=None):
|
||||||
threads=8, request_timeout=5):
|
|
||||||
def req_tcp():
|
def req_tcp():
|
||||||
resp = requests.get(url, headers=headers)
|
resp = requests.get(url, headers=headers)
|
||||||
self.assertEqual(requests.codes.OK, resp.status_code,
|
self.assertEqual(requests.codes.OK, resp.status_code,
|
||||||
|
@ -646,12 +644,9 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
|
||||||
LOG.info("Unsupported protocol %s, returning", protocol)
|
LOG.info("Unsupported protocol %s, returning", protocol)
|
||||||
return
|
return
|
||||||
|
|
||||||
self._run_threaded_and_assert(req, pred, repetitions=repetitions,
|
self._run_and_assert(req, pred)
|
||||||
threads=threads,
|
|
||||||
fn_timeout=request_timeout)
|
|
||||||
|
|
||||||
def assert_backend_amount_from_pod(self, url, amount, pod, repetitions=100,
|
def assert_backend_amount_from_pod(self, url, amount, pod):
|
||||||
threads=8, request_timeout=20):
|
|
||||||
def req():
|
def req():
|
||||||
status_prefix = '\nkuryr-tempest-plugin-curl-http_code:"'
|
status_prefix = '\nkuryr-tempest-plugin-curl-http_code:"'
|
||||||
cmd = ['/usr/bin/curl', '-Ss', '-w',
|
cmd = ['/usr/bin/curl', '-Ss', '-w',
|
||||||
|
@ -683,21 +678,9 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
|
||||||
'Incorrect amount of unique backends. '
|
'Incorrect amount of unique backends. '
|
||||||
'Got {}'.format(unique_resps))
|
'Got {}'.format(unique_resps))
|
||||||
|
|
||||||
self._run_threaded_and_assert(req, pred, repetitions=repetitions,
|
self._run_and_assert(req, pred)
|
||||||
threads=threads,
|
|
||||||
fn_timeout=request_timeout)
|
|
||||||
|
|
||||||
def _run_threaded_and_assert(
|
def _run_and_assert(self, fn, predicate, retry_repetitions=10):
|
||||||
self, fn, predicate, repetitions=100, threads=8, fn_timeout=1,
|
|
||||||
retry_repetitions=10):
|
|
||||||
tp = pool.ThreadPool(processes=threads)
|
|
||||||
try:
|
|
||||||
results = [tp.apply_async(fn) for _ in range(repetitions)]
|
|
||||||
resps = [result.get(timeout=fn_timeout) for result in results]
|
|
||||||
predicate(self, resps)
|
|
||||||
except Exception as e:
|
|
||||||
LOG.info("Multi threaded test failed with Exception:%s. "
|
|
||||||
"Retry with single thread", e)
|
|
||||||
resps = [fn() for _ in range(retry_repetitions)]
|
resps = [fn() for _ in range(retry_repetitions)]
|
||||||
predicate(self, resps)
|
predicate(self, resps)
|
||||||
|
|
||||||
|
@ -868,7 +851,7 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
|
||||||
'Incorrect amount of unique backends. '
|
'Incorrect amount of unique backends. '
|
||||||
'Got {}'.format(unique_resps))
|
'Got {}'.format(unique_resps))
|
||||||
|
|
||||||
self._run_threaded_and_assert(req, pred, fn_timeout=10)
|
self._run_and_assert(req, pred)
|
||||||
|
|
||||||
def create_and_ping_pod(self):
|
def create_and_ping_pod(self):
|
||||||
name, pod = self.create_pod()
|
name, pod = self.create_pod()
|
||||||
|
|
Loading…
Reference in New Issue