Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-archiver
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
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Platform
Development
swh-archiver
Commits
903a75e9
Commit
903a75e9
authored
8 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
Fix broken tests after migrating archive_id to enum
Also, fix typos in sql schema and data definition
parent
639ccd43
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sql/swh-archiver-data.sql
+1
-1
1 addition, 1 deletion
sql/swh-archiver-data.sql
sql/swh-archiver-schema.sql
+1
-1
1 addition, 1 deletion
sql/swh-archiver-schema.sql
swh/archiver/tests/test_archiver.py
+7
-7
7 additions, 7 deletions
swh/archiver/tests/test_archiver.py
with
9 additions
and
9 deletions
sql/swh-archiver-data.sql
+
1
−
1
View file @
903a75e9
g
INSERT
INTO
archive
(
id
,
url
)
INSERT
INTO
archive
(
id
,
url
)
VALUES
(
'banco'
,
'http://banco.softwareheritage.org:5003/'
);
This diff is collapsed.
Click to expand it.
sql/swh-archiver-schema.sql
+
1
−
1
View file @
903a75e9
...
...
@@ -41,7 +41,7 @@ CREATE TABLE content_archive (
content_id
sha1
,
archive_id
archive_id
REFERENCES
archive
(
id
),
status
archive_status
,
mtime
timestamptz
mtime
timestamptz
,
PRIMARY
KEY
(
content_id
,
archive_id
)
);
...
...
This diff is collapsed.
Click to expand it.
swh/archiver/tests/test_archiver.py
+
7
−
7
View file @
903a75e9
...
...
@@ -69,7 +69,7 @@ class TestArchiver(DbsTestFixture, ServerTestFixture,
# Create the archiver
self
.
archiver
=
self
.
__create_director
()
self
.
storage_data
=
(
'
Local
'
,
'
http://localhost:%s/
'
%
self
.
port
)
self
.
storage_data
=
(
'
banco
'
,
'
http://localhost:%s/
'
%
self
.
port
)
def
tearDown
(
self
):
self
.
empty_tables
()
...
...
@@ -78,16 +78,17 @@ class TestArchiver(DbsTestFixture, ServerTestFixture,
def
initialize_tables
(
self
):
"""
Initializes the database with a sample of items.
"""
# Add an archive
self
.
cursor
.
execute
(
"""
INSERT INTO archive(id, url)
VALUES(
'
Local
'
,
'
{}
'
)
# Add an archive (update existing one for technical reason,
# altering enum cannot run in a transaction...)
self
.
cursor
.
execute
(
"""
UPDATE archive
SET url=
'
{}
'
WHERE id=
'
banco
'
"""
.
format
(
self
.
url
()))
self
.
conn
.
commit
()
def
empty_tables
(
self
):
# Remove all content
self
.
cursor
.
execute
(
'
DELETE FROM content_archive
'
)
self
.
cursor
.
execute
(
'
DELETE FROM archive where id=
\'
Local
\'
'
)
self
.
conn
.
commit
()
def
__add_content
(
self
,
content_data
,
status
=
'
missing
'
,
date
=
'
now()
'
):
...
...
@@ -98,7 +99,7 @@ class TestArchiver(DbsTestFixture, ServerTestFixture,
# Then update database
content_id
=
r
'
\x
'
+
hashutil
.
hash_to_hex
(
content
[
'
sha1
'
])
self
.
cursor
.
execute
(
"""
INSERT INTO content_archive
VALUES(
'
%s
'
::sha1,
'
Local
'
,
'
%s
'
, %s)
VALUES(
'
%s
'
::sha1,
'
banco
'
,
'
%s
'
, %s)
"""
%
(
content_id
,
status
,
date
))
return
content
[
'
sha1
'
]
...
...
@@ -138,7 +139,6 @@ class TestArchiver(DbsTestFixture, ServerTestFixture,
# Integration test
@istest
def
archive_missing_content
(
self
):
"""
Run archiver on a missing content should archive it.
"""
...
...
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