From eff4db5b2767b8b85be4affac8dba52af517105f Mon Sep 17 00:00:00 2001 From: Marko Budiselic <marko.budiselic@memgraph.io> Date: Fri, 17 Mar 2017 10:27:01 +0100 Subject: [PATCH] Add --no-clone-dependencies init script argument. Summary: Add --no-clone-dependencies init script argument. Reviewers: matej.gradicek Reviewed By: matej.gradicek Subscribers: buda Differential Revision: https://phabricator.memgraph.io/D136 --- .gitignore | 1 + init | 27 +++++++++++++++++++++++-- requirements.txt | 2 +- run | 42 +++++++++++++++++++++++++++++++-------- tck_engine/environment.py | 7 +++---- 5 files changed, 64 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index af96cd52f..9aab3010a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ *~ *.pyc ve3/ +tests/ diff --git a/init b/init index d1575c01b..2a5962610 100755 --- a/init +++ b/init @@ -1,5 +1,22 @@ #!/bin/bash +# read arguments +clone_dependencies=true +while [[ $# -gt 0 ]] +do +key="$1" +case $key in + --no-clone-dependencies) + clone_dependencies=false + shift # past argument + ;; + *) + # unknown option + ;; +esac +shift # past argument +done + # exit if any subcommand returns a non-zero status set -e @@ -18,19 +35,25 @@ done # clean tests folder tests_folder=${script_dir}/tests -rm -rf ${tests_folder}/* +mkdir -p ${tests_folder} # clone dressipi's tests cd ${tests_folder} +if ${clone_dependencies} ; then +rm -rf ${tests_folder}/* git clone https://phabricator.memgraph.io/source/pilot_dressipi.git +fi # clean dbms folder dbms_folder=${script_dir}/dbms -rm -rf ${dbms_folder}/* +mkdir -p ${dbms_folder} # clone memgraph & checkout right commit cd ${dbms_folder} +if ${clone_dependencies} ; then +rm -rf ${dbms_folder}/* git clone https://phabricator.memgraph.io/diffusion/MG/memgraph.git +fi memgraph_folder=${dbms_folder}/memgraph cd ${memgraph_folder} git checkout dev diff --git a/requirements.txt b/requirements.txt index ccf399432..b2e6bb13a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ Flask==0.12 itsdangerous==0.24 Jinja2==2.9.5 MarkupSafe==1.0 -neo4j-driver==1.1.2 +neo4j-driver==1.0.2 packaging==16.8 parse==1.8.0 parse-type==0.3.4 diff --git a/run b/run index 9e27af659..98b8f1f24 100755 --- a/run +++ b/run @@ -1,5 +1,22 @@ #!/bin/bash +# read arguments +memgraph_compile=true +while [[ $# -gt 0 ]] +do +key="$1" +case $key in + --no-memgraph-compile) + memgraph_compile=false + shift # past argument + ;; + *) + # unknown option + ;; +esac +shift # past argument +done + # exit if any subcommand returns a non-zero status set -e @@ -11,19 +28,21 @@ memgraph_src_dir=${script_dir}/dbms/memgraph memgraph_build_dir=${script_dir}/dbms/memgraph/build # compile memgraph +if ${memgraph_compile} ; then cd ${memgraph_build_dir} cmake .. make -j8 make copy_hardcoded_queries +fi # setup dressipi -cd ${script_dir}/tests/pilot_dressipi +cd ${script_dir} # setup ve if [ ! -d "ve3" ]; then virtualenv -p python3 ve3 - source ve3/bin/activate pip3 install -r requirements.txt fi +source ve3/bin/activate # binary is available after the build binary_name=$(find ${memgraph_build_dir}/ -maxdepth 1 -executable -name "memgraph*") @@ -32,18 +51,25 @@ config_path="${memgraph_src_dir}/config/memgraph.yaml" # run memgraph MEMGRAPH_CONFIG=${config_path} ${binary_name} & +function cleanup_and_exit { + pkill -9 -f "${binary_name}" + exit $1 +} + # the script has to be carefull because one process has been detached set +e ## run tests # run Dressipi test -source ve3/bin/activate +cd ${script_dir}/tests/pilot_dressipi python run.py exit_code=$? +if [[ ${exit_code} != 0 ]]; then + cleanup_and_exit ${exit_code} +fi -# cleanup -pkill -9 -f "${binary_name}" - -# return test status -exit $exit_code +# run TCK test +cd ${script_dir} +python tck_engine/test_executor.py --root tck_engine/tests/openCypher_M05/tck/features --no-side-effects --db memgraph +cleanup_and_exit ${exit_code} diff --git a/tck_engine/environment.py b/tck_engine/environment.py index 011e083ce..6de62eb5a 100644 --- a/tck_engine/environment.py +++ b/tck_engine/environment.py @@ -34,9 +34,8 @@ def set_logging(context): def create_db_driver(context): uri = context.config.database_uri auth_token = basic_auth(context.config.database_username, context.config.database_password) - if context.config.database == "neo4j": - driver = GraphDatabase.driver(uri, auth=auth_token) + if context.config.database == "neo4j" or context.config.database == "memgraph": + driver = GraphDatabase.driver(uri, auth=auth_token, encrypted=0) else: - #Memgraph - pass + raise "Unsupported database type" return driver