Skip to content

Need for test funcs that will check for multiple strings #6091

Closed

Description

@0xmichalis

The plural version of os::cmd::expect_success_and_text and relatives.

@stevekuznetsov @liggitt

Activity

  1. deads2k commented on Nov 25, 2015

    @deads2k
    Contributor

    In bash, its really easy to lose a nested quote and accidentally do things you didn't intend to do, soI like being able to check for accidents by counting the args going into the test functions. If allow a variable number of arguments through, we'll lose that ability.

    How many times have we wanted this?

  2. 0xmichalis commented on Nov 25, 2015

    @0xmichalis
    ContributorAuthor

    In bash, its really easy to lose a nested quote and accidentally do things you didn't intend to do

    We have you as a reviewer, we are not afraid of such details.

  3. stevekuznetsov commented on Nov 25, 2015

    @stevekuznetsov
    Contributor

    @Kargakis with the smackdown

  4. stevekuznetsov commented on Nov 25, 2015

    @stevekuznetsov
    Contributor

    In all seriousness, though, there has been one use-case where more than a couple of things were being expected. In all of the test-cmd refactors I think there was one case where we were checking for two separate outputs and I was able to tighten the regex to contain both. I wonder if using a Go template to format the output or changing the regex to include all your cases would be better than implementing these new methods. @liggitt mentioned wanting to do checks for multiple things without regard to order, which would not be possible with those workarounds most likely. I wonder how often we need to do that, though?

  5. soltysh commented on Nov 26, 2015

    @soltysh
    Contributor

    I agree with @deads2k here, this kind of logic will only introduce us to errors, whereas current multiple checks cost us only a few additional gets, which I don't mind. I've though about it for a bit while reviewing the images part, but in the end realized it's not worth the effort.

  6. liggitt commented on Nov 26, 2015

    @liggitt
    Contributor

    What about commands with side effects that we can't run multiple times?

  7. soltysh commented on Nov 26, 2015

    @soltysh
    Contributor

    Do we have such cases? You can always execute the command and test the output manually, I guess.

  8. stevekuznetsov commented on Nov 26, 2015

    @stevekuznetsov
    Contributor

    It is not intended for people to capture the output of os::cmd functions. I still think Go templates would be the better solution to this problem - they leave little room for errors, you ensure you're reading the fields you expect to be testing, etc.

  9. stevekuznetsov commented on Dec 1, 2015

    @stevekuznetsov
    Contributor

    @liggitt What's your final say here. There is one place I know that this will be useful in. Do we create a specific test function for this case?

  10. liggitt commented on Dec 1, 2015

    @liggitt
    Contributor

    I'm fine closing it until the need arises

  11. soltysh commented on Dec 1, 2015

    @soltysh
    Contributor

    👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions