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
b9eb684c
Commit
b9eb684c
authored
2 years ago
by
Yaroslav Dynnikov
Browse files
Options
Downloads
Patches
Plain Diff
test: align Cluster.add_instance args types
parent
589c7bbb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!276
test: align Cluster.add_instance args types
Pipeline
#12582
passed
2 years ago
Stage: build
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/conftest.py
+20
-15
20 additions, 15 deletions
test/conftest.py
test/int/test_joining.py
+1
-0
1 addition, 0 deletions
test/int/test_joining.py
with
21 additions
and
15 deletions
test/conftest.py
+
20
−
15
View file @
b9eb684c
...
...
@@ -480,7 +480,7 @@ class Cluster:
self
,
wait_ready
=
True
,
peers
=
None
,
instance_id
:
str
|
bool
|
None
=
True
,
instance_id
:
str
|
bool
=
True
,
failure_domain
=
dict
(),
init_replication_factor
=
1
,
)
->
Instance
:
...
...
@@ -489,30 +489,35 @@ class Cluster:
`instance_id` specifies how the instance
'
s id is generated in the
following way:
- if `instance_id` is a string, it will be used as value for the
`--instance-id` command line option.
- If `instance_id` is `True` (default), this function will generate a
value for the `--instance-id` command line option.
- If `instance_id` is `False` or `None`, the instance will be started
without the `--instance-id` option, and the cluster will have to choose
the id.
- if `instance_id` is a string, it will be used as a value for the
`--instance-id` command-line option.
- If `instance_id` is `True` (default), the `--instance-id` command-line
option will be generated by the pytest according to the instances
sequence number in cluster.
- If `instance_id` is `False`, the instance will be started
without the `--instance-id` command-line option and the particular value
will be generated by the cluster.
"""
i
=
1
+
len
(
self
.
instances
)
generated_instance_id
:
str
|
None
match
instance_id
:
case
True
:
instance_id
=
f
"
i
{
i
}
"
case
False
|
None
:
instance_id
=
None
case
str
()
as
iid
:
instance_id
=
iid
generated_instance_id
=
iid
case
True
:
generated_instance_id
=
f
"
i
{
i
}
"
case
False
:
generated_instance_id
=
None
case
_
:
raise
Exception
(
"
unreachable
"
)
instance
=
Instance
(
binary_path
=
self
.
binary_path
,
cluster_id
=
self
.
id
,
instance_id
=
instance_id
,
instance_id
=
generated_
instance_id
,
data_dir
=
f
"
{
self
.
data_dir
}
/i
{
i
}
"
,
host
=
self
.
base_host
,
port
=
self
.
base_port
+
i
,
...
...
@@ -534,7 +539,7 @@ class Cluster:
def
fail_to_add_instance
(
self
,
peers
=
None
,
instance_id
=
Non
e
,
instance_id
:
str
|
bool
=
Tru
e
,
failure_domain
=
dict
(),
init_replication_factor
=
1
,
):
...
...
This diff is collapsed.
Click to expand it.
test/int/test_joining.py
+
1
−
0
View file @
b9eb684c
...
...
@@ -348,6 +348,7 @@ def test_fail_to_join(cluster: Cluster):
# An instance with the given instance_id is already present in the cluster
# so this instance cannot join
# and therefore exits with failure
assert
i1
.
instance_id
is
not
None
cluster
.
fail_to_add_instance
(
instance_id
=
i1
.
instance_id
,
failure_domain
=
dict
(
owner
=
"
Jim
"
)
)
...
...
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