Skip to content

Release

Release #251

This check has been archived and is scheduled for deletion. Learn more about checks retention
GitHub Actions / OpenWPM failed Oct 21, 2023 in 0s

OpenWPM ❌

Tests failed

❌ junit-report.xml

21 tests were completed in 1658s with 15 passed, 6 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 15✅ 6❌ 1658s

❌ pytest

test.test_profile
  ✅ test_saving
  ✅ test_save_incomplete_profile_error
  ✅ test_crash_profile
  ❌ test_profile_error
	self = <openwpm.task_manager.TaskManager object at 0x7f5aa5fb1cd0>
  ❌ test_profile_saved_when_launch_crashes
	monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5aa5ee9ca0>
  ✅ test_seed_persistence
  ✅ test_dump_profile_command
  ✅ test_load_tar_file
  ❌ test_crash_during_init
	self = <openwpm.task_manager.TaskManager object at 0x7f5aa5fadfd0>
  ✅ test_profile_recovery[on_normal_operation-stateful-without_seed_tar]
  ✅ test_profile_recovery[on_normal_operation-stateful-with_seed_tar]
  ✅ test_profile_recovery[on_normal_operation-stateless-with_seed_tar]
  ✅ test_profile_recovery[on_crash-stateful-without_seed_tar]
  ✅ test_profile_recovery[on_crash-stateful-with_seed_tar]
  ✅ test_profile_recovery[on_crash-stateless-with_seed_tar]
  ❌ test_profile_recovery[on_crash_during_launch-stateful-without_seed_tar]
	monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab1c8bd10>
  ❌ test_profile_recovery[on_crash_during_launch-stateful-with_seed_tar]
	monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab1c79be0>
  ❌ test_profile_recovery[on_crash_during_launch-stateless-with_seed_tar]
	monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab1bd60c0>
  ✅ test_profile_recovery[on_timeout-stateful-without_seed_tar]
  ✅ test_profile_recovery[on_timeout-stateful-with_seed_tar]
  ✅ test_profile_recovery[on_timeout-stateless-with_seed_tar]

Annotations

Check failure on line 0 in junit-report.xml

See this annotation in the file changed.

@github-actions github-actions / OpenWPM

pytest ► test.test_profile ► test_profile_error

Failed test found in:
  junit-report.xml
Error:
  self = <openwpm.task_manager.TaskManager object at 0x7f5aa5fb1cd0>
Raw output
self = <openwpm.task_manager.TaskManager object at 0x7f5aa5fb1cd0>

    def _launch_browsers(self) -> None:
        """launch each browser manager process / browser"""
        for browser in self.browsers:
            try:
>               success = browser.launch_browser_manager()

/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:200: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:178: in launch_browser_manager
    check_queue(launch_status)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:149: in check_queue
    raise exc.with_traceback(tb)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:731: in run
    driver, browser_profile_path, display = deploy_firefox.deploy_firefox(
/home/runner/work/OpenWPM/OpenWPM/openwpm/deploy_browsers/deploy_firefox.py:59: in deploy_firefox
    load_profile(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    import logging
    import tarfile
    from pathlib import Path
    
    from selenium.webdriver import Firefox
    
    from openwpm.config import BrowserParamsInternal, ManagerParamsInternal
    
    from ..errors import ProfileLoadError
    from ..socket_interface import ClientSocket
    from .types import BaseCommand
    from .utils.firefox_profile import sleep_until_sqlite_checkpoint
    
    logger = logging.getLogger("openwpm")
    
    
    def dump_profile(
        browser_profile_path: Path,
        tar_path: Path,
        compress: bool,
        browser_params: BrowserParamsInternal,
    ) -> None:
        """Dumps a browser profile to a tar file.
    
        Should only be called when the browser is closed, to prevent
        database corruption in the archived profile (see section 1.2
        of https://www.sqlite.org/howtocorrupt.html).
        """
        assert browser_params.browser_id is not None
    
        # Creating the folders if need be
        tar_path.parent.mkdir(exist_ok=True, parents=True)
    
        # see if this file exists first
        # if it does, delete it before we try to save the current session
        if tar_path.exists():
            tar_path.unlink()
    
        # backup and tar profile
        if compress:
            tar = tarfile.open(tar_path, "w:gz", errorlevel=1)
        else:
            tar = tarfile.open(tar_path, "w", errorlevel=1)
        logger.debug(
            "BROWSER %i: Backing up full profile from %s to %s"
            % (browser_params.browser_id, browser_profile_path, tar_path)
        )
    
        tar.add(browser_profile_path, arcname="")
        archived_items = tar.getnames()
        tar.close()
    
        required_items = [
            "cookies.sqlite",  # cookies
            "places.sqlite",  # history
            "webappsstore.sqlite",  # localStorage
        ]
        for item in required_items:
            if item not in archived_items:
                logger.critical(
                    "BROWSER %i: %s NOT FOUND IN profile folder"
                    % (browser_params.browser_id, item)
                )
                raise RuntimeError("Profile dump not successful")
    
    
    class DumpProfileCommand(BaseCommand):
        """
        Dumps a browser profile currently stored in <browser_params.profile_path> to
        <tar_path>.
        """
    
        def __init__(
            self, tar_path: Path, close_webdriver: bool, compress: bool = True
        ) -> None:
            self.tar_path = tar_path
            self.close_webdriver = close_webdriver
            self.compress = compress
    
        def __repr__(self) -> str:
            return "DumpProfileCommand({},{},{})".format(
                self.tar_path, self.close_webdriver, self.compress
            )
    
        def execute(
            self,
            webdriver: Firefox,
            browser_params: BrowserParamsInternal,
            manager_params: ManagerParamsInternal,
            extension_socket: ClientSocket,
        ) -> None:
            # if this is a dump on close, close the webdriver and wait for checkpoint
            if self.close_webdriver:
                webdriver.close()
                sleep_until_sqlite_checkpoint(browser_params.profile_path)
    
            assert browser_params.profile_path is not None
            dump_profile(
                browser_params.profile_path,
                self.tar_path,
                self.compress,
                browser_params,
            )
    
    
    def load_profile(
        browser_profile_path: Path,
        browser_params: BrowserParamsInternal,
        tar_path: Path,
    ) -> None:
        """
        Loads a zipped cookie-based profile stored at <tar_path> and unzips
        it to <browser_profile_path>. The tar will remain unmodified.
        """
        assert browser_params.browser_id is not None
        try:
            assert tar_path.is_file()
            # Untar the loaded profile
            if tar_path.name.endswith("tar.gz"):
                f = tarfile.open(tar_path, "r:gz", errorlevel=1)
            else:
                f = tarfile.open(tar_path, "r", errorlevel=1)
            f.extractall(browser_profile_path)
            f.close()
            logger.debug("BROWSER %i: Tarfile extracted" % browser_params.browser_id)
    
        except Exception as ex:
            logger.critical(
                "BROWSER %i: Error: %s while attempting to load profile"
                % (browser_params.browser_id, str(ex))
            )
>           raise ProfileLoadError("Profile Load not successful")
E           openwpm.errors.ProfileLoadError: Profile Load not successful

/home/runner/work/OpenWPM/OpenWPM/openwpm/commands/profile_commands.py:132: ProfileLoadError

During handling of the above exception, another exception occurred:

default_params = (ManagerParams(data_directory=PosixPath('/tmp/pytest-of-runner/pytest-0/test_profile_error0'), log_path=PosixPath('/tm...'/tmp'), maximum_profile_size=None, recovery_tar=None, donottrack=False, tracking_protection=False, custom_params={})])
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7f5aa5f05120>

    def test_profile_error(default_params, task_manager_creator):
        manager_params, browser_params = default_params
        manager_params.num_browsers = 1
        browser_params[0].seed_tar = Path("/tmp/NOTREAL")
        with pytest.raises(ProfileLoadError):
>           task_manager_creator((manager_params, browser_params[:1]))

/home/runner/work/OpenWPM/OpenWPM/test/test_profile.py:86: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/OpenWPM/OpenWPM/test/conftest.py:80: in _create_task_manager
    manager = TaskManager(
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:125: in __init__
    self._launch_browsers()
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:202: in _launch_browsers
    self._shutdown_manager(during_init=True)
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:326: in _shutdown_manager
    browser.shutdown_browser(during_init, force=not relaxed)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:610: in shutdown_browser
    self.close_browser_manager(force=force)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:341: in close_browser_manager
    self.kill_browser_manager()
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:550: in kill_browser_manager
    self.logger.debug(
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1527: in debug
    self._log(DEBUG, msg, args, **kwargs)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1684: in _log
    self.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1700: in handle
    self.callHandlers(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1762: in callHandlers
    hdlr.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1028: in handle
    self.emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:372: in emit
    super().emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1168: in emit
    self.handleError(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1160: in emit
    msg = self.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:999: in format
    return fmt.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:136: in format
    return super().format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:703: in format
    record.message = record.getMessage()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <LogRecord: openwpm, 10, /home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py, 550, "BROWSER %i: Attempting to kill BrowserManager with pid %i. Browser PID: %s">

    def getMessage(self):
        """
        Return the message for this LogRecord.
    
        Return the message for this LogRecord after merging any user-supplied
        arguments with the message.
        """
        msg = str(self.msg)
        if self.args:
>           msg = msg % self.args
E           TypeError: %i format: a real number is required, not tuple

/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:392: TypeError

Check failure on line 0 in junit-report.xml

See this annotation in the file changed.

@github-actions github-actions / OpenWPM

pytest ► test.test_profile ► test_profile_saved_when_launch_crashes

Failed test found in:
  junit-report.xml
Error:
  monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5aa5ee9ca0>
Raw output
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5aa5ee9ca0>
default_params = (ManagerParams(data_directory=PosixPath('/tmp/pytest-of-runner/pytest-0/test_profile_saved_when_launch0'), log_path=Po...'/tmp'), maximum_profile_size=None, recovery_tar=None, donottrack=False, tracking_protection=False, custom_params={})])
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7f5ab1de2160>

    def test_profile_saved_when_launch_crashes(
        monkeypatch, default_params, task_manager_creator
    ):
        manager_params, browser_params = default_params
        manager_params.num_browsers = 1
        browser_params[0].profile_archive_dir = (
            manager_params.data_directory / "browser_profile"
        )
        manager, _ = task_manager_creator((manager_params, browser_params[:1]))
        manager.get(BASE_TEST_URL)
    
        # This will cause browser restarts to fail
        monkeypatch.setenv("FIREFOX_BINARY", "/tmp/NOTREAL")
        manager.browsers[0]._SPAWN_TIMEOUT = 2  # Have timeout occur quickly
        manager.browsers[0]._UNSUCCESSFUL_SPAWN_LIMIT = 2  # Quick timeout
        manager.get("example.com")  # Cause a selenium crash to force browser to restart
    
        try:
            manager.get(BASE_TEST_URL)
        except CommandExecutionError:
            pass
>       manager.close()

/home/runner/work/OpenWPM/OpenWPM/test/test_profile.py:110: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:505: in close
    self._shutdown_manager(relaxed=relaxed)
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:326: in _shutdown_manager
    browser.shutdown_browser(during_init, force=not relaxed)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:610: in shutdown_browser
    self.close_browser_manager(force=force)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:341: in close_browser_manager
    self.kill_browser_manager()
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:550: in kill_browser_manager
    self.logger.debug(
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1527: in debug
    self._log(DEBUG, msg, args, **kwargs)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1684: in _log
    self.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1700: in handle
    self.callHandlers(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1762: in callHandlers
    hdlr.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1028: in handle
    self.emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:372: in emit
    super().emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1168: in emit
    self.handleError(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1160: in emit
    msg = self.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:999: in format
    return fmt.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:136: in format
    return super().format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:703: in format
    record.message = record.getMessage()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <LogRecord: openwpm, 10, /home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py, 550, "BROWSER %i: Attempting to kill BrowserManager with pid %i. Browser PID: %s">

    def getMessage(self):
        """
        Return the message for this LogRecord.
    
        Return the message for this LogRecord after merging any user-supplied
        arguments with the message.
        """
        msg = str(self.msg)
        if self.args:
>           msg = msg % self.args
E           TypeError: %i format: a real number is required, not tuple

/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:392: TypeError

Check failure on line 0 in junit-report.xml

See this annotation in the file changed.

@github-actions github-actions / OpenWPM

pytest ► test.test_profile ► test_crash_during_init

Failed test found in:
  junit-report.xml
Error:
  self = <openwpm.task_manager.TaskManager object at 0x7f5aa5fadfd0>
Raw output
self = <openwpm.task_manager.TaskManager object at 0x7f5aa5fadfd0>

    def _launch_browsers(self) -> None:
        """launch each browser manager process / browser"""
        for browser in self.browsers:
            try:
>               success = browser.launch_browser_manager()

/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:200: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:178: in launch_browser_manager
    check_queue(launch_status)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:149: in check_queue
    raise exc.with_traceback(tb)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:731: in run
    driver, browser_profile_path, display = deploy_firefox.deploy_firefox(
/home/runner/work/OpenWPM/OpenWPM/openwpm/deploy_browsers/deploy_firefox.py:59: in deploy_firefox
    load_profile(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    import logging
    import tarfile
    from pathlib import Path
    
    from selenium.webdriver import Firefox
    
    from openwpm.config import BrowserParamsInternal, ManagerParamsInternal
    
    from ..errors import ProfileLoadError
    from ..socket_interface import ClientSocket
    from .types import BaseCommand
    from .utils.firefox_profile import sleep_until_sqlite_checkpoint
    
    logger = logging.getLogger("openwpm")
    
    
    def dump_profile(
        browser_profile_path: Path,
        tar_path: Path,
        compress: bool,
        browser_params: BrowserParamsInternal,
    ) -> None:
        """Dumps a browser profile to a tar file.
    
        Should only be called when the browser is closed, to prevent
        database corruption in the archived profile (see section 1.2
        of https://www.sqlite.org/howtocorrupt.html).
        """
        assert browser_params.browser_id is not None
    
        # Creating the folders if need be
        tar_path.parent.mkdir(exist_ok=True, parents=True)
    
        # see if this file exists first
        # if it does, delete it before we try to save the current session
        if tar_path.exists():
            tar_path.unlink()
    
        # backup and tar profile
        if compress:
            tar = tarfile.open(tar_path, "w:gz", errorlevel=1)
        else:
            tar = tarfile.open(tar_path, "w", errorlevel=1)
        logger.debug(
            "BROWSER %i: Backing up full profile from %s to %s"
            % (browser_params.browser_id, browser_profile_path, tar_path)
        )
    
        tar.add(browser_profile_path, arcname="")
        archived_items = tar.getnames()
        tar.close()
    
        required_items = [
            "cookies.sqlite",  # cookies
            "places.sqlite",  # history
            "webappsstore.sqlite",  # localStorage
        ]
        for item in required_items:
            if item not in archived_items:
                logger.critical(
                    "BROWSER %i: %s NOT FOUND IN profile folder"
                    % (browser_params.browser_id, item)
                )
                raise RuntimeError("Profile dump not successful")
    
    
    class DumpProfileCommand(BaseCommand):
        """
        Dumps a browser profile currently stored in <browser_params.profile_path> to
        <tar_path>.
        """
    
        def __init__(
            self, tar_path: Path, close_webdriver: bool, compress: bool = True
        ) -> None:
            self.tar_path = tar_path
            self.close_webdriver = close_webdriver
            self.compress = compress
    
        def __repr__(self) -> str:
            return "DumpProfileCommand({},{},{})".format(
                self.tar_path, self.close_webdriver, self.compress
            )
    
        def execute(
            self,
            webdriver: Firefox,
            browser_params: BrowserParamsInternal,
            manager_params: ManagerParamsInternal,
            extension_socket: ClientSocket,
        ) -> None:
            # if this is a dump on close, close the webdriver and wait for checkpoint
            if self.close_webdriver:
                webdriver.close()
                sleep_until_sqlite_checkpoint(browser_params.profile_path)
    
            assert browser_params.profile_path is not None
            dump_profile(
                browser_params.profile_path,
                self.tar_path,
                self.compress,
                browser_params,
            )
    
    
    def load_profile(
        browser_profile_path: Path,
        browser_params: BrowserParamsInternal,
        tar_path: Path,
    ) -> None:
        """
        Loads a zipped cookie-based profile stored at <tar_path> and unzips
        it to <browser_profile_path>. The tar will remain unmodified.
        """
        assert browser_params.browser_id is not None
        try:
            assert tar_path.is_file()
            # Untar the loaded profile
            if tar_path.name.endswith("tar.gz"):
                f = tarfile.open(tar_path, "r:gz", errorlevel=1)
            else:
                f = tarfile.open(tar_path, "r", errorlevel=1)
            f.extractall(browser_profile_path)
            f.close()
            logger.debug("BROWSER %i: Tarfile extracted" % browser_params.browser_id)
    
        except Exception as ex:
            logger.critical(
                "BROWSER %i: Error: %s while attempting to load profile"
                % (browser_params.browser_id, str(ex))
            )
>           raise ProfileLoadError("Profile Load not successful")
E           openwpm.errors.ProfileLoadError: Profile Load not successful

/home/runner/work/OpenWPM/OpenWPM/openwpm/commands/profile_commands.py:132: ProfileLoadError

During handling of the above exception, another exception occurred:

default_params = (ManagerParams(data_directory=PosixPath('/tmp/pytest-of-runner/pytest-0/test_crash_during_init0'), log_path=PosixPath(...'/tmp'), maximum_profile_size=None, recovery_tar=None, donottrack=False, tracking_protection=False, custom_params={})])
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7f5ab1de2fc0>

    def test_crash_during_init(default_params, task_manager_creator):
        """Test that no profile is saved when Task Manager initialization crashes."""
        manager_params, browser_params = default_params
        manager_params.num_browsers = 1
        browser_params[0].profile_archive_dir = (
            manager_params.data_directory / "browser_profile"
        )
        # This will cause the browser launch to fail
        browser_params[0].seed_tar = Path("/tmp/NOTREAL")
        with pytest.raises(ProfileLoadError):
>           manager, _ = task_manager_creator((manager_params, browser_params[:1]))

/home/runner/work/OpenWPM/OpenWPM/test/test_profile.py:202: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/OpenWPM/OpenWPM/test/conftest.py:80: in _create_task_manager
    manager = TaskManager(
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:125: in __init__
    self._launch_browsers()
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:202: in _launch_browsers
    self._shutdown_manager(during_init=True)
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:326: in _shutdown_manager
    browser.shutdown_browser(during_init, force=not relaxed)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:610: in shutdown_browser
    self.close_browser_manager(force=force)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:341: in close_browser_manager
    self.kill_browser_manager()
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:550: in kill_browser_manager
    self.logger.debug(
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1527: in debug
    self._log(DEBUG, msg, args, **kwargs)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1684: in _log
    self.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1700: in handle
    self.callHandlers(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1762: in callHandlers
    hdlr.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1028: in handle
    self.emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:372: in emit
    super().emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1168: in emit
    self.handleError(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1160: in emit
    msg = self.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:999: in format
    return fmt.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:136: in format
    return super().format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:703: in format
    record.message = record.getMessage()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <LogRecord: openwpm, 10, /home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py, 550, "BROWSER %i: Attempting to kill BrowserManager with pid %i. Browser PID: %s">

    def getMessage(self):
        """
        Return the message for this LogRecord.
    
        Return the message for this LogRecord after merging any user-supplied
        arguments with the message.
        """
        msg = str(self.msg)
        if self.args:
>           msg = msg % self.args
E           TypeError: %i format: a real number is required, not tuple

/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:392: TypeError

Check failure on line 0 in junit-report.xml

See this annotation in the file changed.

@github-actions github-actions / OpenWPM

pytest ► test.test_profile ► test_profile_recovery[on_crash_during_launch-stateful-without_seed_tar]

Failed test found in:
  junit-report.xml
Error:
  monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab1c8bd10>
Raw output
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab1c8bd10>
default_params = (ManagerParams(data_directory=PosixPath('/tmp/pytest-of-runner/pytest-0/test_profile_recovery_on_crash3'), log_path=Po...'/tmp'), maximum_profile_size=None, recovery_tar=None, donottrack=False, tracking_protection=False, custom_params={})])
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7f5ab1cc6980>
testcase = 'on_crash_during_launch', stateful = True, seed_tar = None

    @pytest.mark.parametrize(
        "stateful,seed_tar",
        [(True, None), (True, Path("profile.tar.gz")), (False, Path("profile.tar.gz"))],
        ids=[
            "stateful-without_seed_tar",
            "stateful-with_seed_tar",
            "stateless-with_seed_tar",
        ],
    )
    @pytest.mark.parametrize(
        "testcase",
        ["on_normal_operation", "on_crash", "on_crash_during_launch", "on_timeout"],
    )
    # Use -k to run this test for a specific set of parameters. For example:
    # pytest -vv test_profile.py::test_profile_recovery -k on_crash-stateful-with_seed_tar
    def test_profile_recovery(
        monkeypatch, default_params, task_manager_creator, testcase, stateful, seed_tar
    ):
        """Test browser profile recovery in various scenarios."""
        manager_params, browser_params = default_params
        manager_params.num_browsers = 1
        browser_params[0].seed_tar = seed_tar
        manager, db = task_manager_creator((manager_params, browser_params[:1]))
        manager.get(BASE_TEST_URL, reset=not stateful)
    
        if testcase == "normal_operation":
            pass
        elif testcase == "on_crash":
            # Cause a selenium crash to force browser to restart
            manager.get("example.com", reset=not stateful)
        elif testcase == "on_crash_during_launch":
            # Cause a selenium crash to force browser to restart
            manager.get("example.com", reset=not stateful)
            # This will cause browser restarts to fail
            monkeypatch.setenv("FIREFOX_BINARY", "/tmp/NOTREAL")
    
            # Let the launch succeed after some failed launch attempts
            def undo_monkeypatch():
                time.sleep(5)  # This should be smaller than _SPAWN_TIMEOUT
                monkeypatch.undo()
    
            Thread(target=undo_monkeypatch).start()
        elif testcase == "on_timeout":
            # Set a very low timeout to cause a restart
            manager.get("about:config", reset=not stateful, timeout=0.1)
    
        cs = CommandSequence("about:config", reset=not stateful)
        expected_value = True if seed_tar else False
        cs.append_command(AssertConfigSetCommand("test_pref", expected_value))
        tar_directory = manager_params.data_directory / "browser_profile"
        tar_path = tar_directory / "profile.tar.gz"
        cs.dump_profile(tar_path, True)
        manager.execute_command_sequence(cs)
>       manager.close()

/home/runner/work/OpenWPM/OpenWPM/test/test_profile.py:260: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:505: in close
    self._shutdown_manager(relaxed=relaxed)
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:326: in _shutdown_manager
    browser.shutdown_browser(during_init, force=not relaxed)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:610: in shutdown_browser
    self.close_browser_manager(force=force)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:341: in close_browser_manager
    self.kill_browser_manager()
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:550: in kill_browser_manager
    self.logger.debug(
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1527: in debug
    self._log(DEBUG, msg, args, **kwargs)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1684: in _log
    self.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1700: in handle
    self.callHandlers(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1762: in callHandlers
    hdlr.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1028: in handle
    self.emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:372: in emit
    super().emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1168: in emit
    self.handleError(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1160: in emit
    msg = self.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:999: in format
    return fmt.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:136: in format
    return super().format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:703: in format
    record.message = record.getMessage()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <LogRecord: openwpm, 10, /home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py, 550, "BROWSER %i: Attempting to kill BrowserManager with pid %i. Browser PID: %s">

    def getMessage(self):
        """
        Return the message for this LogRecord.
    
        Return the message for this LogRecord after merging any user-supplied
        arguments with the message.
        """
        msg = str(self.msg)
        if self.args:
>           msg = msg % self.args
E           TypeError: %i format: a real number is required, not tuple

/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:392: TypeError

Check failure on line 0 in junit-report.xml

See this annotation in the file changed.

@github-actions github-actions / OpenWPM

pytest ► test.test_profile ► test_profile_recovery[on_crash_during_launch-stateful-with_seed_tar]

Failed test found in:
  junit-report.xml
Error:
  monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab1c79be0>
Raw output
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab1c79be0>
default_params = (ManagerParams(data_directory=PosixPath('/tmp/pytest-of-runner/pytest-0/test_profile_recovery_on_crash4'), log_path=Po...'/tmp'), maximum_profile_size=None, recovery_tar=None, donottrack=False, tracking_protection=False, custom_params={})])
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7f5ab1caa0c0>
testcase = 'on_crash_during_launch', stateful = True
seed_tar = PosixPath('profile.tar.gz')

    @pytest.mark.parametrize(
        "stateful,seed_tar",
        [(True, None), (True, Path("profile.tar.gz")), (False, Path("profile.tar.gz"))],
        ids=[
            "stateful-without_seed_tar",
            "stateful-with_seed_tar",
            "stateless-with_seed_tar",
        ],
    )
    @pytest.mark.parametrize(
        "testcase",
        ["on_normal_operation", "on_crash", "on_crash_during_launch", "on_timeout"],
    )
    # Use -k to run this test for a specific set of parameters. For example:
    # pytest -vv test_profile.py::test_profile_recovery -k on_crash-stateful-with_seed_tar
    def test_profile_recovery(
        monkeypatch, default_params, task_manager_creator, testcase, stateful, seed_tar
    ):
        """Test browser profile recovery in various scenarios."""
        manager_params, browser_params = default_params
        manager_params.num_browsers = 1
        browser_params[0].seed_tar = seed_tar
        manager, db = task_manager_creator((manager_params, browser_params[:1]))
        manager.get(BASE_TEST_URL, reset=not stateful)
    
        if testcase == "normal_operation":
            pass
        elif testcase == "on_crash":
            # Cause a selenium crash to force browser to restart
            manager.get("example.com", reset=not stateful)
        elif testcase == "on_crash_during_launch":
            # Cause a selenium crash to force browser to restart
            manager.get("example.com", reset=not stateful)
            # This will cause browser restarts to fail
            monkeypatch.setenv("FIREFOX_BINARY", "/tmp/NOTREAL")
    
            # Let the launch succeed after some failed launch attempts
            def undo_monkeypatch():
                time.sleep(5)  # This should be smaller than _SPAWN_TIMEOUT
                monkeypatch.undo()
    
            Thread(target=undo_monkeypatch).start()
        elif testcase == "on_timeout":
            # Set a very low timeout to cause a restart
            manager.get("about:config", reset=not stateful, timeout=0.1)
    
        cs = CommandSequence("about:config", reset=not stateful)
        expected_value = True if seed_tar else False
        cs.append_command(AssertConfigSetCommand("test_pref", expected_value))
        tar_directory = manager_params.data_directory / "browser_profile"
        tar_path = tar_directory / "profile.tar.gz"
        cs.dump_profile(tar_path, True)
        manager.execute_command_sequence(cs)
>       manager.close()

/home/runner/work/OpenWPM/OpenWPM/test/test_profile.py:260: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:505: in close
    self._shutdown_manager(relaxed=relaxed)
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:326: in _shutdown_manager
    browser.shutdown_browser(during_init, force=not relaxed)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:610: in shutdown_browser
    self.close_browser_manager(force=force)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:341: in close_browser_manager
    self.kill_browser_manager()
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:550: in kill_browser_manager
    self.logger.debug(
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1527: in debug
    self._log(DEBUG, msg, args, **kwargs)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1684: in _log
    self.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1700: in handle
    self.callHandlers(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1762: in callHandlers
    hdlr.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1028: in handle
    self.emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:372: in emit
    super().emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1168: in emit
    self.handleError(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1160: in emit
    msg = self.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:999: in format
    return fmt.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:136: in format
    return super().format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:703: in format
    record.message = record.getMessage()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <LogRecord: openwpm, 10, /home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py, 550, "BROWSER %i: Attempting to kill BrowserManager with pid %i. Browser PID: %s">

    def getMessage(self):
        """
        Return the message for this LogRecord.
    
        Return the message for this LogRecord after merging any user-supplied
        arguments with the message.
        """
        msg = str(self.msg)
        if self.args:
>           msg = msg % self.args
E           TypeError: %i format: a real number is required, not tuple

/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:392: TypeError

Check failure on line 0 in junit-report.xml

See this annotation in the file changed.

@github-actions github-actions / OpenWPM

pytest ► test.test_profile ► test_profile_recovery[on_crash_during_launch-stateless-with_seed_tar]

Failed test found in:
  junit-report.xml
Error:
  monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab1bd60c0>
Raw output
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab1bd60c0>
default_params = (ManagerParams(data_directory=PosixPath('/tmp/pytest-of-runner/pytest-0/test_profile_recovery_on_crash5'), log_path=Po...'/tmp'), maximum_profile_size=None, recovery_tar=None, donottrack=False, tracking_protection=False, custom_params={})])
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7f5ab1b58c20>
testcase = 'on_crash_during_launch', stateful = False
seed_tar = PosixPath('profile.tar.gz')

    @pytest.mark.parametrize(
        "stateful,seed_tar",
        [(True, None), (True, Path("profile.tar.gz")), (False, Path("profile.tar.gz"))],
        ids=[
            "stateful-without_seed_tar",
            "stateful-with_seed_tar",
            "stateless-with_seed_tar",
        ],
    )
    @pytest.mark.parametrize(
        "testcase",
        ["on_normal_operation", "on_crash", "on_crash_during_launch", "on_timeout"],
    )
    # Use -k to run this test for a specific set of parameters. For example:
    # pytest -vv test_profile.py::test_profile_recovery -k on_crash-stateful-with_seed_tar
    def test_profile_recovery(
        monkeypatch, default_params, task_manager_creator, testcase, stateful, seed_tar
    ):
        """Test browser profile recovery in various scenarios."""
        manager_params, browser_params = default_params
        manager_params.num_browsers = 1
        browser_params[0].seed_tar = seed_tar
        manager, db = task_manager_creator((manager_params, browser_params[:1]))
        manager.get(BASE_TEST_URL, reset=not stateful)
    
        if testcase == "normal_operation":
            pass
        elif testcase == "on_crash":
            # Cause a selenium crash to force browser to restart
            manager.get("example.com", reset=not stateful)
        elif testcase == "on_crash_during_launch":
            # Cause a selenium crash to force browser to restart
            manager.get("example.com", reset=not stateful)
            # This will cause browser restarts to fail
            monkeypatch.setenv("FIREFOX_BINARY", "/tmp/NOTREAL")
    
            # Let the launch succeed after some failed launch attempts
            def undo_monkeypatch():
                time.sleep(5)  # This should be smaller than _SPAWN_TIMEOUT
                monkeypatch.undo()
    
            Thread(target=undo_monkeypatch).start()
        elif testcase == "on_timeout":
            # Set a very low timeout to cause a restart
            manager.get("about:config", reset=not stateful, timeout=0.1)
    
        cs = CommandSequence("about:config", reset=not stateful)
        expected_value = True if seed_tar else False
        cs.append_command(AssertConfigSetCommand("test_pref", expected_value))
        tar_directory = manager_params.data_directory / "browser_profile"
        tar_path = tar_directory / "profile.tar.gz"
        cs.dump_profile(tar_path, True)
        manager.execute_command_sequence(cs)
>       manager.close()

/home/runner/work/OpenWPM/OpenWPM/test/test_profile.py:260: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:505: in close
    self._shutdown_manager(relaxed=relaxed)
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:326: in _shutdown_manager
    browser.shutdown_browser(during_init, force=not relaxed)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:610: in shutdown_browser
    self.close_browser_manager(force=force)
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:341: in close_browser_manager
    self.kill_browser_manager()
/home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py:550: in kill_browser_manager
    self.logger.debug(
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1527: in debug
    self._log(DEBUG, msg, args, **kwargs)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1684: in _log
    self.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1700: in handle
    self.callHandlers(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1762: in callHandlers
    hdlr.handle(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1028: in handle
    self.emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:372: in emit
    super().emit(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1168: in emit
    self.handleError(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:1160: in emit
    msg = self.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:999: in format
    return fmt.format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/_pytest/logging.py:136: in format
    return super().format(record)
/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:703: in format
    record.message = record.getMessage()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <LogRecord: openwpm, 10, /home/runner/work/OpenWPM/OpenWPM/openwpm/browser_manager.py, 550, "BROWSER %i: Attempting to kill BrowserManager with pid %i. Browser PID: %s">

    def getMessage(self):
        """
        Return the message for this LogRecord.
    
        Return the message for this LogRecord after merging any user-supplied
        arguments with the message.
        """
        msg = str(self.msg)
        if self.args:
>           msg = msg % self.args
E           TypeError: %i format: a real number is required, not tuple

/home/runner/mamba/envs/openwpm/lib/python3.12/logging/__init__.py:392: TypeError