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

tests/int: cleanups #2757

Merged
merged 12 commits into from
Feb 24, 2021
Merged

Commits on Feb 8, 2021

  1. tests/int: don't depend on BUSYBOX_BUNDLE var

    All the tests are run with cd to bundle directory, so
    it does not make ense to explicitly specify it.
    
    This relies on the feature of functions like set_cgroups_path
    or update_config to use current directory by default.
    
    In those cases where we need to change the directory
    (runc create/run -b), save the current one and use it later.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    64d5702 View commit details
    Browse the repository at this point in the history
  2. tests/int: rm wait_for_container_inroot

    Since commit abd0515 it is no longed used.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    78f0e4b View commit details
    Browse the repository at this point in the history
  3. tests/int: rm teardown_running_container_inroot

    It is only used in a couple of places and is easy to replace
    with ROOT=xxx teardown_running_container.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    0cfc2e3 View commit details
    Browse the repository at this point in the history
  4. tests/int/spec.bats: don't use HELLO_BUNDLE

    All tests are run with cd to bundle directory, so
    let's just use $(pwd).
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    e7052dc View commit details
    Browse the repository at this point in the history
  5. tests/int/helpers: reimplement wait_for_container

    ... by using retry, to avoid code duplication.
    
    While at it, make it check the number of arguments and error out on
    invalid usage.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    4d6ffa3 View commit details
    Browse the repository at this point in the history
  6. tests/int: use wait_for_container where appropriate

    ... instead of more generic "retry", to simplify code.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    4976614 View commit details
    Browse the repository at this point in the history
  7. tests/int/events: rm unneeded eval

    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    76532fa View commit details
    Browse the repository at this point in the history
  8. tests/int: stop reusing HELLO_BUNDLE for alt root

    Overloading $HELLO_BUNDLE with a second purpose of having an alternative
    runc root is confusing.
    
    Instead, let's create a temp directory in setup() and clean it up in
    teardown().
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    85d5fea View commit details
    Browse the repository at this point in the history
  9. tests/int: BATS_TMPDIR -> BATS_RUN_TMPDIR

    It's a little known fact, but BATS_TMPDIR is just /tmp, and it is not
    being cleaned by bats after the test.
    
    BATS_RUN_TMPDIR (available since bats 1.2.1) is $BATS_TMPDIR/bats-run-$$
    (i.e. it is per bats run and includes PID), and it is cleaned up after
    the test (unless --no-tmpdir-cleanup is given).
    
    Use BATS_RUN_TMPDIR for better isolation and cleanup.
    
    [v2: check for BATS_RUN_TMPDIR, effectively requiring bats >= 1.2.1]
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    985546b View commit details
    Browse the repository at this point in the history
  10. tests/int/list.bats: don't use $BUSYBOX_BUNDLE

    Use the value of $(pwd) as we cd to bundle dir before running a test.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    e40a369 View commit details
    Browse the repository at this point in the history
  11. tests/int/hooks.bats: don't use DEBIAN_BUNDLE

    1. Do not depend on $DEBIAN_BUNDLE, instead use the current directory.
    
    2. Simplify setup() by calling teardown().
    
    3. In teardown(), check that LIBPATH is set.
    
    4. Move global variables into setup.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    c34a9b1 View commit details
    Browse the repository at this point in the history

Commits on Feb 10, 2021

  1. tests/int: rework/simplify setup and teardown

    1. Get rid of fixed ROOT, *_BUNDLE, and CONSOLE_SOCKET dirs.
       Now they are temporary directories created in setup_bundle.
    
    2. Automate containers cleanup: instead of having to specify all
       containers to be removed, list and destroy everything (which is
       now possible since every test case has its own unique root).
    
    3. Randomize cgroup paths so two tests running in parallel won't
       use the same cgroup.
    
    Now it's theoretically possible to execute tests in parallel.
    Practically it's not possible yet because bats uses GNU parallel,
    which do not provide a terminal for whatever it executes, and
    many runc tests (all those that run containers with terminal:
    true) needs a tty. This may possibly be addressed later.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin committed Feb 10, 2021
    Configuration menu
    Copy the full SHA
    41670e2 View commit details
    Browse the repository at this point in the history