Skip to content

Commit

Permalink
tck test cluster (#3266)
Browse files Browse the repository at this point in the history
* tck test cluster

* delete useless method

* add graceful termination test

* concurrent

* change lock file in .pytest

* fix ssl setup
  • Loading branch information
HarrisChu authored Nov 30, 2021
1 parent 8872973 commit 71c73e1
Show file tree
Hide file tree
Showing 11 changed files with 818 additions and 298 deletions.
63 changes: 59 additions & 4 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Nebula Graph Test Manual
========================
# Nebula Graph Test Manual

## Usage

Expand Down Expand Up @@ -102,7 +101,7 @@ You can find all nebula test cases in [tck/features](tck/features) and some open

The test cases are organized in feature files and described in gherkin language. The structure of feature file is like following example:

#### Basic Case:
### Basic Case

```gherkin
Feature: Basic match
Expand Down Expand Up @@ -134,7 +133,8 @@ Feature: Basic match
| "serve" | "Cavaliers" |
```

#### Case With an Execution Plan:
### Case With an Execution Plan

```gherkin
Scenario: push edge props filter down
When profiling query:
Expand Down Expand Up @@ -166,6 +166,61 @@ The table in `Then` step must have the first header line even if there's no data

Note that for cases that contain execution plans, it is mandatory to fill the `id` column.

### Case With a New Nebula Cluster

In some special cases, we need to test in a new nebula cluster.

e.g.

```gherkin
Feature: Nebula service termination test
Scenario: Basic termination test
Given a nebulacluster with 1 graphd and 1 metad and 1 storaged
When the cluster was terminated
Then no service should still running after 4s
```

```gherkin
Feature: Example
Scenario: test with disable authorize
Given a nebulacluster with 1 graphd and 1 metad and 1 storaged:
"""
graphd:enable_authorize=false
"""
When executing query:
"""
CREATE USER user1 WITH PASSWORD 'nebula';
CREATE SPACE s1(vid_type=int)
"""
And wait 3 seconds
Then the execution should be successful
When executing query:
"""
GRANT ROLE god on s1 to user1
"""
Then the execution should be successful
Scenario: test with enable authorize
Given a nebulacluster with 1 graphd and 1 metad and 1 storaged:
"""
graphd:enable_authorize=true
"""
When executing query:
"""
CREATE USER user1 WITH PASSWORD 'nebula';
CREATE SPACE s1(vid_type=int)
"""
And wait 3 seconds
Then the execution should be successful
When executing query:
"""
GRANT ROLE god on s1 to user1
"""
Then an PermissionError should be raised at runtime: No permission to grant/revoke god user.
```

It would install a new nebula cluster, and create a session to connect this cluster.

### Format

In order to check your changed files for reviewers conveniently, please format your feature file before creating pull request. Try following command to do that:
Expand Down
1 change: 1 addition & 0 deletions tests/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
_curr_path = Path(os.path.dirname(os.path.abspath(__file__)))

NEBULA_HOME = _curr_path.parent.parent
BUILD_DIR = os.path.join(NEBULA_HOME, 'build')
TMP_DIR = os.path.join(_curr_path.parent, '.pytest')
NB_TMP_PATH = os.path.join(TMP_DIR, 'nebula')
SPACE_TMP_PATH = os.path.join(TMP_DIR, 'spaces')
Loading

0 comments on commit 71c73e1

Please sign in to comment.