Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
248aee81
Commit
248aee81
authored
2 years ago
by
Yaroslav Dynnikov
Browse files
Options
Downloads
Patches
Plain Diff
test: replication setup
parent
e5196d3b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!118
feature: set up replication when instance joins
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/int/conftest.py
+6
-0
6 additions, 0 deletions
test/int/conftest.py
test/int/test_joining.py
+33
-0
33 additions, 0 deletions
test/int/test_joining.py
with
39 additions
and
0 deletions
test/int/conftest.py
+
6
−
0
View file @
248aee81
...
...
@@ -139,6 +139,12 @@ class Instance:
def
listen
(
self
):
return
f
"
{
self
.
host
}
:
{
self
.
port
}
"
def
instance_uuid
(
self
):
return
self
.
eval
(
"
return box.info.uuid
"
)
def
replicaset_uuid
(
self
):
return
self
.
eval
(
"
return box.info.cluster.uuid
"
)
@property
def
command
(
self
):
# fmt: off
...
...
This diff is collapsed.
Click to expand it.
test/int/test_joining.py
+
33
−
0
View file @
248aee81
...
...
@@ -154,3 +154,36 @@ def test_discovery(cluster3: Cluster):
# add instance
i5
=
cluster3
.
add_instance
(
peers
=
[
i3
.
listen
])
i5
.
assert_raft_status
(
"
Follower
"
,
leader_id
=
i2
.
raft_id
)
def
test_replication
(
cluster2
:
Cluster
):
i1
,
i2
=
cluster2
.
instances
assert
i1
.
replicaset_uuid
()
==
i2
.
replicaset_uuid
()
for
instance
in
cluster2
.
instances
:
with
instance
.
connection
(
1
)
as
conn
:
raft_peer
=
conn
.
select
(
"
raft_group
"
,
[
instance
.
raft_id
])[
0
]
space_cluster
=
conn
.
select
(
"
_cluster
"
)
cfg_replication
=
conn
.
eval
(
"
return box.cfg.replication
"
)
assert
raft_peer
[:
-
1
]
==
[
instance
.
raft_id
,
instance
.
eval
(
"
return box.info.listen
"
),
True
,
# voter
instance
.
instance_id
,
"
r1
"
,
instance
.
eval
(
"
return box.info.uuid
"
),
instance
.
eval
(
"
return box.info.cluster.uuid
"
),
]
assert
list
(
space_cluster
)
==
[
[
1
,
i1
.
instance_uuid
()],
[
2
,
i2
.
instance_uuid
()],
]
if
instance
==
i1
:
with
pytest
.
raises
(
AssertionError
):
# FIXME
assert
cfg_replication
[
0
]
==
[
i1
.
listen
,
i2
.
listen
]
else
:
assert
cfg_replication
[
0
]
==
[
i1
.
listen
,
i2
.
listen
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment