In a previous commit we added fsDisconnect to match with fsConnect. For
tests that do not use fsConnect but still acquire resources we need to
free up those resources with direct calls to the appropriate functions.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
For every (most?) call to fsConnect we should pair it with a (deferred)
call to fsDisconnect to close connection and release resources
associated with the mount object we have created for the test.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The defer function in TestMountWithRoot was always trying to call
unmount before release. This is not correct if the fs was not mounted
so we reorganize this code to more closely match what should be done
in normal practice.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Somehow we managed to introduce extra code into TestCreateMount that
had it create two mounts. This is undesirable for this test so this
change eliminates the extra unwanted invocation.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, the mds name was hardcoded in the tests to match that set up
by "micro-osd.sh". We continue to default to that value, but allow the
test to be supplied a custom value by the environment.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
When running cephfs tests locally there is no strong urge to require
an environment exactly like that of the test container. However, we do
want tests run under the container image (especially our default ci) to
use the cephfs mountpoint as they were previously. Set a default value
in the entrypoint script to require the mountpoint so we don't
accidentally miss the tests if something unexpected goes wrong.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add a utility function to test cases that expect the cephfs file system
to be mounted locally and accessible.
Add environment vars to configure the location of the mount point as
well whether the function causes the test to be skipped (the default)
or force an early but clear failure.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Within the last 24hrs the "octopus" release of ceph is available, and
matching tags have been created in the ceph containers project. Consume
the release name rather than master.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
We had a lot of "exported" badness previously but that either been
resolved or disabled on a case-by-case basis. Make the rule fail the
check so that new cases like this are not brought in.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, the types were named RbdImageOptions and RbdImageOption.
Now they are named ImageOptions and ImageOption.
Type aliases have been added to prevent existing code from
breaking. As these types were new in v0.2, I suspect we can drop
the aliases post-v0.3.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Image option constants are now named ImageOptionX, without an Rbd
prefix. Aliases to the old names are provided and doc comments for both.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This further improves the ability to use the script outside the
container itself and against alternate ceph cluster configs.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Currently there's no container image named "octopus" but its imminent.
Once ceph container starts tagging images with "latest-octopus" we
should switch to that.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
It appears that ceph octopus (currently testing as master) is stricter
about some inputs and the old formatting in the test was failing.
Use formatting that all versions should be happy with.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Ceph containers [1] are built by the ceph team and for our purposes,
only lack build tools and Go making the delta we need to do smaller.
1: https://github.com/ceph/ceph-container
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Instead of duplicating some of the actions in the travis yaml file and
the Makefile, have travis rules make use of the Makefile.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Our use of the base os is pretty minimal as the tests mainly rely on
what happens inside the container. Might as well not use something old.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
A previous change improved our use of pointers such that go vet no
longer had an issue with these lines but if we ever need to change the
interaction between rbd and rados like that again we can now rely on a
single call site `cephIoctx` that will return our ceph/c type given the
public Go-language level type from the rados pkg.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The void * is (ab)used in C for passing arbitrary data to the callback,
which in our case is a integer index. However, Go tools can not tell
this is OK and throws an error running go vet. Change the wrapper
function to take a uintptr_t and cast that to void* only in the
(unchecked) C layer.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This improves the code in two ways: first, it makes the function name and the
return type match. Second, it avoids issues found by go vet converting
from uintptr to unsafe.Pointer without any obvious pointer math.
(See: https://pkg.go.dev/unsafe)
Technically, this is an API breaking change but this function is only
public to exchange the internal ceph structure between the rados and
rbd modules. This had the smallest delta and doesn't feel any more
hacky than what already existed in the code. If someone was using this
function externally then too bad.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This can be useful when running the script outside of the
container or doing other sneaky things. :-)
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>