]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/workunits/cephadm: align test_cephadm.sh with new cephadm version
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 8 May 2023 17:54:32 +0000 (13:54 -0400)
committerAdam King <adking@redhat.com>
Thu, 31 Aug 2023 17:35:12 +0000 (13:35 -0400)
The `cephadm version` command no longer bases the output on the
container images, rather it uses a special python file added to the
zipapp during the build to report on the version of cephadm (the
binary).

The other option was to preserve this behavior and add a new version
command or make it behave differently depending on what options were
provided. I discussed the options with AMK in person and we decided that
changing the tests was preferable.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit bd59b8091929ff067fabd4c8ca7ad86b3723aa0f)

qa/workunits/cephadm/test_cephadm.sh

index cca9cbc7bbc6cd2a078a99d15dd979a245980459..fcb4aa1c60f4254002461c7fc127f6ca5dd39a19 100755 (executable)
@@ -29,9 +29,16 @@ CEPHADM_SAMPLES_DIR=${CEPHADM_SRC_DIR}/samples
 
 [ -z "$SUDO" ] && SUDO=sudo
 
+# If cephadm is already installed on the system, use that one, avoid building
+# # one if we can.
+if [ -z "$CEPHADM" ] && command -v cephadm >/dev/null ; then
+    CEPHADM="$(command -v cephadm)"
+fi
+
 if [ -z "$CEPHADM" ]; then
     CEPHADM=`mktemp -p $TMPDIR tmp.cephadm.XXXXXX`
     ${CEPHADM_SRC_DIR}/build.sh "$CEPHADM"
+    NO_BUILD_INFO=1
 fi
 
 # at this point, we need $CEPHADM set
@@ -162,17 +169,20 @@ $SUDO $CEPHADM check-host
 ## run a gather-facts (output to stdout)
 $SUDO $CEPHADM gather-facts
 
-## version + --image
-$SUDO CEPHADM_IMAGE=$IMAGE_PACIFIC $CEPHADM_BIN version
-$SUDO CEPHADM_IMAGE=$IMAGE_PACIFIC $CEPHADM_BIN version \
-    | grep 'ceph version 16'
-#$SUDO CEPHADM_IMAGE=$IMAGE_OCTOPUS $CEPHADM_BIN version
-#$SUDO CEPHADM_IMAGE=$IMAGE_OCTOPUS $CEPHADM_BIN version \
-#    | grep 'ceph version 15'
-$SUDO $CEPHADM_BIN --image $IMAGE_MAIN version | grep 'ceph version'
-
-# try force docker; this won't work if docker isn't installed
-systemctl status docker > /dev/null && ( $CEPHADM --docker version | grep 'ceph version' ) || echo "docker not installed"
+## NOTE: cephadm version is, as of around May 2023, no longer basing the
+## output for `cephadm version` on the version of the containers. The version
+## reported is that of the "binary" and is determined during the ceph build.
+## `cephadm version` should NOT require sudo/root.
+$CEPHADM_BIN version
+$CEPHADM_BIN version | grep 'cephadm version'
+# Typically cmake should be running the cephadm build script with CLI arguments
+# that embed version info into the "binary". If not using a cephadm build via
+# cmake you can set `NO_BUILD_INFO` to skip this check.
+if [ -z "$NO_BUILD_INFO" ]; then
+    $CEPHADM_BIN version | grep -v 'UNSET'
+    $CEPHADM_BIN version | grep -v 'UNKNOWN'
+fi
+
 
 ## test shell before bootstrap, when crash dir isn't (yet) present on this host
 $CEPHADM shell --fsid $FSID -- ceph -v | grep 'ceph version'