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
39d98bce
Commit
39d98bce
authored
2 years ago
by
Georgy Moshkin
Committed by
Georgy Moshkin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
test: rename active -> online
parent
45f88362
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!244
attempt at topology governor
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/int/test_couple.py
+22
-22
22 additions, 22 deletions
test/int/test_couple.py
with
22 additions
and
22 deletions
test/int/test_couple.py
+
22
−
22
View file @
39d98bce
...
@@ -108,43 +108,43 @@ def test_restart_both(cluster2: Cluster):
...
@@ -108,43 +108,43 @@ def test_restart_both(cluster2: Cluster):
def
test_deactivation
(
cluster2
:
Cluster
):
def
test_deactivation
(
cluster2
:
Cluster
):
i1
,
i2
=
cluster2
.
instances
i1
,
i2
=
cluster2
.
instances
def
is_voter_is_
activ
e
(
instance
:
Instance
,
raft_id
):
def
is_voter_is_
onlin
e
(
instance
:
Instance
,
raft_id
):
return
tuple
(
return
tuple
(
instance
.
eval
(
instance
.
eval
(
"""
"""
raft_id = ...
raft_id = ...
grade = box.space.raft_group.index.raft_id:get(raft_id).grade
grade = box.space.raft_group.index.raft_id:get(raft_id).grade
is_
activ
e = grade ==
'
Online
'
is_
onlin
e = grade ==
'
Online
'
voters = box.space.raft_state:get(
'
voters
'
).value
voters = box.space.raft_state:get(
'
voters
'
).value
for _, voter in pairs(voters) do
for _, voter in pairs(voters) do
if voter == raft_id then
if voter == raft_id then
return { true, is_
activ
e }
return { true, is_
onlin
e }
end
end
end
end
return { false, is_
activ
e }
return { false, is_
onlin
e }
"""
,
"""
,
raft_id
,
raft_id
,
)
)
)
)
assert
is_voter_is_
activ
e
(
i1
,
i1
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
onlin
e
(
i1
,
i1
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
activ
e
(
i2
,
i2
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
onlin
e
(
i2
,
i2
.
raft_id
)
==
(
True
,
True
)
i2
.
terminate
()
i2
.
terminate
()
assert
is_voter_is_
activ
e
(
i1
,
i1
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
onlin
e
(
i1
,
i1
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
activ
e
(
i1
,
i2
.
raft_id
)
==
(
False
,
False
)
assert
is_voter_is_
onlin
e
(
i1
,
i2
.
raft_id
)
==
(
False
,
False
)
i2
.
start
()
i2
.
start
()
i2
.
wait_ready
()
i2
.
wait_ready
()
assert
is_voter_is_
activ
e
(
i1
,
i1
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
onlin
e
(
i1
,
i1
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
activ
e
(
i2
,
i2
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
onlin
e
(
i2
,
i2
.
raft_id
)
==
(
True
,
True
)
i1
.
terminate
()
i1
.
terminate
()
assert
is_voter_is_
activ
e
(
i2
,
i1
.
raft_id
)
==
(
False
,
False
)
assert
is_voter_is_
onlin
e
(
i2
,
i1
.
raft_id
)
==
(
False
,
False
)
assert
is_voter_is_
activ
e
(
i2
,
i2
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
onlin
e
(
i2
,
i2
.
raft_id
)
==
(
True
,
True
)
# wait until i2 is leader, so it has someone to send the deactivation
# wait until i2 is leader, so it has someone to send the deactivation
# request to
# request to
...
@@ -158,18 +158,18 @@ def test_deactivation(cluster2: Cluster):
...
@@ -158,18 +158,18 @@ def test_deactivation(cluster2: Cluster):
i1
.
wait_ready
()
i1
.
wait_ready
()
i2
.
wait_ready
()
i2
.
wait_ready
()
assert
is_voter_is_
activ
e
(
i1
,
i1
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
onlin
e
(
i1
,
i1
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
activ
e
(
i2
,
i2
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
onlin
e
(
i2
,
i2
.
raft_id
)
==
(
True
,
True
)
i1
.
terminate
()
i1
.
terminate
()
assert
is_voter_is_
activ
e
(
i2
,
i1
.
raft_id
)
==
(
False
,
False
)
assert
is_voter_is_
onlin
e
(
i2
,
i1
.
raft_id
)
==
(
False
,
False
)
assert
is_voter_is_
activ
e
(
i2
,
i2
.
raft_id
)
==
(
True
,
True
)
assert
is_voter_is_
onlin
e
(
i2
,
i2
.
raft_id
)
==
(
True
,
True
)
def
raft_update_peer
(
def
raft_update_peer
(
host
:
Instance
,
target
:
Instance
,
is_
activ
e
:
bool
host
:
Instance
,
target
:
Instance
,
is_
onlin
e
:
bool
)
->
list
[
bool
]:
)
->
list
[
bool
]:
grade
=
"
Online
"
if
is_
activ
e
else
"
Offline
"
grade
=
"
Online
"
if
is_
onlin
e
else
"
Offline
"
return
host
.
call
(
return
host
.
call
(
"
.raft_update_peer
"
,
"
.raft_update_peer
"
,
target
.
instance_id
,
target
.
instance_id
,
...
@@ -178,11 +178,11 @@ def test_deactivation(cluster2: Cluster):
...
@@ -178,11 +178,11 @@ def test_deactivation(cluster2: Cluster):
)
)
# check idempotency
# check idempotency
assert
raft_update_peer
(
i2
,
target
=
i1
,
is_
activ
e
=
False
)
==
[{}]
assert
raft_update_peer
(
i2
,
target
=
i1
,
is_
onlin
e
=
False
)
==
[{}]
assert
raft_update_peer
(
i2
,
target
=
i1
,
is_
activ
e
=
False
)
==
[{}]
assert
raft_update_peer
(
i2
,
target
=
i1
,
is_
onlin
e
=
False
)
==
[{}]
assert
raft_update_peer
(
i2
,
target
=
i2
,
is_
activ
e
=
True
)
==
[{}]
assert
raft_update_peer
(
i2
,
target
=
i2
,
is_
onlin
e
=
True
)
==
[{}]
assert
raft_update_peer
(
i2
,
target
=
i2
,
is_
activ
e
=
True
)
==
[{}]
assert
raft_update_peer
(
i2
,
target
=
i2
,
is_
onlin
e
=
True
)
==
[{}]
def
test_gl119_panic_in_on_shutdown
(
cluster2
:
Cluster
):
def
test_gl119_panic_in_on_shutdown
(
cluster2
:
Cluster
):
...
...
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