Skip to content

Consistently collect test artifacts #3441

Closed

Description

@larkost

Currently the files that a test (and the servers involved) produce are not collected in a consistent way in ./run and ./test-runner. The former is more consistent (if a bit of a packrat), but the latter is all over the place (and largely does not collect anything, especially from the server). So the list of what should be collected should be thought through and the behavior made consistent for all tests.

As a starting point here is a proposal:

  • create a single folder to hold all test output, with sub-folders for each test (if there are multiple)
  • default that folder to a short random-named (alpha) folder in '.', with a command-line switch to specify a location
  • in that folder write a meta-data file with information about when the test was run, with what options, git information, host information (hostname, CPU, etc), etc...
  • each test should also have a meta-data file with timing and setting information. For tests that use a common server it should also indicate what server was used.
  • keep stdout/stderr from the tests in one file (possibly with line prefixes to denote which they came from)
  • keep the server log for each server started, stderr/stdout (single file) from the server is only kept in the case of a crash (in case there is information there not logged).
  • server files are only kept when it crashes (or fails), with a command-line switch to keep all

I think this strikes the balance between having what is needed for 99% of diagnosis and not filling up our servers drives with un-needed data that will never be looked at.

Activity

  1. added this to the tests milestone on Dec 15, 2014
  2. timmaxw commented on Dec 15, 2014

    @timmaxw
    Member

    I run /test/run interactively on a daily basis. Some of the proposed changes would be inconvenient for me. In particular:

    • I like the fact that /test/run currently puts the test output in /test/results by default, so it doesn't pollute my working directory. I propose we keep that behavior.
    • If I run the tests several times, I need a quick way to see which output directory corresponds to the latest run. Right now I can do this by clearing the output directory before running the test, or by looking at the timestamp in the filename. Ideally, I'd actually want the test driver to symlink /test/results/latest to the newly-created directory.
    • I like the fact that each test's stdout/stderr is in its own file in its own directory. It saves me from having to wade through irrelevant output from non-failing tests to find the output from a test that failed. I propose that we keep this behavior.
    • Often I debug something by adding print statements and then re-running the test. If the test framework discards server stdout/stderr, I wouldn't be able to see the output of my debug statements. I propose that we add a --minimize-artifacts flag to the test runner, and keep stdout/stderr unless --minimize-artifacts is explicitly specified.
  3. larkost commented on Dec 16, 2014

    @larkost
    CollaboratorAuthor

    @timmaxw:

    • I do want to have the results be relative to pwd. Would a compromise of './reuslts' (or something like ./testresults) being the base directory work for you? That would keep the disruption to a minimum.
    • A maintained symlink is a great idea.
    • Separating stderr/stdout means that it is at best difficult to see the order that they came in, or how they interleave. I have (elsewhere) seen lots of places where this becomes an important problem.
    • I forgot to add another line about having a switch the opposite of what you are proposing. The default should be to discard, as the usual cases for running the tests don't need those (they are redundant to the log), and only specialized cases do need them. Eventually we are going to be keeping lots of results, and the less duplication the better, and the log files are clearly superior for many things.
  4. timmaxw commented on Dec 16, 2014

    @timmaxw
    Member

    @larkost:

    • ./testresults/<autogenerated name> would work for me.
    • I misunderstood what you meant by combining stderr/stdout. I thought you were going to combine all the tests' stderrs and stdouts together into a single file. I'm perfectly fine with each test combining its stderr with its stdout,
    • By "the usual cases for running the tests", you mean the nightly builds, right? The reason I suggested that the default should be keep is that it's easier to add a flag once to the script that runs the nightly build than it is to type the flag every time I run the tests interactively.

    Now that I think about it, I could always just alias run_tests to ../test/run --keep-artifacts --output-dir=../test/results or something in my .bash_profile, so it's not super important what the defaults are as long as they're configurable.

  5. larkost commented on Dec 16, 2014

    @larkost
    CollaboratorAuthor

    By "usual cases" I was thinking less about automated processes, since as you point out those are easy to setup, as people running the test suite as a general validation of changes made to the server. I understand the case of writing/debugging tests (and do it frequently), but consider that a secondary use-case.

  6. timmaxw commented on Dec 16, 2014

    @timmaxw
    Member

    Oh. I usually run the tests with rm -rf ../test/results/* && ../test/run my_test, so I don't especially care if the artifacts take a few gigabytes of disk space. For some reason I was assuming that everyone else did something similar, so I thought that the output size only mattered for the automated tests. What if we make ./run destroy all but the latest (or latest few) test output directories by default, unless an explicit flag is specified, and then make the tests produce lots of artifacts by default? It seems like that's ideal for the interactive use case. But I don't really understand the motivation for keeping multiple output directories in the first place, so maybe I'm missing something.

  7. danielmewes commented on Dec 16, 2014

    @danielmewes
    Member

    When I run the tests I also frequently delete the contents of the results directory. The main reason for me is the fact that I cannot tab-complete straight into the latest test results if there are multiple ones in there.
    If there's a latest symlink, I would probably not bother deleting old results anymore. I probably wouldn't mind if it only kept the last run by default either.

  8. larkost commented on Dec 16, 2014

    @larkost
    CollaboratorAuthor

    We have a separate issue for cleaning out results directories: #674. @danielmewes @timmaxw, if you have strong opinions on that please comment. I expect that to be somewhere later.

    But the one place where that crosses over here: if we are going to have auto-management then we could go with something like numbered directories, so you would have (almost) explicit ordering. That would not be too hard/expensive to implement.

    The only down-side is that I would have to default to a fixed number of digits for sorting purposes. So either 2 or 3, and put leading 0's on them.

  9. self-assigned this
    on Jul 6, 2015
  10. larkost commented on Jul 6, 2015

    @larkost
    CollaboratorAuthor

    A similar fix to this is already in with #4018 so I am marking this as duplicate, even though this is older.

  11. modified the milestones: duplicate, tests on Jul 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions