Skip to content

Commit

Permalink
Backport: fix upgrade script for 1.17 (#3825)
Browse files Browse the repository at this point in the history
  • Loading branch information
Donnype authored Nov 19, 2024
1 parent 0f63720 commit 838c80e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion boefjes/tests/integration/test_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from pathlib import Path

import pytest
from tools.upgrade_v1_16_0 import upgrade
from tools.upgrade_v1_17_0 import upgrade

from boefjes.clients.bytes_client import BytesAPIClient
from boefjes.config import BASE_DIR
from boefjes.models import Organisation
from boefjes.sql.organisation_storage import SQLOrganisationStorage
from octopoes.connector.octopoes import OctopoesAPIConnector
from octopoes.models import Reference
Expand All @@ -25,6 +26,9 @@ def test_migration(
octopoes_api_connector.session._timeout.connect = 60
octopoes_api_connector.session._timeout.read = 60

# Create an organisation that does not exist in Octopoes
organisation_repository.create(Organisation(id="test2", name="Test 2"))

iterations = 30
cache_path = Path(BASE_DIR.parent / ".ci" / f".cache_{iterations}.json")
hostname_range = range(0, iterations)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ def migrate_organisation(
and set the source_method to the boefje id. Then update the origin, i.e. save it and delete the old one.
"""

try:
connector.health()
except HTTPStatusError as e:
if e.response.status_code == 404:
logger.warning(
"Organisation found that does not exist in Octopoes [organisation_id=%s]. Make sure to remove this "
"organisation from the Katalogus database if it is no longer in use.",
organisation_id,
)
raise

failed = 0
processed = 0

Expand Down

0 comments on commit 838c80e

Please sign in to comment.