Skip to content
Snippets Groups Projects
Commit f3879c5e authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'main' into dev

parents 69f7b1bd 1c848cd7
Branches
Tags
No related merge requests found
Pipeline #46310 passed
......@@ -68,5 +68,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Tests for NaN Double Values (see https://gitlab.com/caosdb/caosdb-server/issues/41)
* Tests for name queries. [caosdb-server#51](https://gitlab.com/caosdb/caosdb-server/-/issues/51)
* Server-side scripting is more tolerant to Pandas warnings now. (https://gitlab.indiscale.com/caosdb/src/caosdb-pyinttest/-/issues/21)
### Security (in case of vulnerabilities)
......@@ -13,9 +13,17 @@ CaosDB project.
be found elsewhere):
- The CaosDB server must have debugging enabled.
- The database should be empty.
- There should be a symlink named `debug-scripting-bin` inside the `custom` profile directory,
which points to the `resources` directory here in the pyinttest repository. You can create a
symlink like that with the following command (adapt paths to match your setting):
`custom$ ln -s ../../../../caosdb-pyinttest/resources debug-scripting-bin`
- Modify `pycaosdb.ini.template` and save it as `pycaosdb.ini`, taking care of the following points:
- Certificates must be valid and be specified in `pycaosdb.ini`.
- Server-side scripting paths must be given, otherwise server-side scripting will be omitted.
- The local path `test_server_side_scripting.bin_dir.local` should point to a
`linkahead-server/scripting/bin` somwhere.
- The remote path `test_server_side_scripting.bin_dir.server` should probably be something like
`/opt/caosdb/git/caosdb-server/scripting/bin-debug`.
- Paths for the file tests must exist, or be creatable by the testing script and the server.
- Run the tests with `pytest` or `pytest-3` (depending on your system).
- If you want to run just a single test, you can also select a single test file:
......
......@@ -70,6 +70,28 @@ def clean_database():
d.delete()
def assert_stderr(stderr) -> None:
"""Assert that ``stderr`` is either None or contains only the pyarrow deprecation warning.
This can probably removed with Pandas 3.0, to be replaced by ``assert stderr is None``.
Parameters
----------
stderr
The object to be tested.
"""
if stderr is None:
return
assert isinstance(stderr, str)
assert stderr.split(sep="\n", maxsplit=1)[1] == """Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
but was not found to be installed on your system.
If this would cause problems for you,
please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
i = __import__(m)"""
def setup_function(function):
clean_database()
......@@ -148,7 +170,7 @@ def test_call_ok():
xml = etree.parse(r)
assert xml.xpath("/Response/script/call")[0].text == "ok"
assert xml.xpath("/Response/script/stdout")[0].text == "ok"
assert xml.xpath("/Response/script/stderr")[0].text is None
assert_stderr(xml.xpath("/Response/script/stderr")[0].text)
assert xml.xpath("/Response/script/@code")[0] == "0"
......@@ -178,7 +200,7 @@ def test_run_server_side_script_with_file_as_positional_param():
exit="123",
query="COUNT ENTITY TestRT",
files={"-p2": "test_file.txt"})
assert response.stderr is None
assert_stderr(response.stderr)
assert response.code == 123
assert response.call == ('administration/diagnostics.py '
'--exit=123 --query=COUNT ENTITY TestRT '
......@@ -203,7 +225,7 @@ def test_run_server_side_script_with_additional_file():
exit="123",
query="COUNT ENTITY TestRT",
files={"dummykey": "test_file.txt"})
assert response.stderr is None
assert_stderr(response.stderr)
assert response.code == 123
assert response.call == ('administration/diagnostics.py '
'--exit=123 --query=COUNT ENTITY TestRT '
......@@ -250,7 +272,7 @@ def test_diagnostics_basic():
"with code 123.")
assert xml.xpath("/Response/script/call")[0].text.startswith(
"administration/diagnostics.py")
assert xml.xpath("/Response/script/stderr")[0].text is None
assert_stderr(xml.xpath("/Response/script/stderr")[0].text)
def test_diagnostics_with_file_upload():
......@@ -293,7 +315,7 @@ def test_diagnostics_with_file_upload():
"with code 0.")
assert xml.xpath("/Response/script/call")[0].text.startswith(
"administration/diagnostics.py")
assert xml.xpath("/Response/script/stderr")[0].text is None
assert_stderr(xml.xpath("/Response/script/stderr")[0].text)
@mark.local_server
......@@ -403,7 +425,7 @@ def test_anonymous_script_calling_success():
assert xml.xpath("/Response/UserInfo/Roles/Role")[0].text == "anonymous"
assert xml.xpath("/Response/script/call")[0].text == "ok_anonymous"
assert xml.xpath("/Response/script/stdout")[0].text == "ok_anonymous"
assert xml.xpath("/Response/script/stderr")[0].text is None
assert_stderr(xml.xpath("/Response/script/stderr")[0].text)
assert xml.xpath("/Response/script/@code")[0] == "0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment