Add e2e test

This commit is contained in:
gvolfing
2022-07-01 11:06:01 +02:00
parent be29933414
commit 78ec129cde
4 changed files with 59 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ add_subdirectory(write_procedures)
add_subdirectory(magic_functions)
add_subdirectory(module_file_manager)
add_subdirectory(monitoring_server)
add_subdirectory(util_e2e)
copy_e2e_python_files(pytest_runner pytest_runner.sh "")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/memgraph-selfsigned.crt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

View File

@@ -0,0 +1,5 @@
function(copy_util_e2e_python_files FILE_NAME)
copy_e2e_python_files(util_e2e ${FILE_NAME})
endfunction()
copy_util_e2e_python_files(utility_simple.py)

View File

@@ -0,0 +1,40 @@
# Copyright 2022 Memgraph Ltd.
#
# Use of this software is governed by the Business Source License
# included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
# License, and you may not use this file except in compliance with the Business Source License.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0, included in the file
# licenses/APL.txt.
import typing
import mgclient
import sys
import pytest
def test_does_throw_if_null_is_checked_against_in_generic_case():
connection = mgclient.connect(host="localhost", port=7687)
connection.autocommit = True
cursor = connection.cursor()
query = """WITH 2 AS name
RETURN CASE name
WHEN 3 THEN 'works'
WHEN null THEN "doesn't work"
ELSE 'something went wrong'
END"""
with pytest.raises(mgclient.DatabaseError) as err:
cursor.execute(query)
error_msg = err.value.args[0]
assert error_msg == "Use the generic form when checking against NULL."
if __name__ == "__main__":
sys.exit(pytest.main([__file__, "-rA"]))

View File

@@ -0,0 +1,13 @@
template_cluster: &template_cluster
cluster:
main:
args: ["--bolt-port", "7687", "--log-level=TRACE"]
log_file: "util-e2e.log"
setup_queries: []
validation_queries: []
workloads:
- name: "Utility simple"
binary: "tests/e2e/pytest_runner.sh"
args: ["util_e2e/utility_simple.py"]
<<: *template_cluster