Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-scrubber
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Antoine Lambert
swh-scrubber
Commits
a20e6735
Commit
a20e6735
authored
1 year ago
by
David Douard
Browse files
Options
Downloads
Patches
Plain Diff
journal_checker: Check the 'check_references' flag is not set
parent
566db2ac
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
swh/scrubber/journal_checker.py
+6
-0
6 additions, 0 deletions
swh/scrubber/journal_checker.py
swh/scrubber/tests/test_journal_kafka.py
+40
-3
40 additions, 3 deletions
swh/scrubber/tests/test_journal_kafka.py
with
46 additions
and
3 deletions
swh/scrubber/journal_checker.py
+
6
−
0
View file @
a20e6735
...
...
@@ -49,6 +49,12 @@ class JournalChecker:
self
.
db
=
db
self
.
config_id
=
config_id
if
self
.
config
.
check_references
:
raise
ValueError
(
"
The journal checcker cannot check for references, please set
"
"
the
'
check_references
'
to False in the config entry %s.
"
,
self
.
config_id
,
)
self
.
journal_client_config
=
journal
.
copy
()
if
"
object_types
"
in
self
.
journal_client_config
:
raise
ValueError
(
...
...
This diff is collapsed.
Click to expand it.
swh/scrubber/tests/test_journal_kafka.py
+
40
−
3
View file @
a20e6735
...
...
@@ -67,7 +67,11 @@ def test_no_corruption(
for
object_type
in
(
"
directory
"
,
"
revision
"
,
"
release
"
,
"
snapshot
"
):
journal_cfg
[
"
group_id
"
]
=
gid
+
object_type
config_id
=
scrubber_db
.
config_add
(
f
"
cfg_
{
object_type
}
"
,
datastore
,
getattr
(
ObjectType
,
object_type
.
upper
()),
1
name
=
f
"
cfg_
{
object_type
}
"
,
datastore
=
datastore
,
object_type
=
getattr
(
ObjectType
,
object_type
.
upper
()),
nb_partitions
=
1
,
check_references
=
False
,
)
jc
=
JournalChecker
(
db
=
scrubber_db
,
...
...
@@ -90,7 +94,11 @@ def test_corrupt_snapshot(
corrupt_idx
,
):
config_id
=
scrubber_db
.
config_add
(
"
cfg_snapshot
"
,
datastore
,
ObjectType
.
SNAPSHOT
,
1
name
=
"
cfg_snapshot
"
,
datastore
=
datastore
,
object_type
=
ObjectType
.
SNAPSHOT
,
nb_partitions
=
1
,
check_references
=
False
,
)
snapshots
=
list
(
swh_model_data
.
SNAPSHOTS
)
snapshots
[
corrupt_idx
]
=
attr
.
evolve
(
snapshots
[
corrupt_idx
],
id
=
b
"
\x00
"
*
20
)
...
...
@@ -131,7 +139,11 @@ def test_corrupt_snapshots(
datastore
,
):
config_id
=
scrubber_db
.
config_add
(
"
cfg_snapshot
"
,
datastore
,
ObjectType
.
SNAPSHOT
,
1
name
=
"
cfg_snapshot
"
,
datastore
=
datastore
,
object_type
=
ObjectType
.
SNAPSHOT
,
nb_partitions
=
1
,
check_references
=
False
,
)
snapshots
=
list
(
swh_model_data
.
SNAPSHOTS
)
for
i
in
(
0
,
1
):
...
...
@@ -155,3 +167,28 @@ def test_corrupt_snapshots(
"
swh:1:snp:0101010101010101010101010101010101010101
"
,
]
}
def
test_check_references_raises
(
scrubber_db
,
kafka_server
,
kafka_prefix
,
kafka_consumer_group
,
datastore
,
):
config_id
=
scrubber_db
.
config_add
(
name
=
"
cfg_snapshot
"
,
datastore
=
datastore
,
object_type
=
ObjectType
.
SNAPSHOT
,
nb_partitions
=
1
,
check_references
=
True
,
)
journal_config
=
journal_client_config
(
kafka_server
,
kafka_prefix
,
kafka_consumer_group
)
with
pytest
.
raises
(
ValueError
):
JournalChecker
(
db
=
scrubber_db
,
config_id
=
config_id
,
journal
=
journal_config
,
)
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