Skip to content

Commit d01812b

Browse files
committed
fix: propagate FindRenames to Report and update tests
Pass FindRenames from Options to Report so that printDyffReport can use it to conditionally enable dyff.DetectRenames. Update test name and add FindRenames field to test reports for consistency. Signed-off-by: yxxhero <aiopsclub@163.com>
1 parent 17b3630 commit d01812b

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

diff/diff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func ManifestReport(oldIndex, newIndex map[string]*manifest.MappingResult, optio
6565
}
6666

6767
func generateReport(oldIndex, newIndex map[string]*manifest.MappingResult, newOwnedReleases map[string]OwnershipDiff, options *Options) (bool, *Report, error) {
68-
report := Report{}
68+
report := Report{FindRenames: options.FindRenames}
6969
report.setupReportFormat(options.OutputFormat)
7070
var possiblyRemoved []string
7171

diff/report_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ func TestPrintDyffReportWithAddAndRemove(t *testing.T) {
104104
require.Contains(t, output, "new-app", "Expected dyff output to show added resource new-app")
105105
}
106106

107-
func TestPrintDyffReportDoesNotMergeAddRemove(t *testing.T) {
107+
func TestPrintDyffReportDoesNotMergeAddRemoveWithFindRenames(t *testing.T) {
108108
addRemoveReport := &Report{
109+
FindRenames: 1.0,
109110
Entries: []ReportEntry{
110111
{
111112
Key: "default, old-app, Deployment (apps)",
@@ -133,6 +134,7 @@ func TestPrintDyffReportDoesNotMergeAddRemove(t *testing.T) {
133134
}
134135

135136
modifyReport := &Report{
137+
FindRenames: 1.0,
136138
Entries: []ReportEntry{
137139
{
138140
Key: "default, app, Deployment (apps)",

0 commit comments

Comments
 (0)