Following on the previous change, the NO_PREVIEW var can be set to skip
testing with preview functions. We default to testing with preview
functions.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The one I often use is "--no-cache" to force a rebuild. Adding a var to
the makefile makes it so I don't have to get too hacky with it.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
For go-ceph's purposes we prefer the series codename so we can simply
derive CEPH_TAG from CEPH_VERSION in the makefile.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This change adds a whole family of test-containers-* rules. The role
meant to be used directly "test-containers-test" brings up the
required dependencies once, and will reuse them on subsequent runs.
The targets "test-containers-kill" and "test-containers-clean" will
remove just the ceph containers and all dependencies respectively.
The change may look big, and I did shorten some lines, thus lengthening
the makefile vertically, but the logic is basically the same as before.
One can continue using "test-multi-container" and it should behave
pretty much as before, but outside the CI when working on code or
testing things out using the more granular rules can help speed things
up.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
By running `make USE_GOCO=1` the makefile will run go build, etc.
commands using _GO_ from a _COntainer_. This is inspired by recent work
to enable development containers for VSCode, but is more aimed at
vim/cli users like myself who want to compile the code via makefile
rules and make use of vim's quickfix feature without having to have ceph
libs or, more importantly, the right version of the ceph libs, locally.
Full example: `make build test-bins USE_CACHE=1 USE_GOCO=1`
Signed-off-by: John Mulligan <jmulligan@redhat.com>
There are use cases where the default go commands are not what you want,
including an upcoming change. This simply "variablizes" the makefile.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
If the make variable USE_CACHE is set, the test container will mount
the /go directory from a named volume that is reused in following
test runs, so that go dependencies don't have to be installed again.
Signed-off-by: Sven Anderson <sven@redhat.com>
We now set the hostname for the "test-container" to "test_ceph_aio"
where "aio" means "all in one". This will be useful for the rgw test
where we need an hostname to reach out to the endpoint.
Signed-off-by: Sébastien Han <seb@redhat.com>
We're adding a fair amount of octopus (and later) only features now, and
at the time of this writing, pacific is already out. Stop defaulting to
nautilus and default to octopus instead.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Allow passing additional arguments for the entrypoint.sh script to
the test container. This is useful to limit the test run to
a single package with `--test-pkg=<X>` for example.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
When running the new test-multi-container make rule, I found that
podman generated "random" hex based hostnames for the containers.
These names work internally and do resolve but I found that putting
these in the ceph config files does not work as ceph sees them as
addresses, not hostnames, presumably due to the hex.
This change simply specifies the hostnames manually on the cli
so that both podman and docker should match docker's default behavior.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
When invoking podman/docker/etc. it is no longer needed to add fuse
support, or (AFAICT) keeping cap SYS_ADMIN.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Integrate the new 'cephfs/admin' package with existing makefile rules
and entrypoint.sh for testing.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
I noticed that the make target I use for smoke testing things locally
was failing due to new octopus related vars. This was due to the go test
lines in the makefile not passing tags for the maximum ceph version.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
After having forgot to explicitly pass CONTAINER_CMD for the millionth
time I figured copying ceph-csi a smidgen and automatically selecting
podman or docker based on availability would be save me some typing.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Right now the tool doesn't do much checking but it does check what is
implemented, so we call the rule 'check-implements'. All current
sub-packages are checked. Use IMPLEMENTS_OPTS to pass additional cli
options to the tool.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, "make check" only ran revive and its static checks. The
entrypoint.sh script ran a formatting check *after* setting up ceph.
Now, "make check" runs both revive and gofmt. New make rules
check-revive and check-format run the individual tools respectively.
This is done to quicken the feedback in both the CI and locally for
formatting mistakes. Users can now easily run `make check
test-container` and avoid a long wait to set up ceph just to find out
there was a silly formatting error present.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
make test-container is failing on Fedora based distribution because of bad label option "disabled".
Change label option to "disable"
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
Our first operation is generating sizes for various caller-allocated
buffers. The WithSizes function "suggests" sizes to an anonymous
function that takes a size as an argument and returns a hint how
sucessful the attempt was. If required the same function is called
again with a larger size. Errors and other results of that anonymous
function are "communicated" with variables of the surrounding scope
in wich the function is defined.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Signed-off-by: Sven Anderson <sven@redhat.com>
revive would only fail if rbd had errors due to the loop being in shell.
Now we expand the modules list as arguments to revive which then
invokes revive only once and properly handles errors.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Moving the errutil pkg to "internal/errutil" makes errutil private-like
and accessible to only other go-ceph packages. The functions it provided
were always meant to be used only by go-ceph, this just makes it more
official. This is a breaking change but it was only available to
outside users for 1 release and it is somewhat doubtful users outside
of go-ceph would have reached for these functions.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
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>
The go test command's -c switch builds the test binary but does not
execute it. It is convenient to do quick compile checks of the libraries
and test code at once without having to bring up the ceph instance in
the test container. This change allows one to run 'make test-bins' or
'make rbd.test' to compile but not run the test & library code.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Fedora based distributions don't use AppArmor but SELinux instead.
This change detects the distribution and sets the --security-opts
accordingly.
Signed-off-by: Sven Anderson <sven@redhat.com>
When running 'make test-docker' on Fedora with SElinux in Enforcing
mode, fetching dependencies for the project fails. It seems the volume
is not accessible to the container. Enabling SElinux for the volume (by
passing the :z flag) makes it work.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Add new variables to the Makefile that allow the use of other container
runtimes (that have a docker compatible cli) and allow setting extra
opts to work on platforms that don't run apparmor.
All defaults continue to be the same as before.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit adds the following cephfs functions:
* Unmount // Unmounting is necessary to cleanup mounts
* Release // Release destroys the cmount ~ end of transaction
* RemoveDir // inverse of MakeDir
* Chown // change ownership of file or directory
* Chmod // change permissions of file or directory
Tests are included for each function.
In addition to these changes modifications to:
.travis.yml, Dockerfile, and Makefile
were made to accomodate tests to mount the ceph volume. Tests use
fuse to mount the volume which requires adding:
--device /dev/fuse --cap-add SYS_ADMIN --security-opt \
apparmor:unconfined
to the docker container (alternatively --privileged works but adds
additional permissions).
Changes to README add the above docker changes as well as point
users to the necessary ceph development libraries.