GitHub user aledsage opened a pull request:

    https://github.com/apache/brooklyn-server/pull/589

    yaml-test assertions: fix use of “matches”

    Previously `matches: <regex>` would not work well for multi-line.
    
    For example, if using something like:
    ```
    type: TestSshCommand
    brooklyn.config:
      assert.out:
      - matches: ".*foo.*"
    ```
    and the ssh command outputs:
    ```
    foo1
    foo2
    ```
    then it would not match.
    
    You can see this in pure java: `"foo1\nfoo2\n".matches(".*foo.*")` is false.
    
    This PR changes our "matches" to do two things: first it tries to match the 
regex against the entire string; but if that does't work then it splits the 
input string into multiple lines and checks if the regex matches against any 
single line - if it does, then it considers it a match.
    
    Do you agree that is what the user will find most intuitive?

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aledsage/brooklyn-server 
fix-test-assert-for-matches

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-server/pull/589.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #589
    
----
commit 5bd690887a57b0ec3a9ccc7c619fe099a4f83991
Author: Aled Sage <[email protected]>
Date:   2017-03-10T16:44:07Z

    yaml-test assertions: fix use of “matches”
    
    Previously “matches: <regex>” would not work well for multi-line.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to