Skip to content
Snippets Groups Projects
Commit e563d0a0 authored by Florian Spreckelsen's avatar Florian Spreckelsen Committed by Henrik tom Wörden
Browse files

MAINT: Move contents of full_tests to integration tests

Also rename the former integration_tests/full_test/test_crawler.py to
integration_tests/test_crawler_with_cfoods.py to prevent confusion.
parent a7f2d477
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 \ ...@@ -30,7 +30,7 @@ RUN git clone \
cd scifolder && pip3 install . cd scifolder && pip3 install .
COPY . /git COPY . /git
RUN rm -r /git/.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 . 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 CMD /wait-for-it.sh caosdb-server:10443 -t 500 -- ./test.sh
...@@ -18,7 +18,7 @@ services: ...@@ -18,7 +18,7 @@ services:
source: "$EXEPATH/.docker/cert" source: "$EXEPATH/.docker/cert"
target: /opt/caosdb/cert target: /opt/caosdb/cert
- type: bind - type: bind
source: "$EXEPATH/integrationtests/full_test/extroot" source: "$EXEPATH/integrationtests/extroot"
target: /opt/caosdb/mnt/extroot target: /opt/caosdb/mnt/extroot
read_only: true read_only: true
ports: ports:
......
...@@ -3,16 +3,29 @@ ...@@ -3,16 +3,29 @@
pip install . --user pip install . --user
pip install tox --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 # Run Unit Tests
tox tox
# Run Integration Tests Locally # Run Integration Tests Locally
1. Change directory to `integrationtests/full_test/`. 1. Change directory to `integrationtests/`.
2. Mount `extroot` to the folder that will be used as extroot. E.g. `sudo mount 2. Mount `extroot` to the folder that will be used as
-o bind extroot ../../../caosdb-deploy/profiles/empty/paths/extroot`. extroot. E.g. `sudo mount -o bind extroot
3. Start an empty CaosDB instance (with the mounted 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`. 4. Run `test.sh`.
# Code Formatting # Code Formatting
autopep8 -i -r ./ autopep8 -i -r ./
# Dependencies
test:
- scifolder package from https://gitlab.com/henrik_indiscale/scifolder
#!/usr/bin/env python # -*- coding: utf-8 -*-
# encoding: utf-8
# #
# ** header v3.0 # ** header v3.0
# This file is a part of the CaosDB Project. # This file is a part of the CaosDB Project.
# #
# Copyright (C) 2018 Research Group Biomedical Physics, # Copyright (C) 2020 Indiscale GmbH <info@indiscale.com>
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen # Copyright (C) 2020 Florian Spreckelsen <f.spreckelsen@indiscale.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
...@@ -17,21 +16,31 @@ ...@@ -17,21 +16,31 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public
# along with this program. If not, see <https://www.gnu.org/licenses/>. # License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
# #
# ** end header # ** end header
import unittest #
from tempfile import NamedTemporaryFile """Clear the database before and after the integration tests."""
import caosdb as db 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): if __name__ == "__main__":
pass 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