keda: Templates name aren't clear in the output in the error log for the latest e2e testing.

Report

While doing negative testing on the latest migrated code for the e2e testing, the output for a test with erroneous template was this:

cannot apply file - error: error parsing /tmp/tempTemplateFile393652011: error converting YAML to JSON: yaml: line 31: could not find expected ':'

This proves to be confusing in case we have scalers with multiple templates.

Expected Behavior

The expected behavior was something like this:

cannot apply file - error: error parsing /tmp/deploymentTemplateFile393652011: error converting YAML to JSON: yaml: line 31: could not find expected ':'

or as mentioned by @JorTurFer it could also be printing the template itself in the error log.

Actual Behavior

The error log doesn’t provide clarity to which exact template file is causing error and the error is like this:

Error Trace:	helper.go:170
        	            				helper.go:178
        	            				helper.go:209
        	            				cpu_test.go:127
        	Error:      	Received unexpected error:
        	            	error: error parsing /tmp/tempTemplateFile1287392103: error converting YAML to JSON: yaml: line 31: could not find expected ':'

Steps to Reproduce the Problem

  1. make an error in templateFile.
  2. Run go test on the test file with : go test -v ./scalers_go/scalerName/scalerName_test.go
  3. find the error in output

Logs from KEDA operator

None

KEDA Version

2.7.1

Kubernetes Version

1.23

Platform

Any

Scaler Details

Any

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (19 by maintainers)

Most upvoted comments

BTW, are you willing to contribute with this?

hi @JorTurFer , i might have missed the comment here, sure I’d love to work on it. if @v-shenoy don’t mind? any suggestion is also appreciated of how we can improve this even more.

If you think that it’s the best approach, we can give a try. Maybe I’m overthinking and one extra parameters it’s not a problem at all, and in case of if it is, we can rethink this in the future.