Skip to content

Commit b8b09de

Browse files
committed
Add cluster-specific tests
1 parent 8ae6ef8 commit b8b09de

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

driver/cluster.feature

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
5+
# These tests are dedicated to test the required cluster-specific functionalities of TypeDB drivers. The files in this package
6+
# can be used to test any client application which aims to support all the operations presented in this file for the
7+
# complete user experience. The following steps are suitable and strongly recommended for both CORE and CLOUD drivers.
8+
9+
# NOTE: It's hard to cover many cluster-specific features in behavior tests, so pay more attention to more flexible
10+
# integration testing.
11+
12+
#noinspection CucumberUndefinedStep
13+
Feature: Driver Cluster
14+
15+
Background: Open connection, create driver, create database
16+
Given typedb starts
17+
Given connection is open: false
18+
Given connection opens with default authentication
19+
Given connection is open: true
20+
Given connection has 0 databases
21+
Given connection create database: typedb
22+
Given connection has database: typedb
23+
24+
#######################
25+
# ADDRESS TRANSLATION #
26+
#######################
27+
28+
Scenario: Driver can work with connection with address translation
29+
Given connection closes
30+
Given connection is open: false
31+
When connection opens with default address translation with default authentication
32+
Then connection is open: true
33+
34+
Then connection has 1 user
35+
When create user with username 'user', password 'password'
36+
Then connection has 2 users
37+
38+
Then connection has 1 database
39+
When connection create database: second
40+
Then connection has 2 databases
41+
42+
When connection open schema transaction for database: typedb
43+
When typeql schema query
44+
"""
45+
define
46+
entity person @abstract, owns name;
47+
attribute name, value string;
48+
"""
49+
Then transaction commits
50+
Then connection get database(typedb) has schema:
51+
"""
52+
define
53+
entity person @abstract, owns name;
54+
attribute name, value string;
55+
"""
56+
57+
When connection open read transaction for database: typedb
58+
When get answers of typeql read query
59+
"""
60+
match entity $p;
61+
"""
62+
Then answer size is: 1
63+

driver/connection.feature

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,29 @@ Feature: Driver Connection
5959
Then connection is open: true
6060
Then connection has database: typedb
6161

62+
63+
Scenario: Driver can retrieve server version information
64+
Then connection contains distribution
65+
Then connection contains version
66+
When connection closes
67+
When connection opens with default authentication
68+
Then connection contains distribution
69+
Then connection contains version
70+
71+
###########
72+
# REPLICA #
73+
###########
74+
# Cluster-specific, but the API should not lead to crashes even without clustering, and we test it here
75+
76+
@ignore-typedb-http
77+
Scenario: Driver can retrieve server replica list
78+
Then connection has 1 replica
79+
80+
81+
@ignore-typedb-http
82+
Scenario: Driver can retrieve primary server replica
83+
Then connection contains primary replica
84+
6285
#############
6386
# DATABASES #
6487
#############

driver/http/http.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Feature: TypeDB HTTP Endpoint
2525
Then connection is healthy: true
2626

2727

28+
# TODO: Remove this as we check it in connection now! Cleanup the steps from the server.
2829
Scenario: Version and distribution are returned from version
2930
Then get endpoint(/v1/version) contains field: distribution
3031
Then get endpoint(/v1/version) contains field: version

0 commit comments

Comments
 (0)