Stealth extension #1029
GitHub Actions / test/extension/*
failed
Jan 25, 2024 in 0s
test/extension/* ❌
❌ junit-report.xml
3 tests were completed in 11s with 0 passed, 3 failed and 0 skipped.
Test suite | Passed | Failed | Skipped | Time |
---|---|---|---|---|
pytest | 3❌ | 11s |
❌ pytest
test.extension.test_logging
❌ test_extension_logging
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7fa8c2e59760>
❌ test_extension_logging
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7fa8c1cbe660>
test.extension.test_startup_timeout
❌ test_extension_startup_timeout
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7fa8c1cbefc0>
Annotations
Check failure on line 0 in junit-report.xml
github-actions / test/extension/*
pytest ► test.extension.test_logging ► test_extension_logging
Failed test found in:
junit-report.xml
Error:
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7fa8c2e59760>
Raw output
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7fa8c2e59760>
default_params = (ManagerParams(data_directory=PosixPath('/tmp/pytest-of-runner/pytest-0/test_extension_logging0'), log_path=PosixPath(...e to webpack name mangling\n loggingDB.logWarn("This is a test message from the extension"); \n '})])
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_extension_logging0')
def test_extension_logging(task_manager_creator, default_params, tmp_path):
test_msg = "This is a test message from the extension"
log_path = tmp_path / "openwpm.log"
manager_params, browser_params = default_params
manager_params.log_path = log_path
for browser_param in browser_params:
browser_param.custom_params[
"pre_instrumentation_code"
] = f"""
// Weird name needed due to webpack name mangling
loggingDB.logWarn("{test_msg}");
"""
> task_manager, _ = task_manager_creator((manager_params, browser_params))
/home/runner/work/OpenWPM/OpenWPM/test/extension/test_logging.py:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/runner/work/OpenWPM/OpenWPM/test/conftest.py:80: in _create_task_manager
manager = TaskManager(
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:99: in __init__
cleaned_js_settings = clean_js_instrumentation_settings(js_settings)
/home/runner/work/OpenWPM/OpenWPM/openwpm/js_instrumentation.py:245: in clean_js_instrumentation_settings
_validate(settings)
/home/runner/work/OpenWPM/OpenWPM/openwpm/js_instrumentation.py:27: in _validate
jsonschema.validate(instance=python_list_to_validate, schema=schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
instance = [{'instrumentedName': 'ScriptProcessorNode', 'logSettings': {'depth': 5, 'excludedProperties': [], 'logCallStack': Fal...erties': [], 'logCallStack': False, 'logFunctionGets': False, ...}, 'object': "window['AudioContext'].prototype"}, ...]
schema = {'$id': 'http://example.com/js-instrument-settings.schema', '$schema': 'http://json-schema.org/draft-07/schema#', 'des... 'type': 'string'}}, 'required': ['object', 'instrumentedName', 'logSettings'], 'title': 'Settings objects', ...}, ...}
cls = <class 'jsonschema.validators.Draft7Validator'>, args = (), kwargs = {}
validator = Draft7Validator(schema={'$id': 'http://examp...ttings.schema', '$schema': 'http://json-...ft-07/schema#', 'description...required': ['object', 'instrumentedName', 'logSettings'], 'title': 'Settings objects', ...}, ...}, format_checker=None)
error = <ValidationError: "'name' is not of type 'object'">
def validate(instance, schema, cls=None, *args, **kwargs): # noqa: D417
"""
Validate an instance under the given schema.
>>> validate([2, 3, 4], {"maxItems": 2})
Traceback (most recent call last):
...
ValidationError: [2, 3, 4] is too long
:func:`~jsonschema.validators.validate` will first verify that the
provided schema is itself valid, since not doing so can lead to less
obvious error messages and fail in less obvious or consistent ways.
If you know you have a valid schema already, especially
if you intend to validate multiple instances with
the same schema, you likely would prefer using the
`jsonschema.protocols.Validator.validate` method directly on a
specific validator (e.g. ``Draft202012Validator.validate``).
Arguments:
instance:
The instance to validate
schema:
The schema to validate with
cls (jsonschema.protocols.Validator):
The class that will be used to validate the instance.
If the ``cls`` argument is not provided, two things will happen
in accordance with the specification. First, if the schema has a
:kw:`$schema` keyword containing a known meta-schema [#]_ then the
proper validator will be used. The specification recommends that
all schemas contain :kw:`$schema` properties for this reason. If no
:kw:`$schema` property is found, the default validator class is the
latest released draft.
Any other provided positional and keyword arguments will be passed
on when instantiating the ``cls``.
Raises:
`jsonschema.exceptions.ValidationError`:
if the instance is invalid
`jsonschema.exceptions.SchemaError`:
if the schema itself is invalid
.. rubric:: Footnotes
.. [#] known by a validator registered with
`jsonschema.validators.validates`
"""
if cls is None:
cls = validator_for(schema)
cls.check_schema(schema)
validator = cls(schema, *args, **kwargs)
error = exceptions.best_match(validator.iter_errors(instance))
if error is not None:
> raise error
E jsonschema.exceptions.ValidationError: 'name' is not of type 'object'
E
E Failed validating 'type' in schema['items']['properties']['logSettings']['properties']['propertiesToInstrument']['items']:
E {'properties': {'depth': {'type': 'integer'},
E 'propertyNames': {'items': {'type': 'string'},
E 'type': 'array'}},
E 'type': 'object'}
E
E On instance[11]['logSettings']['propertiesToInstrument'][0]:
E 'name'
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/jsonschema/validators.py:1312: ValidationError
Check failure on line 0 in junit-report.xml
github-actions / test/extension/*
pytest ► test.extension.test_logging ► test_extension_logging
Failed test found in:
junit-report.xml
Error:
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7fa8c1cbe660>
Raw output
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7fa8c1cbe660>
default_params = (ManagerParams(data_directory=PosixPath('/tmp/pytest-of-runner/pytest-0/test_extension_logging1'), log_path=PosixPath(...e to webpack name mangling\n loggingDB.logWarn("This is a test message from the extension"); \n '})])
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_extension_logging1')
def test_extension_logging(task_manager_creator, default_params, tmp_path):
test_msg = "This is a test message from the extension"
log_path = tmp_path / "openwpm.log"
manager_params, browser_params = default_params
manager_params.log_path = log_path
for browser_param in browser_params:
browser_param.custom_params[
"pre_instrumentation_code"
] = f"""
// Weird name needed due to webpack name mangling
loggingDB.logWarn("{test_msg}");
"""
> task_manager, _ = task_manager_creator((manager_params, browser_params))
/home/runner/work/OpenWPM/OpenWPM/test/extension/test_logging.py:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/runner/work/OpenWPM/OpenWPM/test/conftest.py:80: in _create_task_manager
manager = TaskManager(
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:99: in __init__
cleaned_js_settings = clean_js_instrumentation_settings(js_settings)
/home/runner/work/OpenWPM/OpenWPM/openwpm/js_instrumentation.py:245: in clean_js_instrumentation_settings
_validate(settings)
/home/runner/work/OpenWPM/OpenWPM/openwpm/js_instrumentation.py:27: in _validate
jsonschema.validate(instance=python_list_to_validate, schema=schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
instance = [{'instrumentedName': 'ScriptProcessorNode', 'logSettings': {'depth': 5, 'excludedProperties': [], 'logCallStack': Fal...erties': [], 'logCallStack': False, 'logFunctionGets': False, ...}, 'object': "window['AudioContext'].prototype"}, ...]
schema = {'$id': 'http://example.com/js-instrument-settings.schema', '$schema': 'http://json-schema.org/draft-07/schema#', 'des... 'type': 'string'}}, 'required': ['object', 'instrumentedName', 'logSettings'], 'title': 'Settings objects', ...}, ...}
cls = <class 'jsonschema.validators.Draft7Validator'>, args = (), kwargs = {}
validator = Draft7Validator(schema={'$id': 'http://examp...ttings.schema', '$schema': 'http://json-...ft-07/schema#', 'description...required': ['object', 'instrumentedName', 'logSettings'], 'title': 'Settings objects', ...}, ...}, format_checker=None)
error = <ValidationError: "'name' is not of type 'object'">
def validate(instance, schema, cls=None, *args, **kwargs): # noqa: D417
"""
Validate an instance under the given schema.
>>> validate([2, 3, 4], {"maxItems": 2})
Traceback (most recent call last):
...
ValidationError: [2, 3, 4] is too long
:func:`~jsonschema.validators.validate` will first verify that the
provided schema is itself valid, since not doing so can lead to less
obvious error messages and fail in less obvious or consistent ways.
If you know you have a valid schema already, especially
if you intend to validate multiple instances with
the same schema, you likely would prefer using the
`jsonschema.protocols.Validator.validate` method directly on a
specific validator (e.g. ``Draft202012Validator.validate``).
Arguments:
instance:
The instance to validate
schema:
The schema to validate with
cls (jsonschema.protocols.Validator):
The class that will be used to validate the instance.
If the ``cls`` argument is not provided, two things will happen
in accordance with the specification. First, if the schema has a
:kw:`$schema` keyword containing a known meta-schema [#]_ then the
proper validator will be used. The specification recommends that
all schemas contain :kw:`$schema` properties for this reason. If no
:kw:`$schema` property is found, the default validator class is the
latest released draft.
Any other provided positional and keyword arguments will be passed
on when instantiating the ``cls``.
Raises:
`jsonschema.exceptions.ValidationError`:
if the instance is invalid
`jsonschema.exceptions.SchemaError`:
if the schema itself is invalid
.. rubric:: Footnotes
.. [#] known by a validator registered with
`jsonschema.validators.validates`
"""
if cls is None:
cls = validator_for(schema)
cls.check_schema(schema)
validator = cls(schema, *args, **kwargs)
error = exceptions.best_match(validator.iter_errors(instance))
if error is not None:
> raise error
E jsonschema.exceptions.ValidationError: 'name' is not of type 'object'
E
E Failed validating 'type' in schema['items']['properties']['logSettings']['properties']['propertiesToInstrument']['items']:
E {'properties': {'depth': {'type': 'integer'},
E 'propertyNames': {'items': {'type': 'string'},
E 'type': 'array'}},
E 'type': 'object'}
E
E On instance[11]['logSettings']['propertiesToInstrument'][0]:
E 'name'
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/jsonschema/validators.py:1312: ValidationError
Check failure on line 0 in junit-report.xml
github-actions / test/extension/*
pytest ► test.extension.test_startup_timeout ► test_extension_startup_timeout
Failed test found in:
junit-report.xml
Error:
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7fa8c1cbefc0>
Raw output
task_manager_creator = <function task_manager_creator.<locals>._create_task_manager at 0x7fa8c1cbefc0>
default_params = (ManagerParams(data_directory=PosixPath('/tmp/pytest-of-runner/pytest-0/test_extension_startup_timeout0'), log_path=Po... - startTime < 20000) { // Delaying for 20s\n console.log("delaying startup");\n };\n '})])
def test_extension_startup_timeout(task_manager_creator, default_params):
manager_params, browser_params = default_params
manager_params.num_browsers = 1
for browser_param in browser_params:
browser_param.custom_params[
"pre_instrumentation_code"
] = """
const startTime = Date.now();
while (Date.now() - startTime < 20000) { // Delaying for 20s
console.log("delaying startup");
};
"""
with pytest.raises(BrowserConfigError) as error:
> tm, _ = task_manager_creator((manager_params, browser_params[:1]))
/home/runner/work/OpenWPM/OpenWPM/test/extension/test_startup_timeout.py:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/runner/work/OpenWPM/OpenWPM/test/conftest.py:80: in _create_task_manager
manager = TaskManager(
/home/runner/work/OpenWPM/OpenWPM/openwpm/task_manager.py:99: in __init__
cleaned_js_settings = clean_js_instrumentation_settings(js_settings)
/home/runner/work/OpenWPM/OpenWPM/openwpm/js_instrumentation.py:245: in clean_js_instrumentation_settings
_validate(settings)
/home/runner/work/OpenWPM/OpenWPM/openwpm/js_instrumentation.py:27: in _validate
jsonschema.validate(instance=python_list_to_validate, schema=schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
instance = [{'instrumentedName': 'ScriptProcessorNode', 'logSettings': {'depth': 5, 'excludedProperties': [], 'logCallStack': Fal...erties': [], 'logCallStack': False, 'logFunctionGets': False, ...}, 'object': "window['AudioContext'].prototype"}, ...]
schema = {'$id': 'http://example.com/js-instrument-settings.schema', '$schema': 'http://json-schema.org/draft-07/schema#', 'des... 'type': 'string'}}, 'required': ['object', 'instrumentedName', 'logSettings'], 'title': 'Settings objects', ...}, ...}
cls = <class 'jsonschema.validators.Draft7Validator'>, args = (), kwargs = {}
validator = Draft7Validator(schema={'$id': 'http://examp...ttings.schema', '$schema': 'http://json-...ft-07/schema#', 'description...required': ['object', 'instrumentedName', 'logSettings'], 'title': 'Settings objects', ...}, ...}, format_checker=None)
error = <ValidationError: "'name' is not of type 'object'">
def validate(instance, schema, cls=None, *args, **kwargs): # noqa: D417
"""
Validate an instance under the given schema.
>>> validate([2, 3, 4], {"maxItems": 2})
Traceback (most recent call last):
...
ValidationError: [2, 3, 4] is too long
:func:`~jsonschema.validators.validate` will first verify that the
provided schema is itself valid, since not doing so can lead to less
obvious error messages and fail in less obvious or consistent ways.
If you know you have a valid schema already, especially
if you intend to validate multiple instances with
the same schema, you likely would prefer using the
`jsonschema.protocols.Validator.validate` method directly on a
specific validator (e.g. ``Draft202012Validator.validate``).
Arguments:
instance:
The instance to validate
schema:
The schema to validate with
cls (jsonschema.protocols.Validator):
The class that will be used to validate the instance.
If the ``cls`` argument is not provided, two things will happen
in accordance with the specification. First, if the schema has a
:kw:`$schema` keyword containing a known meta-schema [#]_ then the
proper validator will be used. The specification recommends that
all schemas contain :kw:`$schema` properties for this reason. If no
:kw:`$schema` property is found, the default validator class is the
latest released draft.
Any other provided positional and keyword arguments will be passed
on when instantiating the ``cls``.
Raises:
`jsonschema.exceptions.ValidationError`:
if the instance is invalid
`jsonschema.exceptions.SchemaError`:
if the schema itself is invalid
.. rubric:: Footnotes
.. [#] known by a validator registered with
`jsonschema.validators.validates`
"""
if cls is None:
cls = validator_for(schema)
cls.check_schema(schema)
validator = cls(schema, *args, **kwargs)
error = exceptions.best_match(validator.iter_errors(instance))
if error is not None:
> raise error
E jsonschema.exceptions.ValidationError: 'name' is not of type 'object'
E
E Failed validating 'type' in schema['items']['properties']['logSettings']['properties']['propertiesToInstrument']['items']:
E {'properties': {'depth': {'type': 'integer'},
E 'propertyNames': {'items': {'type': 'string'},
E 'type': 'array'}},
E 'type': 'object'}
E
E On instance[11]['logSettings']['propertiesToInstrument'][0]:
E 'name'
/home/runner/mamba/envs/openwpm/lib/python3.12/site-packages/jsonschema/validators.py:1312: ValidationError
Loading