Skip to content
This repository was archived by the owner on Sep 7, 2023. It is now read-only.

Commit 2007225

Browse files
author
Alex Walker
authored
Fix tests using wrong method to check db existence (typedb#188)
## What is the goal of this PR? Our tests were using the syntax: `if "grakn" in client.databases().all()` which no longer works, because `all()` now returns `Database` objects, not strings. We updated them to the new syntax: `if client.databases().contains("grakn")`. ## What are the changes implemented in this PR? Fix tests using wrong method to check db existence
1 parent 59b78c6 commit 2007225

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

tests/deployment/test.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,14 @@ def tearDownClass(cls):
4141
client.close()
4242

4343
def setUp(self):
44-
if "grakn" not in client.databases().all():
44+
if not client.databases().contains("grakn"):
4545
client.databases().create("grakn")
4646

4747
def test_database(self):
48-
dbs = client.databases().all()
49-
if "grakn" in dbs:
48+
if client.databases().contains("grakn"):
5049
client.databases().get("grakn").delete()
5150
client.databases().create("grakn")
52-
dbs = client.databases().all()
53-
self.assertTrue("grakn" in dbs)
51+
self.assertTrue(client.databases().contains("grakn"))
5452

5553
def test_session(self):
5654
session = client.session("grakn", SessionType.SCHEMA)

tests/integration/test_cluster_failover.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TestClusterFailover(TestCase):
2828

2929
def setUp(self):
3030
with GraknClient.cluster(["localhost:11729", "localhost:21729", "localhost:31729"]) as client:
31-
if "grakn" in client.databases().all():
31+
if client.databases().contains("grakn"):
3232
client.databases().get("grakn").delete()
3333
client.databases().create("grakn")
3434

tests/integration/test_concurrent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class TestConcurrent(TestCase):
3030

3131
def setUp(self):
3232
with GraknClient.core() as client:
33-
if "grakn" not in client.databases().all():
33+
if not client.databases().contains("grakn"):
3434
client.databases().create("grakn")
3535

3636
def open_tx(self, session: Session, *args):

tools/cluster_test_rule.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _rule_implementation(ctx):
5757
./1/grakn server --data data --address=127.0.0.1:11729:11730 --peers=127.0.0.1:11729:11730,127.0.0.1:21729:21730,127.0.0.1:31729:31730 &
5858
./2/grakn server --data data --address=127.0.0.1:21729:21730 --peers=127.0.0.1:11729:11730,127.0.0.1:21729:21730,127.0.0.1:31729:31730 &
5959
./3/grakn server --data data --address=127.0.0.1:31729:31730 --peers=127.0.0.1:11729:11730,127.0.0.1:21729:21730,127.0.0.1:31729:31730 &
60-
sleep 15
60+
sleep 20
6161
6262
"""
6363

0 commit comments

Comments
 (0)