Merge "Fix video recording for integration tests"
This commit is contained in:
commit
9cbd32f2b8
@ -1,4 +1,5 @@
|
|||||||
# selenium tests
|
# selenium tests
|
||||||
|
ffmpeg [selenium]
|
||||||
firefox [selenium]
|
firefox [selenium]
|
||||||
xvfb [selenium platform:dpkg]
|
xvfb [selenium platform:dpkg]
|
||||||
# already part of xorg-x11-server on openSUSE
|
# already part of xorg-x11-server on openSUSE
|
||||||
|
@ -45,14 +45,16 @@ ROOT_LOGGER.setLevel(logging.DEBUG)
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
IS_SELENIUM_HEADLESS = os.environ.get('SELENIUM_HEADLESS', False)
|
IS_SELENIUM_HEADLESS = os.environ.get('SELENIUM_HEADLESS', False)
|
||||||
|
|
||||||
ROOT_PATH = os.path.dirname(os.path.abspath(config.__file__))
|
ROOT_PATH = os.path.dirname(os.path.abspath(config.__file__))
|
||||||
|
|
||||||
SCREEN_SIZE = (None, None)
|
SCREEN_SIZE = (None, None)
|
||||||
|
|
||||||
if not subprocess.call('which xdpyinfo > /dev/null 2>&1', shell=True):
|
if not subprocess.call('which xdpyinfo > /dev/null 2>&1', shell=True):
|
||||||
try:
|
try:
|
||||||
SCREEN_SIZE = subprocess.check_output('xdpyinfo | grep dimensions',
|
SCREEN_SIZE = subprocess.check_output(
|
||||||
shell=True).split()[1].split('x')
|
'xdpyinfo | grep dimensions',
|
||||||
|
shell=True).decode().split()[1].split('x')
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
LOG.info("Can't run 'xdpyinfo'")
|
LOG.info("Can't run 'xdpyinfo'")
|
||||||
else:
|
else:
|
||||||
|
@ -26,19 +26,21 @@ class VideoRecorder(object):
|
|||||||
def __init__(self, width, height, display='0.0', frame_rate=15):
|
def __init__(self, width, height, display='0.0', frame_rate=15):
|
||||||
self.is_launched = False
|
self.is_launched = False
|
||||||
self.file_path = mktemp() + '.mp4'
|
self.file_path = mktemp() + '.mp4'
|
||||||
# avconv -f x11grab -r 15 -s 1920x1080 -i :0.0 -codec libx264 out.mp4
|
# ffmpeg -video_size 1921x1080 -framerate 15 -f x11grab -i :0.0
|
||||||
self._cmd = ['avconv', '-f', 'x11grab', '-r', str(frame_rate),
|
self._cmd = ['ffmpeg',
|
||||||
'-s', '{}x{}'.format(width, height),
|
'-video_size', '{}x{}'.format(width, height),
|
||||||
|
'-framerate', str(frame_rate),
|
||||||
|
'-f', 'x11grab',
|
||||||
'-i', ':{}'.format(display),
|
'-i', ':{}'.format(display),
|
||||||
'-codec', 'libx264', self.file_path]
|
self.file_path]
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
if self.is_launched:
|
if self.is_launched:
|
||||||
LOG.warning('Video recording is running already')
|
LOG.warning('Video recording is running already')
|
||||||
return
|
return
|
||||||
|
|
||||||
if not os.environ.get('AVCONV_INSTALLED', False):
|
if not os.environ.get('FFMPEG_INSTALLED', False):
|
||||||
LOG.error("avconv isn't installed. Video recording is skipped")
|
LOG.error("ffmpeg isn't installed. Video recording is skipped")
|
||||||
return
|
return
|
||||||
|
|
||||||
fnull = open(os.devnull, 'w')
|
fnull = open(os.devnull, 'w')
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
- hosts: all
|
- hosts: all
|
||||||
environment:
|
environment:
|
||||||
OS_CLOUD: devstack-admin
|
OS_CLOUD: devstack-admin
|
||||||
|
FFMPEG_INSTALLED: True
|
||||||
roles:
|
roles:
|
||||||
- tox
|
- tox
|
6
tox.ini
6
tox.ini
@ -89,10 +89,12 @@ commands =
|
|||||||
[testenv:integration]
|
[testenv:integration]
|
||||||
envdir = {toxworkdir}/venv
|
envdir = {toxworkdir}/venv
|
||||||
# Run integration tests only
|
# Run integration tests only
|
||||||
passenv = AVCONV_INSTALLED
|
passenv =
|
||||||
|
DISPLAY
|
||||||
|
FFMPEG_INSTALLED
|
||||||
setenv =
|
setenv =
|
||||||
INTEGRATION_TESTS=1
|
INTEGRATION_TESTS=1
|
||||||
SELENIUM_HEADLESS=1
|
SELENIUM_HEADLESS=False
|
||||||
commands =
|
commands =
|
||||||
oslo-config-generator --namespace openstack_dashboard_integration_tests
|
oslo-config-generator --namespace openstack_dashboard_integration_tests
|
||||||
pytest {toxinidir}/openstack_dashboard/test/integration_tests --ds=openstack_dashboard.test.settings -v --junitxml="{toxinidir}/test_reports/integration_test_results.xml" --html="{toxinidir}/test_reports/integration_test_results.html" --self-contained-html {posargs}
|
pytest {toxinidir}/openstack_dashboard/test/integration_tests --ds=openstack_dashboard.test.settings -v --junitxml="{toxinidir}/test_reports/integration_test_results.xml" --html="{toxinidir}/test_reports/integration_test_results.html" --self-contained-html {posargs}
|
||||||
|
Loading…
Reference in New Issue
Block a user