From aa57170332c71dd17cb94afea3519ae92daefb37 Mon Sep 17 00:00:00 2001 From: "i.nueske" <i.nueske@indiscale.com> Date: Thu, 30 Jan 2025 11:39:18 +0100 Subject: [PATCH 1/9] DEV: Replace setup.py with requirements.txt - inttests should not be installed --- requirements.txt | 2 ++ setup.py | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) create mode 100644 requirements.txt delete mode 100644 setup.py diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..93393f0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +linkahead +pytest \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index d836a27..0000000 --- a/setup.py +++ /dev/null @@ -1,7 +0,0 @@ -from setuptools import setup, find_packages -setup( - name="PyCaosDB Integration Tests", - version="0.1.0", - packages=find_packages(), - tests_require=["nose>=1.0", "python-dateutil>=2.8.1"], -) -- GitLab From c851aece8aa6462823b8f46a7c1360412776f1fc Mon Sep 17 00:00:00 2001 From: "i.nueske" <i.nueske@indiscale.com> Date: Thu, 30 Jan 2025 11:40:52 +0100 Subject: [PATCH 2/9] TST: Make paths in pylinkahead.ini.template relative to test profile --- pylinkahead.ini.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pylinkahead.ini.template b/pylinkahead.ini.template index 439f8c1..4761458 100644 --- a/pylinkahead.ini.template +++ b/pylinkahead.ini.template @@ -18,7 +18,7 @@ test_server_side_scripting.bin_dir.server=/opt/caosdb/git/caosdb-server/scriptin # Location of the files from the pyinttest (i.e. host) perspective. Probably the local extroot # path plus `/test_insert_files_in_dir/`. -test_files.test_insert_files_in_dir.local=/path/to/linkahead-pyinttest/test_profile/paths/extroot/test_insert_files_in_dir/ +test_files.test_insert_files_in_dir.local=./test_profile/paths/extroot/test_insert_files_in_dir/ # Location of the files from the caosdb server's perspective. Probably with the same last # component(s) as the local variant (above). @@ -46,7 +46,7 @@ password=caosdb ## Provide SSL certificate used by the CaosDB server for all tests to ## run. Some integration tests will fail without a valid certificate here. -cacert=/path/to/cert.pem +cacert=./test_profile/custom/other/cert/caosdb.cert.pem #debug=0 #ssl_insecure=True -- GitLab From 40fbb521638eea17c6c53b875a83ec7372f43734 Mon Sep 17 00:00:00 2001 From: "i.nueske" <i.nueske@indiscale.com> Date: Thu, 30 Jan 2025 11:42:37 +0100 Subject: [PATCH 3/9] DOC: Reorder README.md, add setup guide, fix typos --- README.md | 56 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 2c4d7e6..50f8887 100644 --- a/README.md +++ b/README.md @@ -7,23 +7,38 @@ Linkahead project. ## Getting started # -### Configuration +### Setup -The following steps describe how to setup the tests for running agains -a plain LinkAhead server built from the sources. In case you want to -use LinkAhead Control instead, there is a pre-confidured [test -profile](/test_profile/profile.yml) in this repository that you can -use for this. Instructions can be found in the official LinkAhead -[documentation](https://docs.indiscale.com//caosdb-deploy/README_SETUP.html#integration-tests). +Dependencies can be installed using `pip install -r requirements.txt`. -- To run tests, start up a Linkahead server with the following properties (documentation for this can - be found elsewhere): +The tests must be run against a correctly configured linkahead server. The suggested +way to achieve this is to start linkahead using the [test_profile](/test_profile/profile.yml) +provided with this repository. Instructions can be found in the official LinkAhead +[documentation](https://docs.indiscale.com//caosdb-deploy/README_TEST.html#integration-tests). + +After a linkahead server is set up, copy the content of +[`pylinkahead.ini.template`](pylinkahead.ini.template) to a new file named `pylinkahead.ini`. + +### Run the tests + +The tests can then be run from the base directory using `pytest` or `pytest-3` (depending on +your system). You can also select a single test file with `pytest-3 tests/test_issues.py`, +or a test matching a regular expression, f.e. using `pytest-3 tests/test_issues.py -k issue_123`. + +## Configuration for LinkAhead servers built from source + +The following steps describe how to set up the tests for running against +a plain LinkAhead server built from the sources. + +- To run tests, start up a Linkahead server with the following properties + (documentation for this can be found in the [official documentation](https://docs.indiscale.com/)): - The Linkahead server must have debugging enabled. - The database should be empty. - The `resources` directory should be made visible, e.g., by - symlinking or copying its contents, to the server in + symlinking or copying its contents to the server in `scripting/bin-debug`. -- Modify `pylinkahead.ini.template` and save it as `pylinkahead.ini`, taking care of the following points: +- Modify `pylinkahead.ini.template` and save it as `pylinkahead.ini`, + taking care of the following points: - Certificates must be valid and be specified in `pylinkahead.ini`. - Server-side scripting paths must be given, otherwise server-side scripting will be omitted. The remote path @@ -33,27 +48,14 @@ use for this. Instructions can be found in the official LinkAhead - Paths for the file tests must exist, or be creatable by the testing script and the server. -### Run the tests - -- 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: - `pytest-3 tests/test_issues.py` - or a test matching a regular expression: - `pytest-3 tests/test_issues.py -k issue_123` - -## Requirements ## - -- Running the tests needs `pytest`, obviously, and also the `nose` library: - - `pip3 install pytest nose` - -## Run tests agains a remote linkahead server +## Run tests against a remote linkahead server * There is a special mark `local_server`, which marks all test which cannot pass when the server is not on the host where the test suite is running. * Start tests with `pytest -m "not local_server"` or `tox -- -m "not local_server"`. -* The remote linkahead server must have a TLS certificate which maches the name given in - `pylinkahead.ini`. If you use LinkAhead Control, this can be achieved by: +* The remote linkahead server must have a TLS certificate which matches the name given + in `pylinkahead.ini`. If you use LinkAhead Control, this can be achieved by: * `linkahead cert_gen -- --hostname <your hostname>` * `linkahead certs -d <your profile path>/custom/other/cert` * `linkahead start` -- GitLab From 02f8927d9d4cee6002e9d4f425c1bc3ae1aa1de7 Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Thu, 30 Jan 2025 12:38:28 +0100 Subject: [PATCH 4/9] PIPELINE: Remove tox from test setup --- .docker/Dockerfile | 3 ++- requirements.txt | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index c2356ab..e1fdffb 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -11,6 +11,7 @@ RUN apt-get update && \ ARG PYLIB RUN echo "PYLIB=${PYLIB}" COPY .docker/wait-for-it.sh /wait-for-it.sh +RUN pip install -r requirements.txt ADD https://gitlab.indiscale.com/api/v4/projects/97/repository/commits/${PYLIB} \ pylib_version.json RUN git clone https://gitlab.indiscale.com/caosdb/src/caosdb-pylib.git && \ @@ -31,4 +32,4 @@ CMD /wait-for-it.sh caosdb-server:10443 -t 500 -- \ cp /git/.docker/sss_pylinkahead.ini /scripting/home/.pylinkahead.ini && \ cp -r /git/resources /scripting/bin-debug && \ # ... and run tests - tox + pytest --cov=linkahead -vv {posargs} diff --git a/requirements.txt b/requirements.txt index 93393f0..b30d9a9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,6 @@ +jsonschema linkahead -pytest \ No newline at end of file +pytest +pytest-cov +python-dateutil +setuptools -- GitLab From 7ec295fab83b73ca1ce7b2fa14b9bd789e47a0bd Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Thu, 30 Jan 2025 12:40:15 +0100 Subject: [PATCH 5/9] PIPELINE: Fix path to requirements.txt --- .docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index e1fdffb..1cb0b1b 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get update && \ ARG PYLIB RUN echo "PYLIB=${PYLIB}" COPY .docker/wait-for-it.sh /wait-for-it.sh -RUN pip install -r requirements.txt +RUN pip install -r ./requirements.txt ADD https://gitlab.indiscale.com/api/v4/projects/97/repository/commits/${PYLIB} \ pylib_version.json RUN git clone https://gitlab.indiscale.com/caosdb/src/caosdb-pylib.git && \ -- GitLab From 388962db54f55874618f0076a10dedd90a5e3105 Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Thu, 30 Jan 2025 12:43:24 +0100 Subject: [PATCH 6/9] PIPELINE: Use correct installation order --- .docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 1cb0b1b..4da5a53 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -11,12 +11,12 @@ RUN apt-get update && \ ARG PYLIB RUN echo "PYLIB=${PYLIB}" COPY .docker/wait-for-it.sh /wait-for-it.sh -RUN pip install -r ./requirements.txt +COPY . /git +RUN pip install -r /git/requirements.txt ADD https://gitlab.indiscale.com/api/v4/projects/97/repository/commits/${PYLIB} \ pylib_version.json RUN git clone https://gitlab.indiscale.com/caosdb/src/caosdb-pylib.git && \ cd caosdb-pylib && git checkout ${PYLIB} && pip3 install . -COPY . /git # Delete .git because it is huge. RUN rm -r /git/.git -- GitLab From 7c2fa055d7e2f84766221aa979617d86507d0ecd Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Thu, 30 Jan 2025 12:48:01 +0100 Subject: [PATCH 7/9] PIPELINE: Use correct pytest command --- .docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 4da5a53..cc0e893 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -32,4 +32,4 @@ CMD /wait-for-it.sh caosdb-server:10443 -t 500 -- \ cp /git/.docker/sss_pylinkahead.ini /scripting/home/.pylinkahead.ini && \ cp -r /git/resources /scripting/bin-debug && \ # ... and run tests - pytest --cov=linkahead -vv {posargs} + pytest --cov=linkahead -vv tests -- GitLab From 915b4d717c0468d2aa77cdfb7be10a9f2a008400 Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Thu, 30 Jan 2025 13:00:46 +0100 Subject: [PATCH 8/9] PIPELINE: Add version output to test execution --- .docker/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index cc0e893..975eae8 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -31,5 +31,8 @@ CMD /wait-for-it.sh caosdb-server:10443 -t 500 -- \ # ... install pylinkahead.ini and the server-side scripts cp /git/.docker/sss_pylinkahead.ini /scripting/home/.pylinkahead.ini && \ cp -r /git/resources /scripting/bin-debug && \ + # ... put out general version information + python3 --version && \ + python3 -c "import linkahead; print(linkahead.version.version)" && \ # ... and run tests pytest --cov=linkahead -vv tests -- GitLab From dee5b03ab3fa0886c2d63080e7f5fe025d8ebe5d Mon Sep 17 00:00:00 2001 From: "i.nueske" <i.nueske@indiscale.com> Date: Thu, 30 Jan 2025 13:08:17 +0100 Subject: [PATCH 9/9] DOC: Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4dee9c..4995e8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed (for changes in existing functionality) +* `setup.py` has been replaced by a `requirements.txt`. * Tests comply with the new entity error handling (see [#32](https://gitlab.com/caosdb/caosdb-pylib/-/issues/32) in caosdb-pylib). @@ -70,6 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed (for now removed features) +- Support for tox - Some redundant tests from `test_tickets.py` that checked functionality that was already tested in `test_error_stuff.py`. - `test_server_side_scripting.bin_dir.local` option in pylinkahead.ini -- GitLab