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

Enabled regex testing for content_match #1326

Conversation

chrissnell
Copy link
Contributor

Here's a quick change to Ryan's http_check.py revisions that enable regex testing for content_match. This makes content_match more flexible in accommodating situations where a simple if ... in ... match would be insufficient.

Consider this real-life example of content being tested:

{"status":"UP","rabbit":{"status":"UP"},"db":{"status":"UP","database":"MySQL","hello":1}}

If we want to test for that first "status":"UP", we need to use a regex because that string is not unique within the content string:

   content_match: '^\{"status":"UP"'

The one gotcha with regex in content_match is special metacharacters like "?". I considered creating a content_match_re for regex matching but decided that it would be cleaner to just document in the example YAML the need to escape these characters.

@remh remh added the 1 - Ready label Jan 30, 2015
@remh remh added this to the 5.3.0 milestone Jan 30, 2015
@remh
Copy link
Contributor

remh commented Jan 30, 2015

Thanks a bunch a @chrissnell !

Our master branch is currently frozen for the preparation of our 5.2.0 release.

We'll review your pull request for our 5.3.0 release.
Thanks again!

@yannmh
Copy link
Member

yannmh commented Feb 23, 2015

Thanks @chrissnell . I just rebased your PR on the last 5.2.1 agent release and opened a new PR #1390.

@yannmh yannmh closed this Feb 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants