Skip to content

Commit b22f349

Browse files
committed
working GL release notes integration test
1 parent f789749 commit b22f349

File tree

6 files changed

+241
-11
lines changed

6 files changed

+241
-11
lines changed

poetry.lock

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pytest = "^8.4.1"
2929
pytest-cov = "^6.3.0"
3030
isort = "^6.0.1"
3131
ptpython = "^3.0.31"
32+
requests-mock = "^1.12.1"
3233

3334
[tool.poetry.group.docs.dependencies]
3435
sphinx-rtd-theme = "^3.0.2"

src/gardenlinux/github/__main__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,10 @@ def release_notes_changes_section(gardenlinux_version):
582582
output.append(f" - {fixedCve}")
583583

584584
return "\n".join(output) + "\n\n"
585-
except:
585+
except Exception as exn:
586586
# There are expected error cases, for example with versions not supported by glvd (1443.x) or when the api is not available
587587
# Fail gracefully by adding the placeholder we previously used, so that the release note generation does not fail.
588+
LOGGER.error(f"Failed to process GLVD API output: {exn}")
588589
return textwrap.dedent(
589590
"""
590591
## Changes
@@ -693,7 +694,7 @@ def create_github_release_notes(gardenlinux_version, commitish):
693694
output += generate_release_note_image_ids(metadata_files)
694695

695696
output += "\n"
696-
output += "## Kernel Module Build Container (kmodbuild) "
697+
output += "## Kernel Module Build Container (kmodbuild)"
697698
output += "\n"
698699
output += "```"
699700
output += "\n"
File renamed without changes.
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
{
2+
"version": "1877.3",
3+
"packageList": [
4+
{
5+
"sourcePackageName": "gnutls28",
6+
"oldVersion": "3.8.9-2",
7+
"newVersion": "3.8.9-3gl0+bp1877",
8+
"fixedCves": [
9+
"CVE-2025-32988",
10+
"CVE-2025-32989",
11+
"CVE-2025-32990",
12+
"CVE-2025-6395"
13+
]
14+
},
15+
{
16+
"sourcePackageName": "sqlite3",
17+
"oldVersion": "3.46.1-4",
18+
"newVersion": "3.46.1-7gl0+bp1877",
19+
"fixedCves": [
20+
"CVE-2025-6965"
21+
]
22+
},
23+
{
24+
"sourcePackageName": "dpkg",
25+
"oldVersion": "1.22.18",
26+
"newVersion": "1.22.21gl0+bp1877",
27+
"fixedCves": [
28+
"CVE-2025-6297"
29+
]
30+
},
31+
{
32+
"sourcePackageName": "linux",
33+
"oldVersion": "6.12.40-2gl0",
34+
"newVersion": "6.12.44-3gl0",
35+
"fixedCves": [
36+
"CVE-2025-38676",
37+
"CVE-2025-38683",
38+
"CVE-2025-38684",
39+
"CVE-2025-38686",
40+
"CVE-2025-38687",
41+
"CVE-2025-38688",
42+
"CVE-2025-38691",
43+
"CVE-2025-38692",
44+
"CVE-2025-38695",
45+
"CVE-2025-38696",
46+
"CVE-2025-38699",
47+
"CVE-2025-38700",
48+
"CVE-2025-38701",
49+
"CVE-2025-38704",
50+
"CVE-2025-38708",
51+
"CVE-2025-38709",
52+
"CVE-2025-38710",
53+
"CVE-2025-38711",
54+
"CVE-2025-38717",
55+
"CVE-2025-38718",
56+
"CVE-2025-38721",
57+
"CVE-2025-38722",
58+
"CVE-2025-38724",
59+
"CVE-2025-38726",
60+
"CVE-2025-38727",
61+
"CVE-2025-38728",
62+
"CVE-2025-38730",
63+
"CVE-2025-38601",
64+
"CVE-2025-38604",
65+
"CVE-2025-38608",
66+
"CVE-2025-38609",
67+
"CVE-2025-38610",
68+
"CVE-2025-38614",
69+
"CVE-2022-50031",
70+
"CVE-2022-50083",
71+
"CVE-2023-53137",
72+
"CVE-2025-37744",
73+
"CVE-2025-38500",
74+
"CVE-2025-38501",
75+
"CVE-2025-38732",
76+
"CVE-2025-38734",
77+
"CVE-2025-38735",
78+
"CVE-2025-38737",
79+
"CVE-2025-39673",
80+
"CVE-2025-39676",
81+
"CVE-2025-39681",
82+
"CVE-2025-39682",
83+
"CVE-2025-39683",
84+
"CVE-2025-39684",
85+
"CVE-2025-39685",
86+
"CVE-2025-39686",
87+
"CVE-2025-39689",
88+
"CVE-2025-39691",
89+
"CVE-2025-39692",
90+
"CVE-2025-39695",
91+
"CVE-2025-39697",
92+
"CVE-2025-39698",
93+
"CVE-2025-39700",
94+
"CVE-2025-39701",
95+
"CVE-2025-39702",
96+
"CVE-2025-39703",
97+
"CVE-2025-39718",
98+
"CVE-2025-39720",
99+
"CVE-2025-39721",
100+
"CVE-2025-39722",
101+
"CVE-2025-39724",
102+
"CVE-2025-39727",
103+
"CVE-2025-39730",
104+
"CVE-2025-39732",
105+
"CVE-2025-21884",
106+
"CVE-2025-38335",
107+
"CVE-2025-38351",
108+
"CVE-2025-38553",
109+
"CVE-2025-38559",
110+
"CVE-2025-38560",
111+
"CVE-2025-38561",
112+
"CVE-2025-38562",
113+
"CVE-2025-38563",
114+
"CVE-2025-38565",
115+
"CVE-2025-38566",
116+
"CVE-2025-38568",
117+
"CVE-2025-38569",
118+
"CVE-2025-38571",
119+
"CVE-2025-38572",
120+
"CVE-2025-38574",
121+
"CVE-2025-38581",
122+
"CVE-2025-38582",
123+
"CVE-2025-38583",
124+
"CVE-2025-38586",
125+
"CVE-2025-38587",
126+
"CVE-2025-38588",
127+
"CVE-2025-38590",
128+
"CVE-2025-38593",
129+
"CVE-2025-38616",
130+
"CVE-2025-38617",
131+
"CVE-2025-38618",
132+
"CVE-2025-38622",
133+
"CVE-2025-38624",
134+
"CVE-2025-38625",
135+
"CVE-2025-38628",
136+
"CVE-2025-38631",
137+
"CVE-2025-38632",
138+
"CVE-2025-38634",
139+
"CVE-2025-38635",
140+
"CVE-2025-38639",
141+
"CVE-2025-38640",
142+
"CVE-2025-38644",
143+
"CVE-2025-38645",
144+
"CVE-2025-38646",
145+
"CVE-2025-38653",
146+
"CVE-2025-38659",
147+
"CVE-2025-38660",
148+
"CVE-2025-38666",
149+
"CVE-2025-38668",
150+
"CVE-2025-38670",
151+
"CVE-2025-38675",
152+
"CVE-2025-39736",
153+
"CVE-2025-39737",
154+
"CVE-2025-39738",
155+
"CVE-2025-39739",
156+
"CVE-2025-39742",
157+
"CVE-2025-39744",
158+
"CVE-2025-39746",
159+
"CVE-2025-39748",
160+
"CVE-2025-39749",
161+
"CVE-2025-39750",
162+
"CVE-2025-39752",
163+
"CVE-2025-39753",
164+
"CVE-2025-39754",
165+
"CVE-2025-39756",
166+
"CVE-2025-39758",
167+
"CVE-2025-39759",
168+
"CVE-2025-39761",
169+
"CVE-2025-39763",
170+
"CVE-2025-39766",
171+
"CVE-2025-39770",
172+
"CVE-2025-39773",
173+
"CVE-2025-39776",
174+
"CVE-2025-39779",
175+
"CVE-2025-39780",
176+
"CVE-2025-39782",
177+
"CVE-2025-39783",
178+
"CVE-2025-39787",
179+
"CVE-2025-39788",
180+
"CVE-2025-39790",
181+
"CVE-2025-39791"
182+
]
183+
},
184+
{
185+
"sourcePackageName": "iputils",
186+
"oldVersion": "3:20240905-3",
187+
"newVersion": "3:20250605-1gl0~bp1877",
188+
"fixedCves": [
189+
"CVE-2025-47268"
190+
]
191+
}
192+
]
193+
}

tests/github/test_release_page.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33
from pathlib import Path
44

55
import git
6+
import requests_mock
67
from git import Repo
78

9+
GARDENLINUX_RELEASE = "1877.3"
10+
GARDENLINUX_COMMIT = "75df9f401a842914563f312899ec3ce34b24515c"
11+
GLVD_BASE_URL = "https://glvd.ingress.glvd.gardnlinux.shoot.canary.k8s-hana.ondemand.com/v1"
12+
13+
TEST_DATA_DIR = Path(os.path.dirname(__file__)) / ".." / ".." / "test-data" / "release_notes"
14+
815

916
class SubmoduleAsRepo(Repo):
1017
"""This will fake a git submodule as a git repository object."""
@@ -28,11 +35,21 @@ def test_github_release_page(monkeypatch):
2835
import gardenlinux.github
2936
importlib.reload(gardenlinux.github)
3037

31-
generated_release_notes = gardenlinux.github.create_github_release_notes(
32-
"1877.3",
33-
"75df9f401a842914563f312899ec3ce34b24515c"
34-
)
35-
fixture_path = Path(os.path.dirname(__file__)) / ".." / ".." / "test-data" / "github_release_notes_1877.3.md"
36-
with open(fixture_path) as md:
37-
release_notes_fixture = md.read()
38-
assert generated_release_notes == release_notes_fixture
38+
release_fixture_path = TEST_DATA_DIR / f"github_release_notes_{GARDENLINUX_RELEASE}.md"
39+
glvd_response_fixture_path = TEST_DATA_DIR / f"glvd_{GARDENLINUX_RELEASE}.json"
40+
41+
with requests_mock.Mocker(real_http=True) as m:
42+
with open(glvd_response_fixture_path) as resp_json:
43+
m.get(
44+
f"{GLVD_BASE_URL}/patchReleaseNotes/{GARDENLINUX_RELEASE}",
45+
text=resp_json.read(),
46+
status_code=200
47+
)
48+
generated_release_notes = gardenlinux.github.create_github_release_notes(
49+
GARDENLINUX_RELEASE,
50+
GARDENLINUX_COMMIT
51+
)
52+
53+
with open(release_fixture_path) as md:
54+
release_notes_fixture = md.read()
55+
assert f"x{generated_release_notes}" == f"x{release_notes_fixture}"

0 commit comments

Comments
 (0)