diff options
author | Ivan Kolodyazhny <e0ne@e0ne.info> | 2020-03-10 04:39:54 -0700 |
---|---|---|
committer | Ivan Kolodyazhny <e0ne@e0ne.info> | 2020-04-09 09:20:04 +0000 |
commit | 8f887350e0642c0b81a1455e8619bc1e789e3dab (patch) | |
tree | 0311a43209abc684f4d16ac3cd1c7086b6000c19 | |
parent | 63cf09e07ead9f6810f2a850f29cf47da3ffae2e (diff) | |
download | horizon-8f887350e0642c0b81a1455e8619bc1e789e3dab.tar.gz |
Fix video recording for integration tests
libav-tools package doesn't exist anymore so we need to use ffmpeg now
to capture the screen.
Change-Id: I58384f42ded3ed864de0dc2a9a56d2d9943168b9
-rw-r--r-- | bindep.txt | 1 | ||||
-rw-r--r-- | openstack_dashboard/test/integration_tests/helpers.py | 6 | ||||
-rw-r--r-- | openstack_dashboard/test/integration_tests/video_recorder.py | 14 | ||||
-rw-r--r-- | playbooks/horizon-devstack-integration/run.yaml | 1 | ||||
-rw-r--r-- | tox.ini | 6 |
5 files changed, 18 insertions, 10 deletions
diff --git a/bindep.txt b/bindep.txt index da92738b2..6de4ffdf9 100644 --- a/bindep.txt +++ b/bindep.txt @@ -1,4 +1,5 @@ # selenium tests +ffmpeg [selenium] firefox [selenium] xvfb [selenium platform:dpkg] # already part of xorg-x11-server on openSUSE diff --git a/openstack_dashboard/test/integration_tests/helpers.py b/openstack_dashboard/test/integration_tests/helpers.py index bb1046f9a..f01db9a08 100644 --- a/openstack_dashboard/test/integration_tests/helpers.py +++ b/openstack_dashboard/test/integration_tests/helpers.py @@ -44,14 +44,16 @@ ROOT_LOGGER.setLevel(logging.DEBUG) LOG = logging.getLogger(__name__) IS_SELENIUM_HEADLESS = os.environ.get('SELENIUM_HEADLESS', False) + ROOT_PATH = os.path.dirname(os.path.abspath(config.__file__)) SCREEN_SIZE = (None, None) if not subprocess.call('which xdpyinfo > /dev/null 2>&1', shell=True): try: - SCREEN_SIZE = subprocess.check_output('xdpyinfo | grep dimensions', - shell=True).split()[1].split('x') + SCREEN_SIZE = subprocess.check_output( + 'xdpyinfo | grep dimensions', + shell=True).decode().split()[1].split('x') except subprocess.CalledProcessError: LOG.info("Can't run 'xdpyinfo'") else: diff --git a/openstack_dashboard/test/integration_tests/video_recorder.py b/openstack_dashboard/test/integration_tests/video_recorder.py index 9d7baf0ca..8002654a9 100644 --- a/openstack_dashboard/test/integration_tests/video_recorder.py +++ b/openstack_dashboard/test/integration_tests/video_recorder.py @@ -26,19 +26,21 @@ class VideoRecorder(object): def __init__(self, width, height, display='0.0', frame_rate=15): self.is_launched = False self.file_path = mktemp() + '.mp4' - # avconv -f x11grab -r 15 -s 1920x1080 -i :0.0 -codec libx264 out.mp4 - self._cmd = ['avconv', '-f', 'x11grab', '-r', str(frame_rate), - '-s', '{}x{}'.format(width, height), + # ffmpeg -video_size 1921x1080 -framerate 15 -f x11grab -i :0.0 + self._cmd = ['ffmpeg', + '-video_size', '{}x{}'.format(width, height), + '-framerate', str(frame_rate), + '-f', 'x11grab', '-i', ':{}'.format(display), - '-codec', 'libx264', self.file_path] + self.file_path] def start(self): if self.is_launched: LOG.warning('Video recording is running already') return - if not os.environ.get('AVCONV_INSTALLED', False): - LOG.error("avconv isn't installed. Video recording is skipped") + if not os.environ.get('FFMPEG_INSTALLED', False): + LOG.error("ffmpeg isn't installed. Video recording is skipped") return fnull = open(os.devnull, 'w') diff --git a/playbooks/horizon-devstack-integration/run.yaml b/playbooks/horizon-devstack-integration/run.yaml index e550cc953..f18cc054b 100644 --- a/playbooks/horizon-devstack-integration/run.yaml +++ b/playbooks/horizon-devstack-integration/run.yaml @@ -2,5 +2,6 @@ - hosts: all environment: OS_CLOUD: devstack-admin + FFMPEG_INSTALLED: True roles: - tox
\ No newline at end of file @@ -83,10 +83,12 @@ setenv = [testenv:integration] envdir = {toxworkdir}/venv # Run integration tests only -passenv = AVCONV_INSTALLED +passenv = + DISPLAY + FFMPEG_INSTALLED setenv = INTEGRATION_TESTS=1 - SELENIUM_HEADLESS=1 + SELENIUM_HEADLESS=False commands = oslo-config-generator --namespace openstack_dashboard_integration_tests {envpython} {toxinidir}/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings --verbosity 2 --tag integration {posargs} |