Commit Graph

19 Commits

Author SHA1 Message Date
Niels de Vos 86a3a66849 tests: parameterize Ceph version for container build and build-tags
Pass `CEPH_VERSION=minic` (or 'luminous') on the `make test-docker`
command to select building a container with a different Ceph version and
running the tests in it.

This passes the given CEPH_VERSION on to the `docker build` command as a
--build-arg, which gets used for selecting the Ceph repository during
container build.

It also sets the environment variable CEPH_VERSION, which in turn is
consumed by `entrypoint.sh` to set the `go build -tags ${CEPH_VERSION}`
option that includes/excludes certain *.go files.

See-also: https://golang.org/pkg/go/build/#hdr-Build_Constraints
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-02-12 13:48:21 -05:00
John Mulligan 2f7493bed1 entrypoint: make var references consistently use curly braces
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-02-11 09:22:03 +01:00
John Mulligan ee2c26906e entrypoint: support disabling code coverage
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-02-11 09:22:03 +01:00
John Mulligan b7ea1de2e2 entrypoint: add options to run cpu and mem profiling on tests
Add options --cpuprofile and --memprofile which enables the respective
profile options for the go test command.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-02-11 09:22:03 +01:00
John Mulligan 7d12f0bbcd entrypoint: highlight important commands in script output
Add a small wrapper function 'show' that prints a prefix and the
command that will be run. Helps the reader jump to important parts of
the script output.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-02-11 09:22:03 +01:00
John Mulligan 7790594ee4 entrypoint: fix pausing after test failure
The --pause option for the entrypoint script is useful for interactive
debugging after a test failure, but the script was not pausing if the
test suite failed. Add code to explicitly handle test failures including
pausing.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-02-11 09:22:03 +01:00
John Mulligan 691cd8d99b entrypoint: move pre- and post- test code into functions
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-02-11 09:22:03 +01:00
John Mulligan 3ca24f63c5 entrypoint: move go test setup an invocation into a function
A little refactoring to move the setup of the pkg test calls into a
function to ease future changes.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-02-11 09:22:03 +01:00
John Mulligan 25bd9f0bed entrypoint: wrap main code in a function
As preparation for upcoming changes, move the main code of entrypoint.sh
into functions. Best viewed by ignore whitespace.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-02-11 09:22:03 +01:00
John Mulligan 09813739ed testing: use Go 1.12 from go upstream in ci container
When building the container image for running tests take the older of
the two current releases from Go upstream. We use the older version
in order to make sure we are testing with something supported but maybe
not everyone is on 1.13 yet.
This also enables the use of go modules to ensure we get the proper
versions of dependencies.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-30 07:46:18 +01:00
John Mulligan 280b9b01d4 entrypoint: handle the sub-packages separately
Run the tests for each sub-package as a separate invocation.
Make the package selectable.
This has a few small advantages:
* When iterating on a single package the other packages do not run
* Better coverage summary line printed after each test
* Slightly better output with verbose test output

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-20 17:41:15 +01:00
John Mulligan 105ccc6ee1 entrypoint: enable coverage for errutil package
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 16:59:25 +01:00
John Mulligan 20d12ba7bc test: disable test results caching with -count flag
According to the 'go test' help, "The idiomatic way to disable test
caching explicitly is to use -count=1." This removes GOCACHE=off in
favor of using -count=1 as GOCACHE=off breaks other tooling including
the use of go modules.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-05 14:04:15 -05:00
John Mulligan 5b6bad390a test: make entrypoint script behavior configurable
Adds cli parsing to the entrypoint script allowing for:
1. Custom path to micro-osd script
   This allows easier testing of the script itself or quick
   and dirty customization for special one-off tests
2. Selecting tests to run (or "ALL" or "NONE")
   This allows the user to run only a subset of the tests as needed.
3. Option to pause indefinitely after tests complete
   This keeps the containerized environment alive after tests
   have run for debugging or just for creating a quick and dirty
   ceph environment for playing around.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-05 14:04:15 -05:00
John Mulligan fb17c78c11 tests: generate html coverage report
When tests are run generate a coverage report.

To access this coverage report mount any directory to /results in the
container. Coverage output files will be written to /results/coverage
w/in the container.

Later we can do other interesting things with the coverage detected
such as a test pass/fail criteria or submitted to a service such as
coveralls, etc.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-11-04 11:04:15 -05:00
Lincoln Thurlow b7c7659ec4 go-ceph: add cephfs to docker
* Adds metadata server (mds) for cephfs to Dockerfile
* Enables cephfs tests
2018-10-09 20:56:52 -07:00
Noah Watkins 6107372c34 ci: check go formatting
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-09-17 15:41:24 -07:00
Noah Watkins b389ed391c ci: update golang in ci
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-08-07 18:48:28 -07:00
Noah Watkins 19a37c4565 ci: update to luminous and dockerized setup
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-07-07 13:20:41 -07:00