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
8e3b7f5a
Commit
8e3b7f5a
authored
10 months ago
by
Georgy Moshkin
Committed by
Dmitry Ivanov
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
test: build testplug once per pytest session
parent
c786dcd2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!996
feat(pgproto): introduce --pg-listen option
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/conftest.py
+27
-6
27 additions, 6 deletions
test/conftest.py
test/int/test_plugin.py
+0
-24
0 additions, 24 deletions
test/int/test_plugin.py
with
27 additions
and
30 deletions
test/conftest.py
+
27
−
6
View file @
8e3b7f5a
...
...
@@ -19,7 +19,6 @@ import msgpack # type: ignore
from
rand.params
import
generate_seed
from
functools
import
reduce
from
datetime
import
datetime
from
shutil
import
rmtree
from
typing
import
(
Any
,
Callable
,
...
...
@@ -826,7 +825,7 @@ class Instance:
self
.
start
()
def
remove_data
(
self
):
rmtree
(
self
.
data_dir
)
shutil
.
rmtree
(
self
.
data_dir
)
def
raft_propose_nop
(
self
):
return
self
.
call
(
"
pico.raft_propose_nop
"
)
...
...
@@ -1413,7 +1412,7 @@ class Cluster:
raise
Exception
(
errors
)
def
remove_data
(
self
):
rmtree
(
self
.
data_dir
)
shutil
.
rmtree
(
self
.
data_dir
)
def
expel
(
self
,
target
:
Instance
,
peer
:
Instance
|
None
=
None
):
peer
=
peer
if
peer
else
target
...
...
@@ -1693,7 +1692,25 @@ def binary_path(cargo_build: None) -> str:
if
profile
==
"
dev
"
:
profile
=
"
debug
"
return
os
.
path
.
realpath
(
os
.
path
.
join
(
target
,
f
"
{
profile
}
/picodata
"
))
binary_path
=
os
.
path
.
realpath
(
os
.
path
.
join
(
target
,
f
"
{
profile
}
/picodata
"
))
# Copy the test plugin library into the appropriate location
test_dir
=
os
.
path
.
dirname
(
__file__
)
assert
test_dir
.
endswith
(
"
test
"
)
ext
=
None
match
sys
.
platform
:
case
"
linux
"
:
ext
=
"
so
"
case
"
darwin
"
:
ext
=
"
dylib
"
source
=
f
"
{
os
.
path
.
dirname
(
binary_path
)
}
/libtestplug.
{
ext
}
"
destination
=
f
"
{
test_dir
}
/testplug/libtestplug.
{
ext
}
"
eprint
(
f
"
Copying
'
{
source
}
'
to
'
{
destination
}
'"
)
shutil
.
copyfile
(
source
,
destination
)
return
binary_path
@pytest.fixture
(
scope
=
"
session
"
)
...
...
@@ -1722,11 +1739,15 @@ def cargo_build(pytestconfig: pytest.Config) -> None:
eprint
(
f
"
Running
{
cmd
}
"
)
assert
subprocess
.
call
(
cmd
)
==
0
,
"
cargo build failed
"
cmd
=
[
"
cargo
"
,
"
build
"
,
"
-p
"
,
"
gostech-audit-log
"
]
cmd
=
[
"
cargo
"
,
"
build
"
,
"
-p
"
,
"
gostech-audit-log
"
,
"
--profile
"
,
build_profile
()
]
eprint
(
f
"
Running
{
cmd
}
"
)
assert
subprocess
.
call
(
cmd
)
==
0
,
"
cargo build gostech audit log failed
"
cmd
=
[
"
cargo
"
,
"
build
"
,
"
-p
"
,
"
gostech-metrics
"
]
cmd
=
[
"
cargo
"
,
"
build
"
,
"
-p
"
,
"
gostech-metrics
"
,
"
--profile
"
,
build_profile
()]
eprint
(
f
"
Running
{
cmd
}
"
)
assert
subprocess
.
call
(
cmd
)
==
0
,
"
cargo build gostech metrics failed
"
cmd
=
[
"
cargo
"
,
"
build
"
,
"
-p
"
,
"
testplug
"
,
"
--profile
"
,
build_profile
()]
eprint
(
f
"
Running
{
cmd
}
"
)
assert
subprocess
.
call
(
cmd
)
==
0
,
"
cargo build gostech metrics failed
"
...
...
This diff is collapsed.
Click to expand it.
test/int/test_plugin.py
+
0
−
24
View file @
8e3b7f5a
import
pytest
import
time
import
os
import
sys
import
shutil
from
conftest
import
Cluster
,
ReturnError
,
retrying
,
Instance
_3_SEC
=
3
...
...
@@ -190,27 +187,6 @@ class PluginReflection:
# ---------------------------------- } Test helper classes ----------------------------------------
@pytest.fixture
def
cluster
(
cluster
:
Cluster
)
->
Cluster
:
parent
=
os
.
path
.
dirname
(
__file__
)
assert
parent
.
endswith
(
"
test/int
"
)
test_dir
=
os
.
path
.
dirname
(
parent
)
ext
=
None
match
sys
.
platform
:
case
"
linux
"
:
ext
=
"
so
"
case
"
darwin
"
:
ext
=
"
dylib
"
destination
=
f
"
{
test_dir
}
/testplug/libtestplug.
{
ext
}
"
if
not
os
.
path
.
exists
(
destination
):
build_dir
=
os
.
path
.
dirname
(
cluster
.
binary_path
)
shutil
.
copyfile
(
f
"
{
build_dir
}
/libtestplug.
{
ext
}
"
,
destination
)
return
cluster
def
test_invalid_manifest_plugin
(
cluster
:
Cluster
):
i1
,
i2
=
cluster
.
deploy
(
instance_count
=
2
)
...
...
This diff is collapsed.
Click to expand it.
Yaroslav Dynnikov
@rosik
mentioned in merge request
!976 (closed)
·
10 months ago
mentioned in merge request
!976 (closed)
mentioned in merge request !976
Toggle commit list
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