Skip to content
Snippets Groups Projects
Commit d45bd61c authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

Merge branch 'f-clean-up-tests' into 'dev'

Clean up and join integration tests

See merge request caosdb/caosdb-advanced-user-tools!27
parents a7f2d477 e563d0a0
No related branches found
No related tags found
1 merge request!22Release 0.3
Showing
with 66 additions and 7 deletions
......@@ -30,7 +30,7 @@ RUN git clone \
cd scifolder && pip3 install .
COPY . /git
RUN rm -r /git/.git \
&& mv /git/.docker/pycaosdb.ini /git/integrationtests/full_test
&& mv /git/.docker/pycaosdb.ini /git/integrationtests
RUN cd /git && pip3 install .
WORKDIR /git/integrationtests/full_test
WORKDIR /git/integrationtests
CMD /wait-for-it.sh caosdb-server:10443 -t 500 -- ./test.sh
......@@ -18,7 +18,7 @@ services:
source: "$EXEPATH/.docker/cert"
target: /opt/caosdb/cert
- type: bind
source: "$EXEPATH/integrationtests/full_test/extroot"
source: "$EXEPATH/integrationtests/extroot"
target: /opt/caosdb/mnt/extroot
read_only: true
ports:
......
......@@ -3,16 +3,29 @@
pip install . --user
pip install tox --user
In order to run the tests you need to install the [scifolder
package](https://gitlab.com/henrik_indiscale/scifolder) by Henrik tom
Wörden.
# Run Unit Tests
tox
# Run Integration Tests Locally
1. Change directory to `integrationtests/full_test/`.
2. Mount `extroot` to the folder that will be used as extroot. E.g. `sudo mount
-o bind extroot ../../../caosdb-deploy/profiles/empty/paths/extroot`.
3. Start an empty CaosDB instance (with the mounted extroot).
1. Change directory to `integrationtests/`.
2. Mount `extroot` to the folder that will be used as
extroot. E.g. `sudo mount -o bind extroot
../../caosdb-deploy/profiles/empty/paths/extroot` (or whatever path
the extroot of the empty profile to be used is located at).
3. Start an empty (!) CaosDB instance (with the mounted extroot). The
database will be cleared during testing, so it's important to use
an empty insctance.
4. Run `test.sh`.
# Code Formatting
autopep8 -i -r ./
# Dependencies
test:
- scifolder package from https://gitlab.com/henrik_indiscale/scifolder
#!/usr/bin/env python
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
# Copyright (C) 2020 Indiscale GmbH <info@indiscale.com>
# Copyright (C) 2020 Florian Spreckelsen <f.spreckelsen@indiscale.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......@@ -17,21 +16,31 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# You should have received a copy of the GNU Affero General Public
# License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
# ** end header
import unittest
from tempfile import NamedTemporaryFile
#
"""Clear the database before and after the integration tests."""
import caosdb as db
from caosadvancedtools.cfood import AbstractCFood
def clear_all():
"""First remove Records, then RecordTypes, then Properties, finally
files. Since there may be no entities, execute all deletions
without raising errors.
"""
db.execute_query("FIND Record").delete(
raise_exception_on_error=False)
db.execute_query("FIND RecordType").delete(
raise_exception_on_error=False)
db.execute_query("FIND Property").delete(
raise_exception_on_error=False)
db.execute_query("FIND File").delete(
raise_exception_on_error=False)
class CFoodTest(unittest.TestCase):
def setUp(self):
pass
def test_check_existence(self):
pass
if __name__ == "__main__":
clear_all()
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment