@@ -47,12 +47,48 @@ def test_release_notes_changes_section_broken_glvd_response():
4747 "Expected a placeholder message to be generated if GVLD response is not valid"
4848
4949
50- def test_release_notes_compare_package_versions_section_semver_is_not_recognized ():
51- assert release_notes_compare_package_versions_section ("1.2.0" , []) == "" , "Semver is not supported"
50+ def test_release_notes_compare_package_versions_section_legacy_versioning_is_recognized ():
51+ assert "Full List of Packages in Garden Linux version 1.0" in \
52+ release_notes_compare_package_versions_section ("1.0" , {}), "Legacy versioning is supported"
5253
5354
54- def test_release_notes_compare_package_versions_section_unrecognizable_version ():
55- assert release_notes_compare_package_versions_section ("garden.linux" , []) == ""
55+ def test_release_notes_compare_package_versions_section_legacy_versioning_patch_release_is_recognized (monkeypatch ):
56+ def mock_compare_apt_repo_versions (previous_version , current_version ):
57+ output = f"| Package | { previous_version } | { current_version } |\n "
58+ output += "|---------|--------------------|-------------------|\n "
59+ output += "|containerd|1.0|1.1|\n "
60+ return output
61+
62+ monkeypatch .setattr ("gardenlinux.github.release_notes.sections.compare_apt_repo_versions" ,
63+ mock_compare_apt_repo_versions )
64+
65+ assert "|containerd|1.0|1.1|" in \
66+ release_notes_compare_package_versions_section ("1.1" , {}), "Legacy versioning patch releases are supported"
67+
68+
69+ def test_release_notes_compare_package_versions_section_semver_is_recognized ():
70+ assert "Full List of Packages in Garden Linux version 1.20.0" in \
71+ release_notes_compare_package_versions_section ("1.20.0" , {}), "Semver is supported"
72+
73+
74+ def test_release_notes_compare_package_versions_section_semver_patch_release_is_recognized (monkeypatch ):
75+ def mock_compare_apt_repo_versions (previous_version , current_version ):
76+ output = f"| Package | { previous_version } | { current_version } |\n "
77+ output += "|---------|--------------------|-------------------|\n "
78+ output += "|containerd|1.0|1.1|\n "
79+ return output
80+
81+ monkeypatch .setattr ("gardenlinux.github.release_notes.sections.compare_apt_repo_versions" ,
82+ mock_compare_apt_repo_versions )
83+
84+ assert "|containerd|1.0|1.1|" in \
85+ release_notes_compare_package_versions_section ("1.20.1" , {}), "Semver patch releases are supported"
86+
87+
88+ def test_release_notes_compare_package_versions_section_unrecognizable_version (caplog ):
89+ assert release_notes_compare_package_versions_section ("garden.linux" , {}) is None
90+ assert any ("Unexpected version number format garden.linux" in
91+ record .message for record in caplog .records ), "Expected an error log message"
5692
5793
5894@pytest .mark .parametrize ("flavor" , TEST_FLAVORS )
0 commit comments