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
83502c0a
Commit
83502c0a
authored
2 years ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
test: check for grade incarnations in tests
parent
ea47feda
No related branches found
No related tags found
1 merge request
!300
fix(governor): restarted instance reruns grade transitions by virtue of grade incarnations
Pipeline
#13440
passed
2 years ago
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/conftest.py
+3
-0
3 additions, 0 deletions
test/conftest.py
test/int/test_couple.py
+17
-0
17 additions, 0 deletions
test/int/test_couple.py
with
20 additions
and
0 deletions
test/conftest.py
+
3
−
0
View file @
83502c0a
...
...
@@ -214,6 +214,9 @@ class Instance:
def
listen
(
self
):
return
f
"
{
self
.
host
}
:
{
self
.
port
}
"
def
current_grade
(
self
):
return
self
.
call
(
"
picolib.peer_info
"
,
self
.
instance_id
)[
"
current_grade
"
]
def
instance_uuid
(
self
):
return
self
.
eval
(
"
return box.info.uuid
"
)
...
...
This diff is collapsed.
Click to expand it.
test/int/test_couple.py
+
17
−
0
View file @
83502c0a
...
...
@@ -59,11 +59,18 @@ def test_restart_follower(cluster2: Cluster):
# Then it's able to start and remain a follower
i1
,
i2
=
cluster2
.
instances
assert
i1
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
1
)
assert
i2
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
1
)
i2
.
restart
()
i2
.
wait_online
()
assert
i2
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
2
)
i1
.
assert_raft_status
(
"
Leader
"
)
i2
.
assert_raft_status
(
"
Follower
"
)
i2
.
restart
()
i2
.
wait_online
()
assert
i2
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
3
)
def
test_restart_leader
(
cluster2
:
Cluster
):
# Given a cluster of two instances - i1 (leader) and i2 (follower)
...
...
@@ -72,10 +79,16 @@ def test_restart_leader(cluster2: Cluster):
# No assuptions about leadership are made though.
i1
,
_
=
cluster2
.
instances
assert
i1
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
1
)
i1
.
restart
()
i1
.
wait_online
()
assert
i1
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
2
)
i1
.
raft_propose_eval
(
"
return
"
)
i1
.
restart
()
i1
.
wait_online
()
assert
i1
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
3
)
def
test_restart_both
(
cluster2
:
Cluster
):
# Given a cluster of 2 instances - i1, i2
...
...
@@ -83,6 +96,8 @@ def test_restart_both(cluster2: Cluster):
# Then both can become ready and handle proposals.
i1
,
i2
=
cluster2
.
instances
assert
i1
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
1
)
assert
i2
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
1
)
i1
.
terminate
()
i2
.
terminate
()
...
...
@@ -98,7 +113,9 @@ def test_restart_both(cluster2: Cluster):
i2
.
start
()
i1
.
wait_online
()
assert
i1
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
2
)
i2
.
wait_online
()
assert
i1
.
current_grade
()
==
dict
(
variant
=
"
Online
"
,
incarnation
=
2
)
i1
.
raft_propose_eval
(
"
rawset(_G,
'
check
'
, true)
"
)
assert
i1
.
eval
(
"
return check
"
)
is
True
...
...
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