Skip to content

Commit 3acc167

Browse files
committed
Fix failing tests due to recent ACL changes
1 parent 105c33b commit 3acc167

File tree

8 files changed

+19
-8
lines changed

8 files changed

+19
-8
lines changed

examples/simple/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ set up the Dgraph cluster:
1515
version: "3.2"
1616
services:
1717
zero:
18-
image: dgraph/dgraph:v1.1.0
18+
image: dgraph/dgraph:latest
1919
restart: on-failure
2020
command: dgraph zero --my=zero:5080
2121
server:
22-
image: dgraph/dgraph:v1.1.0
22+
image: dgraph/dgraph:latest
2323
ports:
2424
- 8080:8080
2525
- 9080:9080

examples/simple/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pydgraph>=1.0a1.0
1+
pydgraph>=2.0.2

tests/helper.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
__author__ = 'Garvit Pahal <[email protected]>'
1818
__maintainer__ = 'Martin Martinez Rivera <[email protected]>'
1919

20+
import time
2021
import unittest
2122

2223
import pydgraph
@@ -58,4 +59,11 @@ def setUp(self):
5859
"""Sets up the client."""
5960

6061
self.client = create_client(self.TEST_SERVER_ADDR)
61-
self.client.login("groot", "password")
62+
while True:
63+
try:
64+
self.client.login("groot", "password")
65+
break
66+
except Exception as e:
67+
if not "user not found" in str(e):
68+
raise e
69+
time.sleep(0.1)

tests/test_acct_upsert.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def assert_changes(self, firsts, accounts):
111111
def upsert_account(addr, account, success_ctr, retry_ctr):
112112
"""Runs upsert operation."""
113113
client = helper.create_client(addr)
114+
client.login("groot", "password")
114115
query = """{{
115116
acct(func:eq(first, "{first}")) @filter(eq(last, "{last}") AND eq(age, {age})) {{
116117
uid
@@ -167,6 +168,7 @@ def upsert_account(addr, account, success_ctr, retry_ctr):
167168
def upsert_account_upsert_block(addr, account, success_ctr, retry_ctr):
168169
"""Runs upsert operation."""
169170
client = helper.create_client(addr)
171+
client.login("groot", "password")
170172
query = """{{
171173
acct(func:eq(first, "{first}")) @filter(eq(last, "{last}") AND eq(age, {age})) {{
172174
u as uid

tests/test_acl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import unittest
2424

2525
from . import helper
26-
26+
import pydgraph
2727

2828
class TestACL(helper.ClientIntegrationTestCase):
2929
user_id = 'alice'
@@ -68,6 +68,8 @@ def change_permission(self, permission):
6868
bash_command = "dgraph acl -a " + self.server_addr + " mod -g " + self.group_id + \
6969
" -p name -m " + str(permission) + " -x password"
7070
self.run_command(bash_command)
71+
# wait for ACL cache to be refreshed.
72+
time.sleep(6)
7173

7274
def insert_sample_data(self):
7375
txn = self.client.txn()
@@ -130,7 +132,7 @@ def try_altering(self, expected):
130132
self.fail("Acl test failed: Alter successful without permission")
131133
except Exception as e:
132134
if expected:
133-
self.fail("Acl test failed: Alter failed for altreble predicate.\n" + str(e))
135+
self.fail("Acl test failed: Alter failed for alterable predicate.\n" + str(e))
134136

135137

136138
def suite():

tests/test_txn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def test_read_from_new_client(self):
211211
txn.commit()
212212

213213
client2 = helper.create_client(self.TEST_SERVER_ADDR)
214+
client2.login("groot", "password")
214215
query = """{{
215216
me(func: uid("{uid:s}")) {{
216217
name

tests/test_type_system.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
from tests import helper
2424

25-
2625
class TestTypeSystem(helper.ClientIntegrationTestCase):
2726
def setUp(self):
2827
super(TestTypeSystem, self).setUp()

tests/test_upsert_block.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
from . import helper
2424

25-
2625
class TestUpsertBlock(helper.ClientIntegrationTestCase):
2726
"""Tests for Upsert Block"""
2827

0 commit comments

Comments
 (0)