Fix tests for tag removal and version behavior
- Fix upload response to return actual version (not requested version) when artifact already has a version in the package - Update ref_count tests to use multiple packages (one version per artifact per package design constraint) - Remove allow_public_internet references from upstream caching tests - Update consistency check test to not assert global system health - Add versions field to artifact schemas - Fix dependencies resolution to handle removed tag constraint
This commit is contained in:
@@ -229,7 +229,11 @@ class TestProjectCascadeDelete:
|
||||
def test_ref_count_decrements_on_project_delete(
|
||||
self, integration_client, unique_test_id
|
||||
):
|
||||
"""Test ref_count decrements for all tags when project is deleted."""
|
||||
"""Test ref_count decrements for all versions when project is deleted.
|
||||
|
||||
Each package can only have one version per artifact (same content = same version).
|
||||
With 2 packages, ref_count should be 2, and go to 0 when project is deleted.
|
||||
"""
|
||||
project_name = f"cascade-proj-{unique_test_id}"
|
||||
package1_name = f"pkg1-{unique_test_id}"
|
||||
package2_name = f"pkg2-{unique_test_id}"
|
||||
@@ -253,26 +257,20 @@ class TestProjectCascadeDelete:
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
# Upload same content with tags in both packages
|
||||
# Upload same content to both packages
|
||||
content = f"project cascade test {unique_test_id}".encode()
|
||||
expected_hash = compute_sha256(content)
|
||||
|
||||
upload_test_file(
|
||||
integration_client, project_name, package1_name, content, version="v1"
|
||||
integration_client, project_name, package1_name, content, version="1.0.0"
|
||||
)
|
||||
upload_test_file(
|
||||
integration_client, project_name, package1_name, content, version="v2"
|
||||
)
|
||||
upload_test_file(
|
||||
integration_client, project_name, package2_name, content, version="latest"
|
||||
)
|
||||
upload_test_file(
|
||||
integration_client, project_name, package2_name, content, version="stable"
|
||||
integration_client, project_name, package2_name, content, version="1.0.0"
|
||||
)
|
||||
|
||||
# Verify ref_count is 4 (2 tags in each of 2 packages)
|
||||
# Verify ref_count is 2 (1 version in each of 2 packages)
|
||||
response = integration_client.get(f"/api/v1/artifact/{expected_hash}")
|
||||
assert response.json()["ref_count"] == 4
|
||||
assert response.json()["ref_count"] == 2
|
||||
|
||||
# Delete the project
|
||||
delete_response = integration_client.delete(f"/api/v1/projects/{project_name}")
|
||||
|
||||
Reference in New Issue
Block a user