Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty check name template was causing an error #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SudhanshuBawane
Copy link

closed #43

Description

  • Fix for the issue of sensu-check-log runtime error.

Changed

  • The check name was getting passed as empty now it is fixed.

Signed-off-by: SudhanshuBawane <sudhanshu.bawane.ctr@sumologic.com>
var err error
if len(checkNameTemplate) > 0 {
checkName, err = templates.EvalTemplate("check-name", checkNameTemplate, inputEvent)
}
if err != nil {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the error check can be moved inside the if block as the error will always be null if we don't call EvalTemplate.

expectedCheckName: "", // Template evaluation should fail
expectedError: true,
},
// ... add more test cases with different scenarios
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want more test here? One I can think of is with an empty ``checkNameTemplate`.

@fguimond fguimond changed the title to_be_reviewed Empty check name template was causing an error Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Whenever we run this check, it throws error: creating event
2 participants