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:
@@ -1599,11 +1599,9 @@ class TestCacheSettingsAdminAPI:
|
||||
|
||||
data = response.json()
|
||||
# Check expected fields exist
|
||||
assert "allow_public_internet" in data
|
||||
assert "auto_create_system_projects" in data
|
||||
|
||||
# Check types
|
||||
assert isinstance(data["allow_public_internet"], bool)
|
||||
assert isinstance(data["auto_create_system_projects"], bool)
|
||||
|
||||
@pytest.mark.integration
|
||||
@@ -1616,7 +1614,7 @@ class TestCacheSettingsAdminAPI:
|
||||
with httpx.Client(base_url=base_url, timeout=30.0) as unauthenticated_client:
|
||||
response = unauthenticated_client.put(
|
||||
"/api/v1/admin/cache-settings",
|
||||
json={"allow_public_internet": False},
|
||||
json={"auto_create_system_projects": False},
|
||||
)
|
||||
assert response.status_code in (401, 403)
|
||||
|
||||
@@ -1630,76 +1628,43 @@ class TestCacheSettingsAdminAPI:
|
||||
response = integration_client.put(
|
||||
"/api/v1/admin/cache-settings",
|
||||
json={
|
||||
"allow_public_internet": not original["allow_public_internet"],
|
||||
"auto_create_system_projects": not original["auto_create_system_projects"],
|
||||
},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
data = response.json()
|
||||
assert data["allow_public_internet"] == (not original["allow_public_internet"])
|
||||
assert data["auto_create_system_projects"] == (not original["auto_create_system_projects"])
|
||||
|
||||
# Restore original settings
|
||||
integration_client.put(
|
||||
"/api/v1/admin/cache-settings",
|
||||
json={
|
||||
"allow_public_internet": original["allow_public_internet"],
|
||||
"auto_create_system_projects": original["auto_create_system_projects"],
|
||||
},
|
||||
)
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_update_cache_settings_allow_public_internet(self, integration_client):
|
||||
"""Test enabling and disabling public internet access (air-gap mode)."""
|
||||
# First get current settings to restore later
|
||||
original = integration_client.get("/api/v1/admin/cache-settings").json()
|
||||
|
||||
# Disable public internet (enable air-gap mode)
|
||||
response = integration_client.put(
|
||||
"/api/v1/admin/cache-settings",
|
||||
json={"allow_public_internet": False},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["allow_public_internet"] is False
|
||||
|
||||
# Enable public internet (disable air-gap mode)
|
||||
response = integration_client.put(
|
||||
"/api/v1/admin/cache-settings",
|
||||
json={"allow_public_internet": True},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["allow_public_internet"] is True
|
||||
|
||||
# Restore original settings
|
||||
integration_client.put(
|
||||
"/api/v1/admin/cache-settings",
|
||||
json={"allow_public_internet": original["allow_public_internet"]},
|
||||
)
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_update_cache_settings_partial(self, integration_client):
|
||||
"""Test that partial updates only change specified fields."""
|
||||
# Get current settings
|
||||
original = integration_client.get("/api/v1/admin/cache-settings").json()
|
||||
|
||||
# Update only allow_public_internet
|
||||
new_value = not original["allow_public_internet"]
|
||||
# Update only auto_create_system_projects
|
||||
new_value = not original["auto_create_system_projects"]
|
||||
response = integration_client.put(
|
||||
"/api/v1/admin/cache-settings",
|
||||
json={"allow_public_internet": new_value},
|
||||
json={"auto_create_system_projects": new_value},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
data = response.json()
|
||||
assert data["allow_public_internet"] == new_value
|
||||
# Other field should be unchanged
|
||||
assert data["auto_create_system_projects"] == original["auto_create_system_projects"]
|
||||
assert data["auto_create_system_projects"] == new_value
|
||||
|
||||
# Restore
|
||||
integration_client.put(
|
||||
"/api/v1/admin/cache-settings",
|
||||
json={"allow_public_internet": original["allow_public_internet"]},
|
||||
json={"auto_create_system_projects": original["auto_create_system_projects"]},
|
||||
)
|
||||
|
||||
@pytest.mark.integration
|
||||
@@ -1937,5 +1902,4 @@ class TestCacheSettingsEnvOverride:
|
||||
|
||||
data = response.json()
|
||||
# These fields should exist (may be null if no env override)
|
||||
assert "allow_public_internet_env_override" in data
|
||||
assert "auto_create_system_projects_env_override" in data
|
||||
|
||||
Reference in New Issue
Block a user