Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/src/submission/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def register_chart_info(
(self.category and self.category != category)
or (self.organization and self.organization != organization)
or (self.name and self.name != name)
or (self.version and self.version != version)
or (self.version and version and self.version != version)
):
msg = "[ERROR] A PR must contain only one chart. Current PR includes files for multiple charts."
raise DuplicateChartError(msg)
Expand Down
48 changes: 48 additions & 0 deletions scripts/src/submission/submission_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,33 @@ class SubmissionInitScenario:
],
),
),
# PR contains a report and an OWNERS file
# While this is an invalid PR, there shouldn't be any error during the initalization of the Submission object.
# This specific error is handled in the is_valid_certification_submission test.
# See https://github.com/openshift-helm-charts/development/issues/477 for context
SubmissionInitScenario(
api_url="https://api.github.com/repos/openshift-helm-charts/charts/pulls/6",
modified_files=[
f"charts/{expected_category}/{expected_organization}/{expected_name}/{expected_version}/report.yaml",
f"charts/{expected_category}/{expected_organization}/{expected_name}/OWNERS",
],
expected_submission=submission.Submission(
api_url="https://api.github.com/repos/openshift-helm-charts/charts/pulls/6",
chart=expected_chart,
modified_files=[
f"charts/{expected_category}/{expected_organization}/{expected_name}/{expected_version}/report.yaml",
f"charts/{expected_category}/{expected_organization}/{expected_name}/OWNERS",
],
report=submission.Report(
found=True,
signed=False,
path=f"charts/{expected_category}/{expected_organization}/{expected_name}/{expected_version}/report.yaml",
),
modified_owners=[
f"charts/{expected_category}/{expected_organization}/{expected_name}/OWNERS"
],
),
),
# PR contains additional files, not fitting into any expected category
SubmissionInitScenario(
api_url="https://api.github.com/repos/openshift-helm-charts/charts/pulls/7",
Expand Down Expand Up @@ -474,6 +501,27 @@ class CertificationScenario:
expected_is_valid_certification=False,
expected_reason="[ERROR] Send OWNERS file by itself in a separate PR.",
),
# Invalid certification Submission contains OWNERS file and report file
CertificationScenario(
input_submission=submission.Submission(
api_url="https://api.github.com/repos/openshift-helm-charts/charts/pulls/1",
chart=expected_chart,
modified_files=[
f"charts/{expected_category}/{expected_organization}/{expected_name}/{expected_version}/report.yaml",
f"charts/{expected_category}/{expected_organization}/{expected_name}/OWNERS",
],
report=submission.Report(
found=True,
signed=False,
path=f"charts/{expected_category}/{expected_organization}/{expected_name}/{expected_version}/report.yaml",
),
modified_owners=[
f"charts/{expected_category}/{expected_organization}/{expected_name}/OWNERS"
],
),
expected_is_valid_certification=False,
expected_reason="[ERROR] Send OWNERS file by itself in a separate PR.",
),
# Valid certification Submission contains OWNERS and report file, but ignore_owners is set to True
CertificationScenario(
input_submission=submission.Submission(
Expand Down