diff --git a/.docker/Dockerfile b/.docker/Dockerfile index c2356aba114c906bdd6dd2938c6ebb4acec6ab57..975eae8f22ff68e358edff4e36edc9046b3b3d36 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -11,11 +11,12 @@ RUN apt-get update && \ ARG PYLIB RUN echo "PYLIB=${PYLIB}" COPY .docker/wait-for-it.sh /wait-for-it.sh +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 @@ -30,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 - tox + pytest --cov=linkahead -vv tests diff --git a/CHANGELOG.md b/CHANGELOG.md index b4dee9c126d5e46a6e32d405e83914254fb85fc2..4995e8e01f2d14ced5b2ddf2afa6555492a83036 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 diff --git a/README.md b/README.md index 2c4d7e6d820e3550af109faa57575bc187f3cd9d..50f8887b74ece4bc4cca96f43dace4d08e42c8c7 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` diff --git a/pylinkahead.ini.template b/pylinkahead.ini.template index 439f8c1701206eaf271cd93c87b9e8c8d02e2e6e..4761458a2ec85eedee3f4b3bcc89804986d8cccb 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 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..b30d9a9204a04f5c842b126721a77f104a11a140 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +jsonschema +linkahead +pytest +pytest-cov +python-dateutil +setuptools diff --git a/setup.py b/setup.py deleted file mode 100644 index d836a2731c2fc1da4d7515917fa21e59b8f3f6b1..0000000000000000000000000000000000000000 --- 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"], -)