(self)
| 23 | self.env = Env(decodeResponses=True, env='oss', useSlaves=True) |
| 24 | |
| 25 | def test_CRUD_replication(self): |
| 26 | # create a simple graph |
| 27 | env = self.env |
| 28 | source_con = env.getConnection() |
| 29 | replica_con = env.getSlaveConnection() |
| 30 | |
| 31 | # enable write commands on slave, required as all RedisGraph |
| 32 | # commands are registered as write commands |
| 33 | replica_con.config_set("slave-read-only", "no") |
| 34 | |
| 35 | # the WAIT command forces master slave sync to complete |
| 36 | source_con.execute_command("WAIT", "1", "0") |
| 37 | |
| 38 | # perform CRUD operations |
| 39 | |
| 40 | #----------------------------------------------------------------------- |
| 41 | # create a simple graph |
| 42 | #----------------------------------------------------------------------- |
| 43 | |
| 44 | src = Graph(source_con, GRAPH_ID) |
| 45 | replica = Graph(replica_con, GRAPH_ID) |
| 46 | |
| 47 | s = Node(label='L', properties={'id': 0, 'name': 'abcd', 'height' : 178}) |
| 48 | t = Node(label='L', properties={'id': 1, 'name': 'efgh', 'height' : 178}) |
| 49 | e = Edge(s, 'R', t) |
| 50 | |
| 51 | src.add_node(s) |
| 52 | src.add_node(t) |
| 53 | src.add_edge(e) |
| 54 | src.flush() |
| 55 | |
| 56 | #----------------------------------------------------------------------- |
| 57 | # create indices |
| 58 | #----------------------------------------------------------------------- |
| 59 | |
| 60 | # create index |
| 61 | create_node_exact_match_index(src, 'L', 'id') |
| 62 | |
| 63 | # create full-text index |
| 64 | create_fulltext_index(src, 'L', 'name') |
| 65 | |
| 66 | # add fields to existing index |
| 67 | create_fulltext_index(src, 'L', 'title', 'desc', sync=True) |
| 68 | |
| 69 | # create full-text index with index config |
| 70 | q = "CALL db.idx.fulltext.createNodeIndex({label: 'L1', language: 'german', stopwords: ['a', 'b'] }, 'title', 'desc')" |
| 71 | src.query(q) |
| 72 | |
| 73 | #----------------------------------------------------------------------- |
| 74 | # create constraints |
| 75 | #----------------------------------------------------------------------- |
| 76 | |
| 77 | # create node unique constraint |
| 78 | create_unique_node_constraint(src, "L", "id") |
| 79 | |
| 80 | # add another unique constraint |
| 81 | create_unique_node_constraint(src, "L", "id", "name", sync=True) |
| 82 |
nothing calls this directly
no test coverage detected