mirror of https://github.com/OpenVidu/openvidu.git
openvidu-deployment-tester: Improve docker cache of drivers. Document how to develop the deployment tester image
parent
92048dcf7a
commit
09d89b2cdb
|
@ -0,0 +1,3 @@
|
||||||
|
python_modules/
|
||||||
|
src/geckodriver.*
|
||||||
|
*/__pycache__/
|
|
@ -1,7 +1,9 @@
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive \
|
ENV DEBIAN_FRONTEND noninteractive \
|
||||||
DISPLAY :99.0
|
DISPLAY :99.0 \
|
||||||
|
GECKO_DRIVER_LOCATION /usr/local/bin/geckodriver \
|
||||||
|
CHROME_DRIVER_LOCATION /usr/local/bin/chromedriver
|
||||||
|
|
||||||
# Install Software
|
# Install Software
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
|
|
|
@ -80,3 +80,41 @@ docker run openvidu/openvidu-deployment-tester basic-test \
|
||||||
### 2. Recording tests
|
### 2. Recording tests
|
||||||
|
|
||||||
Working on...
|
Working on...
|
||||||
|
|
||||||
|
## Development and Build instructions
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
- Python >= 3
|
||||||
|
- pip
|
||||||
|
- virtualenv
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
1. In the directory of this README file, create a virtual environment and activate it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
virtualenv -p python3 python_modules
|
||||||
|
|
||||||
|
source python_modules/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Install the python dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Run the script:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd src
|
||||||
|
|
||||||
|
python main.py -h
|
||||||
|
```
|
||||||
|
|
||||||
|
4. To build the docker image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./create_imagh.sh latest
|
||||||
|
```
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
# Iniciar XVFB
|
# DISPLAY variable is used by Selenium to know which X server to use
|
||||||
export DISPLAY_NUM=99
|
export DISPLAY_NUM=99
|
||||||
export DISPLAY=":${DISPLAY_NUM}"
|
export DISPLAY=":${DISPLAY_NUM}"
|
||||||
|
|
||||||
# Esperar hasta que XVFB esté listo
|
# Wait for Xvfb to be ready. If not ready after 2 seconds, try next display
|
||||||
while ! xdpyinfo -display "${DISPLAY}" >/dev/null 2>&1; do
|
while ! xdpyinfo -display "${DISPLAY}" >/dev/null 2>&1; do
|
||||||
DISPLAY_NUM=$((DISPLAY_NUM+1))
|
DISPLAY_NUM=$((DISPLAY_NUM+1))
|
||||||
DISPLAY=":${DISPLAY_NUM}"
|
DISPLAY=":${DISPLAY_NUM}"
|
||||||
|
|
|
@ -22,7 +22,7 @@ def install_drivers(chrome_version, gecko_version):
|
||||||
|
|
||||||
with open("chrome_version", "w") as f:
|
with open("chrome_version", "w") as f:
|
||||||
f.write(chrome_driver_manager.driver.get_version())
|
f.write(chrome_driver_manager.driver.get_version())
|
||||||
with open("firefox_version", "w") as f:
|
with open("gecko_version", "w") as f:
|
||||||
f.write(firefox_driver_manager.driver.get_version())
|
f.write(firefox_driver_manager.driver.get_version())
|
||||||
|
|
||||||
def authenticated_url(openvidu_url, openvidu_secret):
|
def authenticated_url(openvidu_url, openvidu_secret):
|
||||||
|
@ -42,16 +42,15 @@ def runBrowser(browser, turn=False):
|
||||||
return driver
|
return driver
|
||||||
|
|
||||||
def runChrome():
|
def runChrome():
|
||||||
# Get Chrome driver version from environment variable
|
driver_location = os.environ.get("CHROME_DRIVER_LOCATION")
|
||||||
chrome_version = os.environ.get("CHROME_VERSION")
|
|
||||||
|
|
||||||
# Get Chrome driver version from file if not found in environment variable
|
# Load version from file
|
||||||
# Read it only if file exist (it may not exist if running in a container)
|
chrome_version = None
|
||||||
if chrome_version is None and os.path.isfile("chrome_version"):
|
|
||||||
with open("chrome_version", "r") as f:
|
with open("chrome_version", "r") as f:
|
||||||
chrome_version = f.read()
|
chrome_version = f.read()
|
||||||
print("Chrome version: ", chrome_version)
|
|
||||||
print("Running chrome...")
|
print("Running chrome...")
|
||||||
|
print("Chrome version: ", chrome_version)
|
||||||
options = webdriver.ChromeOptions()
|
options = webdriver.ChromeOptions()
|
||||||
options.add_argument("--use-fake-ui-for-media-stream")
|
options.add_argument("--use-fake-ui-for-media-stream")
|
||||||
options.add_argument("--disable-infobars")
|
options.add_argument("--disable-infobars")
|
||||||
|
@ -61,21 +60,19 @@ def runChrome():
|
||||||
options.add_argument("--no-sandbox")
|
options.add_argument("--no-sandbox")
|
||||||
|
|
||||||
return webdriver.Chrome(
|
return webdriver.Chrome(
|
||||||
service=ChromeService(ChromeDriverManager(version=chrome_version).install()),
|
service=ChromeService(ChromeDriverManager(path=driver_location, version=chrome_version).install()),
|
||||||
options = options)
|
options = options)
|
||||||
|
|
||||||
def runFirefox(turn=False):
|
def runFirefox(turn=False):
|
||||||
# Get Gecko driver version from environment variable
|
driver_location = os.environ.get("GECKO_DRIVER_LOCATION")
|
||||||
gecko_version = os.environ.get("GECKO_VERSION")
|
|
||||||
|
|
||||||
# Get Gecko driver version from file if not found in environment variable
|
# Load version from file
|
||||||
# Read it only if file exist (it may not exist if running in a container)
|
gecko_version = None
|
||||||
if gecko_version is None and os.path.isfile("firefox_version"):
|
with open("gecko_version", "r") as f:
|
||||||
with open("firefox_version", "r") as f:
|
|
||||||
gecko_version = f.read()
|
gecko_version = f.read()
|
||||||
|
|
||||||
print("Gecko version: ", gecko_version)
|
|
||||||
print("Running firefox with Turn: ", turn)
|
print("Running firefox with Turn: ", turn)
|
||||||
|
print("Gecko version: ", gecko_version)
|
||||||
options = webdriver.FirefoxOptions()
|
options = webdriver.FirefoxOptions()
|
||||||
options.set_preference('media.navigator.permission.disabled', True)
|
options.set_preference('media.navigator.permission.disabled', True)
|
||||||
options.set_preference('media.navigator.streams.fake', True)
|
options.set_preference('media.navigator.streams.fake', True)
|
||||||
|
@ -89,7 +86,7 @@ def runFirefox(turn=False):
|
||||||
options.set_preference('media.peerconnection.turn.disable', not turn)
|
options.set_preference('media.peerconnection.turn.disable', not turn)
|
||||||
|
|
||||||
return webdriver.Firefox(
|
return webdriver.Firefox(
|
||||||
service=FirefoxService(GeckoDriverManager(version=gecko_version).install()),
|
service=FirefoxService(GeckoDriverManager(path=driver_location, version=gecko_version).install()),
|
||||||
options = options)
|
options = options)
|
||||||
|
|
||||||
def print_candidates(driver):
|
def print_candidates(driver):
|
||||||
|
|
Loading…
Reference in New Issue