From f3de088c5245834eb28a59238a49d22cf6cfa5e5 Mon Sep 17 00:00:00 2001 From: Dariusz Duda Date: Tue, 10 Dec 2024 18:13:16 -0500 Subject: [PATCH 1/2] chore: use artifact in fetch-service context Signed-off-by: Dariusz Duda --- craft_application/models/manifest.py | 2 +- tests/data/manifest/session-report.json | 8 ++++---- tests/integration/services/test_fetch.py | 16 ++++++++-------- tests/unit/models/test_manifest.py | 2 +- tests/unit/services/test_fetch.py | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/craft_application/models/manifest.py b/craft_application/models/manifest.py index 5aa01bfa..a0680e1a 100644 --- a/craft_application/models/manifest.py +++ b/craft_application/models/manifest.py @@ -120,7 +120,7 @@ def from_session_report(cls, report: dict[str, Any]) -> list[Self]: """Create session manifests from a fetch-session report.""" artifacts: list[Self] = [] - for artifact in report["artefacts"]: + for artifact in report["artifacts"]: # Figure out if the artifact was rejected, and for which reasons rejected = artifact.get("result") == "Rejected" reasons: set[str] = set() diff --git a/tests/data/manifest/session-report.json b/tests/data/manifest/session-report.json index bd559f1c..8130fc1a 100644 --- a/tests/data/manifest/session-report.json +++ b/tests/data/manifest/session-report.json @@ -3,7 +3,7 @@ "comment": "Metadata format is unstable and may change without prior notice.", "session-id": "f17e28e952c84d7c955a1eb5277de201", "policy": "", - "artefacts": [ + "artifacts": [ { "metadata": { "type": "application/x.apt.translation", @@ -65,7 +65,7 @@ }, { "A NON-SHALLOW GIT CLONE": true, - "artefact-metadata-version": "0.1", + "artifact-metadata-version": "0.1", "request-inspection": { "git.upload-pack": { "opinion": "Rejected", @@ -107,7 +107,7 @@ }, { "A GO BUILD WITHOUT GOPROXY=DIRECT": true, - "artefact-metadata-version": "0.1", + "artifact-metadata-version": "0.1", "request-inspection": { "default": { "opinion": "Unknown", @@ -117,7 +117,7 @@ "response-inspection": { "default": { "opinion": "Unknown", - "reason": "the artefact format is unknown" + "reason": "the artifact format is unknown" } }, "result": "Rejected", diff --git a/tests/integration/services/test_fetch.py b/tests/integration/services/test_fetch.py index 92b2028f..227ea8c2 100644 --- a/tests/integration/services/test_fetch.py +++ b/tests/integration/services/test_fetch.py @@ -167,7 +167,7 @@ def test_create_teardown_session( report = app_service.teardown_session() assert len(fetch.get_service_status()["active-sessions"]) == 0 - assert "artefacts" in report + assert "artifacts" in report def test_service_logging(app_service, mocker, tmp_path, monkeypatch, mock_instance): @@ -315,19 +315,19 @@ def test_build_instance_integration( finally: report = app_service.teardown_session() - artefacts_and_types: list[tuple[str, str]] = [] + artifacts_and_types: list[tuple[str, str]] = [] - for artefact in report["artefacts"]: - metadata_name = artefact["metadata"]["name"] - metadata_type = artefact["metadata"]["type"] + for artifact in report["artifacts"]: + metadata_name = artifact["metadata"]["name"] + metadata_type = artifact["metadata"]["type"] - artefacts_and_types.append((metadata_name, metadata_type)) + artifacts_and_types.append((metadata_name, metadata_type)) # Check that the installation of the "hello" deb went through the inspector. - assert ("hello", "application/vnd.debian.binary-package") in artefacts_and_types + assert ("hello", "application/vnd.debian.binary-package") in artifacts_and_types # Check that the fetching of the "craft-application" wheel went through the inspector. - assert ("craft-application", "application/x.python.wheel") in artefacts_and_types + assert ("craft-application", "application/x.python.wheel") in artifacts_and_types manifest_path = tmp_path / f"{fake_project.name}_{fake_project.version}_foo.json" assert manifest_path.is_file() diff --git a/tests/unit/models/test_manifest.py b/tests/unit/models/test_manifest.py index eed4c2b5..eafab003 100644 --- a/tests/unit/models/test_manifest.py +++ b/tests/unit/models/test_manifest.py @@ -94,6 +94,6 @@ def test_session_report_rejections(session_report): "git repository does not contain a go.mod file", ] assert rejected[1].rejection_reasons == [ - "the artefact format is unknown", + "the artifact format is unknown", "the request was not recognized by any format inspector", ] diff --git a/tests/unit/services/test_fetch.py b/tests/unit/services/test_fetch.py index 9e9ee727..c1218305 100644 --- a/tests/unit/services/test_fetch.py +++ b/tests/unit/services/test_fetch.py @@ -160,7 +160,7 @@ def temporarily_pull_file(*, source, missing_ok): - git repository does not contain a go.mod file - url: https://proxy.golang.org:443/github.com/go-mmap/mmap/@v/v0.7.0.mod reasons: - - the artefact format is unknown + - the artifact format is unknown - the request was not recognized by any format inspector This build will fail on 'strict' fetch-service sessions. """ From 63e739b9b1c23a7ebbe472a97d2026a7b335cb93 Mon Sep 17 00:00:00 2001 From: Dariusz Duda Date: Wed, 11 Dec 2024 13:52:03 -0500 Subject: [PATCH 2/2] [REMOVE-ME]: use edge fs Signed-off-by: Dariusz Duda --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index dabdad2a..d1158587 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -111,7 +111,7 @@ jobs: run: | echo "::group::Begin snap install" echo "Installing snaps in the background while running apt and pip..." - sudo snap install --no-wait --channel=candidate fetch-service + sudo snap install --no-wait --channel=edge fetch-service echo "::endgroup::" echo "::group::apt-get" sudo apt update