Set reportFormat to lower before generating report#464
Set reportFormat to lower before generating report#464rishinair11 wants to merge 2 commits intokudobuilder:mainfrom
Conversation
8244b13 to
f3a757f
Compare
Fixes issue kudobuilder#449 When reportFormat in `kuttl-test.yaml` is specified in uppercase, it is passed as it is to report.Report func in harness.go. It needs to be passed as lowercase so that the `switch` compares against valid report format types (`ftype`) Also added unit tests List of tests added: - should_create_an_XML_report_when_format_is_XML - should_create_an_XML_report_when_format_is_xml - should_create_an_JSON_report_when_format_is_JSON - should_create_an_JSON_report_when_format_is_json - should_not_create_any_report_when_format_is_empty Signed-off-by: Rishikesh Nair <alienware505@gmail.com>
| } | ||
| if err := h.report.Report(h.TestSuite.ArtifactsDir, h.reportName(), report.Type(h.TestSuite.ReportFormat)); err != nil { | ||
|
|
||
| reportType := report.Type(strings.ToLower(h.TestSuite.ReportFormat)) |
There was a problem hiding this comment.
Instead of doing the change here, I think what should be modified is the reportType function from pkg/kuttlctl/cmd/test.go to store the report format in lower letters. That will help to not reproduce this problem in other places where pkg/kuttlctl/cmd/test.go is used.
There was a problem hiding this comment.
+1 agree with @iblancasa
as this has been awhile from PR to review (my fault)... if I don't see an update today... I will merge (for proper attribution) and modify consistent to iblancasa comments.
kensipe
left a comment
There was a problem hiding this comment.
nice work... I agree with iblancasa and looking for an update... if not, I will merge and mod. thanks again
| } | ||
| if err := h.report.Report(h.TestSuite.ArtifactsDir, h.reportName(), report.Type(h.TestSuite.ReportFormat)); err != nil { | ||
|
|
||
| reportType := report.Type(strings.ToLower(h.TestSuite.ReportFormat)) |
There was a problem hiding this comment.
+1 agree with @iblancasa
as this has been awhile from PR to review (my fault)... if I don't see an update today... I will merge (for proper attribution) and modify consistent to iblancasa comments.
Fixes #449
What this PR does / why we need it:
When
reportFormatinkuttl-test.yamlis specified in uppercase, it is passed unchanged toreport.Reportfunc inharness.go.It needs to be converted to lowercase so that the
switchcompares against valid report format types (ftype)This has been taken care of here already.
kuttl/pkg/kuttlctl/cmd/test.go
Line 177 in f6d64c9
Also added unit tests for the
report.Reportfunc to verify the behaviour.