Skip to content

Commit

Permalink
Cast version to string when enqueueing task
Browse files Browse the repository at this point in the history
Fixes WAREHOUSE-PRODUCTION-1R3.
  • Loading branch information
di committed Mar 19, 2024
1 parent 999c750 commit bf1f041
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 49 additions & 0 deletions tests/unit/forklift/test_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,8 @@ def storage_service_store(path, file_path, *, meta):
db_request.registry.settings = {
"warehouse.release_files_table": "example.pypi.distributions"
}
delay = pretend.call_recorder(lambda a: None)
db_request.task = pretend.call_recorder(lambda a: pretend.stub(delay=delay))

resp = legacy.file_upload(db_request)

Expand Down Expand Up @@ -1085,6 +1087,53 @@ def storage_service_store(path, file_path, *, meta):
pretend.call(update_bigquery_release_files),
pretend.call(sync_file_to_cache),
]
assert delay.calls == [
pretend.call(
{
"metadata_version": "1.2",
"name": project.name,
"version": release.version,
"summary": None,
"description": "an example description",
"author": None,
"description_content_type": None,
"author_email": None,
"maintainer": None,
"maintainer_email": None,
"license": None,
"keywords": None,
"classifiers": ["Environment :: Other Environment"],
"platform": None,
"home_page": None,
"download_url": None,
"requires_python": None,
"pyversion": "source",
"filetype": "sdist",
"comment": None,
"requires": None,
"provides": None,
"obsoletes": None,
"requires_dist": None,
"provides_dist": None,
"obsoletes_dist": None,
"requires_external": None,
"project_urls": None,
"filename": uploaded_file.filename,
"python_version": "source",
"packagetype": "sdist",
"comment_text": None,
"size": uploaded_file.size,
"has_signature": False,
"md5_digest": uploaded_file.md5_digest,
"sha256_digest": uploaded_file.sha256_digest,
"blake2_256_digest": uploaded_file.blake2_256_digest,
"path": uploaded_file.path,
"uploaded_via": "warehouse-tests/6.6.6",
"upload_time": uploaded_file.upload_time,
}
),
pretend.call(uploaded_file.id),
]

assert metrics.increment.calls == [
pretend.call("warehouse.upload.attempt"),
Expand Down
2 changes: 1 addition & 1 deletion warehouse/forklift/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ def file_upload(request):
dist_metadata = {
"metadata_version": meta.metadata_version,
"name": meta.name,
"version": meta.version,
"version": str(meta.version),
"summary": meta.summary,
"description": meta.description,
"author": meta.author,
Expand Down

0 comments on commit bf1f041

Please sign in to comment.