Skip to content

Commit

Permalink
Fix selenium crash (#19)
Browse files Browse the repository at this point in the history
* [CI] actually fail job when tests fail

The exit code from tests was being masked by the exit codes reported
when generating coverage reports which meant that even if tests failed,
as long as coverage report generation was succesful, the job would not
fail.

Therefore the exit code for tests is now stored and used.

* [FIX] update chrome resource limits

With previous resource limits Selenium tests would crash with a "window
tab crashed" error message. The new limits match Odoo's limits used for
testing[1] and fix said issue.

[1] https://github.com/Vauxoo/odoo/blob/9d51fa9d/odoo/tests/common.py#L1003
  • Loading branch information
antonag32 authored Aug 14, 2024
1 parent f76848d commit 2eb8d1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash

coverage run /usr/bin/odoo -i test_selenium --test-tags /test_selenium --workers=0 --stop-after-init
TEST_EXIT_CODE=$?

coverage report --show-missing
coverage html
coverage xml

exit "$TEST_EXIT_CODE"
4 changes: 2 additions & 2 deletions src/odoo_selenium/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
import unittest
from os import environ
from resource import RLIMIT_AS, setrlimit
from resource import RLIM_INFINITY, RLIMIT_AS, setrlimit
from urllib.parse import urljoin

from selenium.webdriver import Chrome, ChromeOptions, Remote
Expand Down Expand Up @@ -85,7 +85,7 @@ def start_selenium(self):
if grid_url:
self.driver = Remote(command_executor=grid_url, options=ChromeOptions())
else:
setrlimit(RLIMIT_AS, (16**9, 16**9))
setrlimit(RLIMIT_AS, (RLIM_INFINITY, RLIM_INFINITY))

options = Options()
for key, value in self.chrome_flags.items():
Expand Down

0 comments on commit 2eb8d1e

Please sign in to comment.