Repository: canonical/snapcraft (language: python)

Issue:
Component types `kernel-modules` and `standard` are not supported
### What needs to get done

Component types `kernel-modules` and `standard` need to be supported by snapcraft.

### Why it needs to get done

It is a snapd feature that needs to be supported.


Discussion / hints:

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3520.

> This message was autogenerated

Please also add `standard` as a valid type, we just got a +1 on this one.

Fix patch:
diff --git a/snapcraft/models/project.py b/snapcraft/models/project.py
index 507a1161cd..10c571ab35 100644
--- a/snapcraft/models/project.py
+++ b/snapcraft/models/project.py
@@ -572,7 +572,7 @@ class Component(models.CraftBaseModel):
 
     summary: SummaryStr
     description: str
-    type: Literal["test"]
+    type: Literal["test", "kernel-modules", "standard"]
     version: VersionStr | None = None
     hooks: dict[str, Hook] | None = None
 


Test patch:
diff --git a/tests/unit/models/test_projects.py b/tests/unit/models/test_projects.py
index 99ccc4c4ee..eb782b95f8 100644
--- a/tests/unit/models/test_projects.py
+++ b/tests/unit/models/test_projects.py
@@ -2600,16 +2600,17 @@ def test_components_valid(self, project, project_yaml_data, stub_component_data)
 
         assert test_project.components == components
 
+    @pytest.mark.parametrize("component_type", ["test", "kernel-modules", "standard"])
     def test_component_type_valid(
-        self, project, project_yaml_data, stub_component_data
+        self, component_type, project, project_yaml_data, stub_component_data
     ):
         component = {"foo": stub_component_data}
-        component["foo"]["type"] = "test"
+        component["foo"]["type"] = component_type
 
         test_project = project.unmarshal(project_yaml_data(components=component))
 
         assert test_project.components
-        assert test_project.components["foo"].type == "test"
+        assert test_project.components["foo"].type == component_type
 
     def test_component_type_invalid(
         self, project, project_yaml_data, stub_component_data