@@ -302,3 +302,49 @@ def test_upload_directory_with_requirements_override(s3_setup: S3Env) -> None:
302302 metadata = yaml .safe_load (meta_obj .get ()["Body" ].read ())
303303 assert metadata ["require_uefi" ] is False
304304 assert metadata ["secureboot" ] is True
305+
306+
307+ def test_upload_directory_with_publishing_group (s3_setup : S3Env ) -> None :
308+ """A publishing_group value in the .requirements file is copied into the metadata."""
309+ # Arrange
310+ env = s3_setup
311+ (env .tmp_path / f"{ env .cname } .release" ).write_text (RELEASE_DATA )
312+ (env .tmp_path / f"{ env .cname } .requirements" ).write_text (
313+ "arch = amd64\n publishing_group = container\n "
314+ )
315+ (env .tmp_path / f"{ env .cname } -artifact" ).write_bytes (b"abc" )
316+
317+ # Act
318+ artifacts = S3Artifacts (env .bucket_name )
319+ artifacts .upload_from_directory (env .cname , env .tmp_path )
320+
321+ # Assert
322+ bucket = env .s3 .Bucket (env .bucket_name )
323+ meta_obj = next (
324+ o for o in bucket .objects .all () if o .key == f"meta/singles/{ env .cname } "
325+ )
326+ metadata = yaml .safe_load (meta_obj .get ()["Body" ].read ())
327+ assert metadata ["publishing_group" ] == "container"
328+
329+
330+ def test_upload_directory_without_publishing_group (s3_setup : S3Env ) -> None :
331+ """An empty or absent publishing_group is not emitted, marking a standalone build."""
332+ # Arrange
333+ env = s3_setup
334+ (env .tmp_path / f"{ env .cname } .release" ).write_text (RELEASE_DATA )
335+ (env .tmp_path / f"{ env .cname } .requirements" ).write_text (
336+ "arch = amd64\n publishing_group = \n "
337+ )
338+ (env .tmp_path / f"{ env .cname } -artifact" ).write_bytes (b"abc" )
339+
340+ # Act
341+ artifacts = S3Artifacts (env .bucket_name )
342+ artifacts .upload_from_directory (env .cname , env .tmp_path )
343+
344+ # Assert
345+ bucket = env .s3 .Bucket (env .bucket_name )
346+ meta_obj = next (
347+ o for o in bucket .objects .all () if o .key == f"meta/singles/{ env .cname } "
348+ )
349+ metadata = yaml .safe_load (meta_obj .get ()["Body" ].read ())
350+ assert "publishing_group" not in metadata
0 commit comments