diff --git a/integrationtests/.pycaosdb.ini b/integrationtests/.pycaosdb.ini new file mode 100644 index 0000000000000000000000000000000000000000..4958eb593f504acb2b07c0e23315b1d61ffd32bc --- /dev/null +++ b/integrationtests/.pycaosdb.ini @@ -0,0 +1,13 @@ +[Connection] +ssl_insecure=false +url=https://localhost:10443/ +password=caosdb +username=admin +password_method=plain +cacert=/home/salexan/Projekte/2022/220309_DPGErlangenHackathon/live/live-profile/custom/other/cert/caosdb.cert.pem + +timeout=10000 +debug=0 + +[Container] +debug=0 diff --git a/integrationtests/test-profile/profile.yml b/integrationtests/test-profile/profile.yml index 4cbbe28c87d1146910479e13a23fa7c20933a926..cafe041c7e3e9e7a9a1ae58b8584b0accd09f3ef 100644 --- a/integrationtests/test-profile/profile.yml +++ b/integrationtests/test-profile/profile.yml @@ -21,9 +21,8 @@ default: # extroot: From where files are copied/symlinked. This is a # list of `NAME: PATH` pairs or a single path. extroot: - "": "paths/extroot" - # - # "base": "/path/to/base/dir" + # "": "paths/extroot" + "base": "../use_case_cardiac_simulation/extroot" # "other": "/path/to/other" # # dropoffbox: (Soon to be deprecated.) Files can be written here, but note that you may need to diff --git a/integrationtests/test_use_case_cardiac_simulations.py b/integrationtests/test_use_case_cardiac_simulations.py new file mode 100644 index 0000000000000000000000000000000000000000..a15b06c125868ac1baa399f36f2f3e4aa4f0fb1a --- /dev/null +++ b/integrationtests/test_use_case_cardiac_simulations.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +# encoding: utf-8 +# +# ** header v3.0 +# This file is a part of the CaosDB Project. +# +# Copyright (C) 2021 Indiscale GmbH <info@indiscale.com> +# 2021 Henrik tom Wörden <h.tomwoerden@indiscale.com> +# 2021 Alexander Schlemmer +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# 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/>. +# +# ** end header +# + +""" +module description +""" + +from caosdb import EmptyUniqueQueryError +import argparse +import sys +from argparse import RawTextHelpFormatter +from newcrawler import Crawler +import caosdb as db +from newcrawler.identifiable_adapters import CaosDBIdentifiableAdapter +import pytest +from caosadvancedtools.models.parser import parse_model_from_yaml +from caosadvancedtools.models import parser as parser +import yaml + +from caosadvancedtools.loadFiles import loadpath + +from subprocess import run + +from caosadvancedtools.testutils import clear_database, set_test_key +set_test_key("10b128cf8a1372f30aa3697466bb55e76974e0c16a599bb44ace88f19c8f61e2") + +import os + +def rfp(*pathcomponents): + """ + Return full path. + Shorthand convenience function. + """ + return os.path.join(os.path.dirname(__file__), *pathcomponents) + + +def test_complete_crawler(clear_database): + # Setup the data model: + model = parser.parse_model_from_yaml("use_case_cardiac_simulation/model.yml") + model.sync_data_model(noquestion=True, verbose=False) + + # Insert the data: + for path in [ + "/opt/caosdb/mnt/extroot/base/SimulationData", + "/opt/caosdb/mnt/extroot/base/DataAnalysis"]: + loadpath( + path=path, + include=None, + exclude=None, + prefix="/", + dryrun=False, + forceAllowSymlinks=False) + + # Run the crawler: + run([ + "crawler2.0", + "--debug", + '--load-identifiables=identifiables.yml', + "-s", + "--provenance=provenance.yml", + "simulation_cfood_baltasar.yml", + "extroot/"], cwd="use_case_cardiac_simulation", + check=True) + + res = db.execute_query("FIND Record MonodomainTissueSimulationRun") + assert len(res) > 0 diff --git a/integrationtests/use_case_cardiac_simulation/crawl_data.sh b/integrationtests/use_case_cardiac_simulation/crawl_data.sh index 01e28a099704f5585735e01afcdc80afe5b222dc..af2e8f9298af72b652b681ba2c45fec11b6058d1 100755 --- a/integrationtests/use_case_cardiac_simulation/crawl_data.sh +++ b/integrationtests/use_case_cardiac_simulation/crawl_data.sh @@ -2,4 +2,4 @@ # Run the crawler2.0 to test the data structure # A. Schlemmer, 03/2022 -crawler2.0 --debug --load-identifiables="identifiables.yml" -s --provenance=provenance.yml simulation_cfood_baltasar.yml ../../extroot/ +crawler2.0 --debug --load-identifiables="identifiables.yml" -s --provenance=provenance.yml simulation_cfood_baltasar.yml extroot/ diff --git a/integrationtests/use_case_cardiac_simulation/insert_data_model.py b/integrationtests/use_case_cardiac_simulation/insert_data_model.py index 133829994d15bfa982f2e858c52be731bed805be..e3302073ca89e43b2d0ec89f00b2d76d69dd802d 100755 --- a/integrationtests/use_case_cardiac_simulation/insert_data_model.py +++ b/integrationtests/use_case_cardiac_simulation/insert_data_model.py @@ -2,7 +2,3 @@ # Insert the data model using the yaml interface # A. Schlemmer, 02/2022 -from caosadvancedtools.models import parser as parser - -model = parser.parse_model_from_yaml("model.yml") -model.sync_data_model()