diff --git a/commodore/component-template/{{ cookiecutter.slug }}/renovate.json b/commodore/component-template/{{ cookiecutter.slug }}/renovate.json index b6651c3c7..5c834798a 100644 --- a/commodore/component-template/{{ cookiecutter.slug }}/renovate.json +++ b/commodore/component-template/{{ cookiecutter.slug }}/renovate.json @@ -4,6 +4,20 @@ ":gitSignOff", ":disableDependencyDashboard" ], +{%- if cookiecutter.add_golden == "y" %} + "postUpgradeTasks": { + "commands": [ +{%- if cookiecutter.add_matrix == "y" %} + "make gen-golden -e instance=defaults" +{%- else %} + "make gen-golden" +{%- endif %} + ], + "fileFilters": [ "tests/golden/**" ], + "executionMode": "update" + }, + "suppressNotifications": [ "artifactErrors" ], +{%- endif %} "labels": [ "dependency" ] diff --git a/tests/test_component_template.py b/tests/test_component_template.py index 76585a37d..38b368cff 100644 --- a/tests/test_component_template.py +++ b/tests/test_component_template.py @@ -1,6 +1,7 @@ """ Tests for component new command """ +import json import os import pytest import yaml @@ -140,6 +141,20 @@ def test_run_component_new_command( else: assert run_step["run"] == "make golden-diff" + with open( + tmp_path / "dependencies" / component_name / "renovate.json" + ) as renovatejson: + renovateconfig = json.load(renovatejson) + assert ("postUpgradeTasks" in renovateconfig) == has_golden + if has_golden: + assert len(renovateconfig["postUpgradeTasks"]["commands"]) == 1 + cmd = renovateconfig["postUpgradeTasks"]["commands"][0] + expected_cmd = { + "--matrix-tests": "make gen-golden -e instance=defaults", + "--no-matrix-tests": "make gen-golden", + } + assert cmd == expected_cmd[matrix] + def test_run_component_new_command_with_name(tmp_path: P): """