Add GQL behave tests for on-disk storage (#1238)
This commit is contained in:
parent
0d51a20a02
commit
7fbf5857f2
4
.github/workflows/diff.yaml
vendored
4
.github/workflows/diff.yaml
vendored
@ -249,7 +249,9 @@ jobs:
|
||||
|
||||
- name: Run GQL Behave tests
|
||||
run: |
|
||||
cd tests/gql_behave
|
||||
cd tests
|
||||
./setup.sh /opt/toolchain-v4/activate
|
||||
cd gql_behave
|
||||
./continuous_integration
|
||||
|
||||
- name: Save quality assurance status
|
||||
|
@ -459,6 +459,8 @@ class DbAccessor final {
|
||||
}
|
||||
|
||||
storage::Result<std::optional<VertexAccessor>> RemoveVertex(VertexAccessor *vertex_accessor) {
|
||||
accessor_->PrefetchOutEdges(vertex_accessor->impl_);
|
||||
accessor_->PrefetchInEdges(vertex_accessor->impl_);
|
||||
auto res = accessor_->DeleteVertex(&vertex_accessor->impl_);
|
||||
if (res.HasError()) {
|
||||
return res.GetError();
|
||||
|
@ -1,8 +1,6 @@
|
||||
#!/bin/bash
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd "$SCRIPT_DIR"
|
||||
# TODO(gitbuda): Setup mgclient and pymgclient properly.
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../libs/mgclient/lib
|
||||
|
||||
print_help() {
|
||||
echo -e "$0 ["workload name string"]"
|
||||
|
@ -4,7 +4,9 @@ Python script used to run graph query language behavior tests against Memgraph.
|
||||
|
||||
To run the script please execute:
|
||||
```
|
||||
cd memgraph/tests
|
||||
source ve3/bin/activate
|
||||
cd gql_behave
|
||||
./run.py --help
|
||||
./run.py memgraph_V1
|
||||
```
|
||||
|
@ -15,14 +15,14 @@ List of responsibilities:
|
||||
import argparse
|
||||
import atexit
|
||||
import copy
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import yaml
|
||||
|
||||
import yaml
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
TESTS_DIR = os.path.join(SCRIPT_DIR, "tests")
|
||||
@ -66,7 +66,7 @@ def generate_status(suite, result_path, required):
|
||||
if passed == total:
|
||||
msg += " 👍" # +1 emoji
|
||||
else:
|
||||
msg += " ⛔" # no entry emoji
|
||||
msg += " ⛔" # no entry emoji
|
||||
return (msg, passed, total)
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ def generate_result_html(data):
|
||||
return ret
|
||||
|
||||
|
||||
class MemgraphRunner():
|
||||
class MemgraphRunner:
|
||||
def __init__(self, build_directory):
|
||||
self.build_directory = build_directory
|
||||
self.proc_mg = None
|
||||
@ -102,8 +102,7 @@ class MemgraphRunner():
|
||||
|
||||
self.data_directory = tempfile.TemporaryDirectory()
|
||||
memgraph_binary = os.path.join(self.build_directory, "memgraph")
|
||||
args_mg = [memgraph_binary, "--storage-properties-on-edges",
|
||||
"--data-directory", self.data_directory.name]
|
||||
args_mg = [memgraph_binary, "--storage-properties-on-edges", "--data-directory", self.data_directory.name]
|
||||
self.proc_mg = subprocess.Popen(args_mg + self.args)
|
||||
wait_for_server(7687, 1)
|
||||
assert self.is_running(), "The Memgraph process died!"
|
||||
@ -135,7 +134,7 @@ def main():
|
||||
suites = yaml.safe_load(f)
|
||||
|
||||
# venv used to run the qa engine
|
||||
venv_python = os.path.join(SCRIPT_DIR, "ve3", "bin", "python3")
|
||||
venv_python = os.path.join(BASE_DIR, "tests", "ve3", "bin", "python3")
|
||||
|
||||
# Temporary directory for suite results
|
||||
output_dir = tempfile.TemporaryDirectory()
|
||||
@ -153,29 +152,36 @@ def main():
|
||||
mandatory_fails = []
|
||||
|
||||
# Run suites
|
||||
old_storage_mode = ""
|
||||
for suite in suites:
|
||||
print("Starting suite '{}' scenarios.".format(suite["name"]))
|
||||
|
||||
memgraph.start()
|
||||
suite_storage_mode = suite["storage_mode"]
|
||||
if old_storage_mode != suite_storage_mode:
|
||||
memgraph.stop()
|
||||
memgraph.start(["--storage-mode", suite_storage_mode])
|
||||
old_storage_mode = suite_storage_mode
|
||||
|
||||
suite["stats_file"] = os.path.join(output_dir.name,
|
||||
suite["name"] + ".json")
|
||||
cmd = [venv_python, "-u",
|
||||
os.path.join(SCRIPT_DIR, "run.py"),
|
||||
"--stats-file", suite["stats_file"],
|
||||
suite["test_suite"]]
|
||||
suite["stats_file"] = os.path.join(output_dir.name, suite["name"] + ".json")
|
||||
cmd = [
|
||||
venv_python,
|
||||
"-u",
|
||||
os.path.join(SCRIPT_DIR, "run.py"),
|
||||
"--stats-file",
|
||||
suite["stats_file"],
|
||||
suite["test_suite"],
|
||||
]
|
||||
|
||||
# The exit code isn't checked here because the `behave` framework
|
||||
# returns a non-zero exit code when some tests fail.
|
||||
subprocess.run(cmd)
|
||||
|
||||
suite_status, suite_passed, suite_total = \
|
||||
generate_status(suite["name"], suite["stats_file"],
|
||||
suite["must_pass"])
|
||||
suite_status, suite_passed, suite_total = generate_status(
|
||||
suite["name"], suite["stats_file"], suite["must_pass"]
|
||||
)
|
||||
|
||||
status_data.append([suite["name"], suite_status])
|
||||
result_csv += generate_result_csv(suite["name"],
|
||||
suite["stats_file"])
|
||||
result_csv += generate_result_csv(suite["name"], suite["stats_file"])
|
||||
|
||||
if suite["must_pass"] and suite_passed != suite_total:
|
||||
mandatory_fails.append(suite["name"])
|
||||
@ -194,12 +200,12 @@ def main():
|
||||
with open(result_csv_path, "w") as f:
|
||||
f.write(result_csv)
|
||||
|
||||
print(f'CSV status is generated in {result_csv_path}')
|
||||
print(f'HTML status is generated in {result_html_path}')
|
||||
print(f"CSV status is generated in {result_csv_path}")
|
||||
print(f"HTML status is generated in {result_html_path}")
|
||||
|
||||
# Check if tests failed
|
||||
if mandatory_fails != []:
|
||||
sys.exit(f'Some tests that must pass have failed: {mandatory_fails}')
|
||||
sys.exit(f"Some tests that must pass have failed: {mandatory_fails}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -15,9 +15,10 @@
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from behave.__main__ import main as behave_main
|
||||
from behave import configuration
|
||||
|
||||
import mgclient
|
||||
from behave import configuration
|
||||
from behave.__main__ import main as behave_main
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
@ -55,23 +56,16 @@ def main():
|
||||
add_config("--test-directory")
|
||||
|
||||
# Arguments that should be passed on to Behave
|
||||
add_argument("--db-host", default="127.0.0.1",
|
||||
help="server host (default is 127.0.0.1)")
|
||||
add_argument("--db-port", default="7687",
|
||||
help="server port (default is 7687)")
|
||||
add_argument("--db-user", default="memgraph",
|
||||
help="server user (default is memgraph)")
|
||||
add_argument("--db-pass", default="memgraph",
|
||||
help="server pass (default is memgraph)")
|
||||
add_argument("--stop", action="store_true",
|
||||
help="stop testing after first fail")
|
||||
add_argument("--single-fail", action="store_true",
|
||||
help="pause after failed scenario")
|
||||
add_argument("--single-scenario", action="store_true",
|
||||
help="pause after every scenario")
|
||||
add_argument("--single-feature", action="store_true",
|
||||
help="pause after every feature")
|
||||
add_argument("--db-host", default="127.0.0.1", help="server host (default is 127.0.0.1)")
|
||||
add_argument("--db-port", default="7687", help="server port (default is 7687)")
|
||||
add_argument("--db-user", default="memgraph", help="server user (default is memgraph)")
|
||||
add_argument("--db-pass", default="memgraph", help="server pass (default is memgraph)")
|
||||
add_argument("--stop", action="store_true", help="stop testing after first fail")
|
||||
add_argument("--single-fail", action="store_true", help="pause after failed scenario")
|
||||
add_argument("--single-scenario", action="store_true", help="pause after every scenario")
|
||||
add_argument("--single-feature", action="store_true", help="pause after every feature")
|
||||
add_argument("--stats-file", default="", help="statistics output file")
|
||||
add_argument("--storage-mode", default="in_memory", help="Memgraph storage mode")
|
||||
|
||||
# Parse arguments
|
||||
parsed_args = argp.parse_args()
|
||||
@ -96,5 +90,5 @@ def main():
|
||||
return behave_main(behave_args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
@ -1,15 +1,39 @@
|
||||
- name: memgraph_V1
|
||||
test_suite: memgraph_V1
|
||||
storage_mode: IN_MEMORY_TRANSACTIONAL
|
||||
must_pass: true
|
||||
|
||||
- name: openCypher_M09
|
||||
test_suite: openCypher_M09
|
||||
storage_mode: IN_MEMORY_TRANSACTIONAL
|
||||
must_pass: false
|
||||
|
||||
- name: stackoverflow_answers
|
||||
test_suite: stackoverflow_answers
|
||||
storage_mode: IN_MEMORY_TRANSACTIONAL
|
||||
must_pass: true
|
||||
|
||||
- name: unstable
|
||||
test_suite: unstable
|
||||
storage_mode: IN_MEMORY_TRANSACTIONAL
|
||||
must_pass: false
|
||||
|
||||
- name: memgraph_V1_on_disk
|
||||
test_suite: memgraph_V1
|
||||
storage_mode: ON_DISK_TRANSACTIONAL
|
||||
must_pass: true
|
||||
|
||||
- name: openCypher_M09_on_disk
|
||||
test_suite: openCypher_M09
|
||||
storage_mode: ON_DISK_TRANSACTIONAL
|
||||
must_pass: false
|
||||
|
||||
- name: stackoverflow_answers_on_disk
|
||||
test_suite: stackoverflow_answers
|
||||
storage_mode: ON_DISK_TRANSACTIONAL
|
||||
must_pass: true
|
||||
|
||||
- name: unstable_on_disk
|
||||
test_suite: unstable
|
||||
storage_mode: ON_DISK_TRANSACTIONAL
|
||||
must_pass: false
|
||||
|
@ -46,6 +46,7 @@ CFLAGS="-std=c99" python3 setup.py build
|
||||
CFLAGS="-std=c99" python3 setup.py install
|
||||
popd > /dev/null
|
||||
|
||||
|
||||
deactivate
|
||||
|
||||
"$DIR"/e2e/graphql/setup.sh
|
||||
@ -58,7 +59,7 @@ if [ $# == 1 ]; then
|
||||
set +u
|
||||
OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
source $toolchain
|
||||
NEW_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
NEW_LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"../libs/mgclient/lib"
|
||||
deactivate
|
||||
set -u
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user