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

test suite reorganization #93

Merged
merged 10 commits into from Aug 1, 2018
Merged

test suite reorganization #93

merged 10 commits into from Aug 1, 2018

Commits on Jul 20, 2018

  1. pkg/sanity: use different volume names

    Within the test suite, each name is now unique. That simplifies
    debugging and when one test fails to remove its volume, the other
    tests are not affected. It also allows running tests in parallel.
    
    In addition, a random suffix gets added to also prevent collisions
    between different test runs. The random suffix gets reused for tests
    running inside the same process, but will be different for a single
    test run when running with "gingko -p".
    
    Related-to: kubernetes-csi#89.
    pohly committed Jul 20, 2018
    Copy the full SHA
    19290b3 View commit details
    Browse the repository at this point in the history
  2. pkg/sanity: reorganize suite

    Instead of testing individual functions of each service, the
    reorganized suite tests three services and for each service the
    functions that it provides. This allows removing code duplication in
    the common BeforeEach functions and enables further
    enhancements (common cleanup code, not duplicating the same test
    multiple times).
    
    While at it, the term "services" is now used consistently instead of
    "server", because that is what the CSI spec describes.
    pohly committed Jul 20, 2018
    Copy the full SHA
    2d4ff96 View commit details
    Browse the repository at this point in the history
  3. pkg/sanity: avoid running the same test four times

    The full workflow test was done four times under different
    names. That's unnecessary and potentially confusing. Now it gets run
    once alongside the more specific function tests.
    pohly committed Jul 20, 2018
    Copy the full SHA
    e67e163 View commit details
    Browse the repository at this point in the history
  4. pkg/sanity: avoid if check around GetPublishInfo

    GetPublishInfo returns nil when called for a nil
    ControllerPublishVolumeResponse, therefore the if check is
    redundant. Always setting PublishInfo is another step towards inlining
    the parameter constructions.
    pohly committed Jul 20, 2018
    Copy the full SHA
    2fdc9c8 View commit details
    Browse the repository at this point in the history
  5. pkg/sanity: avoid if checks around secrets

    By ensuring that we always have a valid CSISecrets, even if it only
    contains nil pointers, we can get rid of all the "if != nil" checks
    and the separate construction of the parameter structure.
    pohly committed Jul 20, 2018
    Copy the full SHA
    8108500 View commit details
    Browse the repository at this point in the history
  6. simplify imports

    There's no need to rename the csi spec, the package name already is
    "csi". Same for "gmock". The "context" module has been part of the Go
    standard library for quite a while now, we should use that directly.
    pohly committed Jul 20, 2018
    Copy the full SHA
    183e16e View commit details
    Browse the repository at this point in the history
  7. pkg/sanity: close connection last

    Ginkgo invokes AfterEach in the order in which they are defined,
    therefore we should define the AfterEach where the connection is closed
    as late as possible. That way the tests can have their own AfterEach
    where they can still use the connection.
    pohly committed Jul 20, 2018
    Copy the full SHA
    7d3ced6 View commit details
    Browse the repository at this point in the history
  8. pkg/sanity: track and delete volumes

    When a test fails, any volume operations that I may have done should
    be reversed. To achieve this, tests can register volumes for
    cleanup.
    
    To avoid unnecessary operations, volumes also get unregistered after a
    successful removal inside the test itself. Whether
    ControllerUnpublishVolume has to be called also gets tracked. For the
    sake of simplicity, NodeUnpublishVolume and (if supported)
    NodeUnstageVolume always get called. This is okay because they have to
    be idempotent and won't fail when called unnecessarily.
    
    testFullWorkflowSuccess gets inlined because that's easier than
    passing yet another parameter.
    
    Fixes: kubernetes-csi#89.
    pohly committed Jul 20, 2018
    Copy the full SHA
    142c344 View commit details
    Browse the repository at this point in the history
  9. move testing to Makefile

    The tests previously defined only for Travis CI are now invoked with
    "make test".
    
    e2e.sh assumed that the binaries are in the regular search path. This
    is no longer necessary and in addition, mock is no longer placed in
    the developers $GOPATH/bin by the script.
    pohly committed Jul 20, 2018
    Copy the full SHA
    1a22b17 View commit details
    Browse the repository at this point in the history
  10. Makefile: fix format error reporting

    "go fmt" always fixes code in place. As a result, running it again to
    report formatting errors doesn't do anything.
    
    The original intention probably was to check for errors and then
    report them. This is what is done now, using gofmt directly and
    it's diff output mode.
    pohly committed Jul 20, 2018
    Copy the full SHA
    275a086 View commit details
    Browse the repository at this point in the history