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

[plugin-mailq] mailq/postfix: Fix mail queue count regexp capture when it's 1 #1186

Merged
merged 4 commits into from
May 28, 2024

Conversation

yongjiajun
Copy link
Contributor

@yongjiajun yongjiajun commented May 17, 2024

Fixes #1185

This PR fixes the mail queue count regexp capture for Postfix when there's only 1 item in the mail queue.

Note/Update: The tests in the package modified are passing as I've tested them locally.

@yongjiajun yongjiajun marked this pull request as ready for review May 17, 2024 08:14
Copy link
Member

@lufia lufia left a comment

Choose a reason for hiding this comment

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

@yongjiajun Thank you, I think almost ok but please kindly confirm my suggestion

mackerel-plugin-mailq/lib/fixtures/postqueue Outdated Show resolved Hide resolved
{mailqCount: 0},
{mailqCount: 1}, // #1185
} {
os.Setenv("TEST_MAILQ_COUNT", strconv.Itoa(tc.mailqCount))
Copy link
Member

Choose a reason for hiding this comment

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

[note] In general, Go 1.17 or higher, it would be better to use testing.T.Setenv.

But to keep consistency this use os.Setenv here intentionally because all test cases other than that still use os.Getenv.

Co-authored-by: KADOTA, Kyohei <lufia@users.noreply.github.com>
@yongjiajun yongjiajun requested a review from lufia May 28, 2024 02:35
Copy link
Member

@lufia lufia left a comment

Choose a reason for hiding this comment

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

We will release in a few days.

@lufia lufia merged commit be5e21a into mackerelio:master May 28, 2024
13 checks passed
@yongjiajun yongjiajun deleted the mailq-plugin-postqueue-regex-fix branch May 28, 2024 02:45
@yongjiajun
Copy link
Contributor Author

@lufia Thank you!

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.

[plugin-mailq/postfix] bug: Mail queue count 1 reflected as 0 instead
2 participants