Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Python Integration Tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Python Integration Tests
Commits
cd8aa475
Verified
Commit
cd8aa475
authored
1 year ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
Cherrypicked pipeline fix.
parent
b1b5f112
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!75
Cherrypicked pipeline fix.
Pipeline
#46304
passed
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
README.md
+8
-0
8 additions, 0 deletions
README.md
tests/test_server_side_scripting.py
+28
-6
28 additions, 6 deletions
tests/test_server_side_scripting.py
with
37 additions
and
6 deletions
CHANGELOG.md
+
1
−
0
View file @
cd8aa475
...
...
@@ -67,5 +67,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)
This diff is collapsed.
Click to expand it.
README.md
+
8
−
0
View file @
cd8aa475
...
...
@@ -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:
...
...
This diff is collapsed.
Click to expand it.
tests/test_server_side_scripting.py
+
28
−
6
View file @
cd8aa475
...
...
@@ -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
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment