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
8800a7e7
Commit
8800a7e7
authored
2 years ago
by
Yaroslav Dynnikov
Committed by
Yaroslav Dynnikov
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
test: refactor gl119_panic_on_shutdown
parent
d65748bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!371
Several on_shutdown test enhancements
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/int/test_shutdown.py
+11
-12
11 additions, 12 deletions
test/int/test_shutdown.py
with
11 additions
and
12 deletions
test/int/test_shutdown.py
+
11
−
12
View file @
8800a7e7
import
os
import
pytest
import
signal
from
conftest
import
Cluster
from
time
import
sleep
@pytest.fixture
...
...
@@ -9,20 +10,18 @@ def cluster2(cluster: Cluster):
return
cluster
def
test_gl119_panic_
in_
on_shutdown
(
cluster2
:
Cluster
):
def
test_gl119_panic_on_shutdown
(
cluster2
:
Cluster
):
i1
,
i2
=
cluster2
.
instances
i2
.
assert_raft_status
(
"
Follower
"
,
leader_id
=
i1
.
raft_id
)
i2
.
call
(
"
picolib.raft_timeout_now
"
,
timeout
=
0.01
)
assert
i2
.
terminate
()
==
0
# second instance terminates first, so it becomes a follower
i2
.
terminate
()
# terminate the leader, so the follower can't acquire the read barrier
i1
.
terminate
()
# suspend i1 (leader) and force i2 to start a new term
assert
i1
.
process
is
not
None
os
.
killpg
(
i1
.
process
.
pid
,
signal
.
SIGSTOP
)
i2
.
call
(
"
picolib.raft_timeout_now
"
)
# it can't win the election because there is no quorum
i2
.
assert_raft_status
(
"
Candidate
"
)
i2
.
start
()
# wait for the follower to start acquiring the read barrier
sleep
(
1
)
# stopping i2 in that state still shouldn't be a problem
assert
i2
.
terminate
()
==
0
...
...
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