-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(src/image/prepare_single_image_build_matrix.py): release identifi…
…cation
- Loading branch information
Showing
5 changed files
with
194 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
version: 1 | ||
|
||
release: | ||
latest: | ||
end-of-life: "2030-05-01T00:00:00Z" | ||
candidate: 1.2-22.04_beta | ||
test: | ||
end-of-life: "2030-05-01T00:00:00Z" | ||
beta: 1.1-22.04_beta | ||
|
||
upload: | ||
- source: "canonical/rocks-toolbox" | ||
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f | ||
directory: mock_rock/1.0 | ||
release: | ||
1.0-22.04: | ||
end-of-life: "2000-05-01T00:00:00Z" | ||
risks: | ||
- candidate | ||
- edge | ||
- beta | ||
- source: "canonical/rocks-toolbox" | ||
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f | ||
directory: mock_rock/1.1 | ||
release: | ||
1.1-22.04: | ||
end-of-life: "2000-05-01T00:00:00Z" | ||
risks: | ||
- candidate | ||
- edge | ||
- beta | ||
1-22.04: | ||
end-of-life: "2000-05-01T00:00:00Z" | ||
risks: | ||
- candidate | ||
- edge | ||
- beta | ||
- source: "canonical/rocks-toolbox" | ||
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f | ||
directory: mock_rock/1.2 | ||
release: | ||
1.2-22.04: | ||
end-of-life: "2000-05-01T00:00:00Z" | ||
risks: | ||
- beta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
version: 1 | ||
|
||
release: | ||
latest: | ||
end-of-life: "2030-05-01T00:00:00Z" | ||
candidate: 1.2-22.04_beta | ||
test: | ||
end-of-life: "2030-05-01T00:00:00Z" | ||
beta: 1.1-22.04_beta | ||
|
||
upload: | ||
- source: "canonical/rocks-toolbox" | ||
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f | ||
directory: mock_rock/1.0 | ||
release: | ||
1.0-22.04: | ||
end-of-life: "2024-05-01T00:00:00Z" | ||
risks: | ||
- candidate | ||
- edge | ||
- beta | ||
- source: "canonical/rocks-toolbox" | ||
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f | ||
directory: mock_rock/1.1 | ||
release: | ||
1.1-22.04: | ||
end-of-life: "2030-05-01T00:00:00Z" | ||
risks: | ||
- candidate | ||
- edge | ||
- beta | ||
1-22.04: | ||
end-of-life: "2030-05-01T00:00:00Z" | ||
risks: | ||
- candidate | ||
- edge | ||
- beta | ||
- source: "canonical/rocks-toolbox" | ||
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f | ||
directory: mock_rock/1.2 | ||
release: | ||
1.2-22.04: | ||
end-of-life: "2030-05-01T00:00:00Z" | ||
risks: | ||
- beta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
version: 1 | ||
|
||
upload: | ||
- source: "canonical/rocks-toolbox" | ||
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f | ||
directory: mock_rock/1.0 | ||
release: | ||
1.0-22.04: | ||
end-of-life: "2024-05-01T00:00:00Z" | ||
risks: | ||
- candidate | ||
- edge | ||
- beta | ||
- source: "canonical/rocks-toolbox" | ||
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f | ||
directory: mock_rock/1.1 | ||
release: | ||
1.1-22.04: | ||
end-of-life: "2030-05-01T00:00:00Z" | ||
risks: | ||
- candidate | ||
- edge | ||
- beta | ||
1-22.04: | ||
end-of-life: "2030-05-01T00:00:00Z" | ||
risks: | ||
- candidate | ||
- edge | ||
- beta | ||
- source: "canonical/rocks-toolbox" | ||
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f | ||
directory: mock_rock/1.2 | ||
release: | ||
1.2-22.04: | ||
end-of-life: "2030-05-01T00:00:00Z" | ||
risks: | ||
- beta |
66 changes: 66 additions & 0 deletions
66
tests/integration/test_prepare_single_image_build_matrix.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# from pathlib import Path | ||
# import pytest | ||
|
||
# from src.image.utils.schema.triggers import ImageTriggerValidationError | ||
# import yaml | ||
# from glob import glob | ||
from src.image.prepare_single_image_build_matrix import main as prepare_build_matrix | ||
import pytest | ||
import re | ||
import shutil | ||
import sys | ||
|
||
from .. import DATA_DIR | ||
|
||
|
||
@pytest.fixture | ||
def prep_execution(tmpdir, monkeypatch, request): | ||
|
||
image_trigger_sample = getattr(request, "param", None) | ||
|
||
# configure files/env requried for the test | ||
github_output = tmpdir / "github_output" | ||
monkeypatch.setenv("GITHUB_OUTPUT", str(github_output)) | ||
|
||
revision_data_dir = tmpdir / "revision-data" | ||
revision_data_dir.mkdir() | ||
|
||
oci_trigger_dir = tmpdir / "image_trigger" | ||
oci_trigger_dir.mkdir() | ||
shutil.copy( | ||
image_trigger_sample, | ||
oci_trigger_dir / "image.yaml", | ||
) | ||
|
||
# patch the arv for the test. script.py can be anything | ||
args = ( | ||
f"--oci-path {oci_trigger_dir} --revision-data-dir {revision_data_dir}".split( | ||
" " | ||
) | ||
) | ||
monkeypatch.setattr(sys, "argv", ["script.py"] + args) | ||
|
||
return revision_data_dir, github_output | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"prep_execution, release_to", | ||
[ | ||
(DATA_DIR / "image_with_release.yaml", True), | ||
(DATA_DIR / "image_without_release.yaml", True), | ||
(DATA_DIR / "image_all_eol_tracks.yaml", False), | ||
], | ||
indirect=["prep_execution"], | ||
) | ||
def test_release_to(prep_execution, release_to): | ||
"""Test state of release-to in github output after running prepare_single_image_build_matrix""" | ||
_, github_output = prep_execution | ||
|
||
# run main from prepare_single_image_build_matrix | ||
prepare_build_matrix() | ||
|
||
github_output_content = github_output.read_text("utf8") | ||
print(github_output_content) | ||
assert re.search( | ||
"^release-to=" + "true" if release_to else "", github_output_content, re.M | ||
), "Invalid release-to value" |