]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: run promtool test without docker on ubuntu/focal
authorKefu Chai <kchai@redhat.com>
Fri, 19 Mar 2021 02:32:16 +0000 (10:32 +0800)
committerAashish Sharma <aashishsharma@localhost.localdomain>
Wed, 21 Apr 2021 13:54:05 +0000 (19:24 +0530)
before this change, we use docker for running promtools offered by
a docker image, but this is not efficient, and quite a few developers
do not want to use docker for running "make check". this change was
introduced by #39246, the reason was that, in Ceph's CI process, we
are using Ubuntu/Bionic for running "make check" jobs, but prometheus
packaged by Bionic does not offer the "test rules" command. so, to
address problem, we are using "dnanexus/promtool:2.9.2" docker image
for verifying monitoring/prometheus/alerts/test_alerts.yml.

after this change, we use prometheus packaged by debian derivatives
instead of pulling a docker image.

* debian/control: add prometheus as a "make check" dependency
* install-deps.sh: partially revert
  53a5816deda0874a3a37e131e9bc22d88bb2a588, as we don't need to
  pull docker or start docker service for using promtool anymore.
* cmake: check if promtool is capable of running "test rules"
  command, bail out if it is not.

see also: https://tracker.ceph.com/issues/49653

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit f381aa8bf0e175940153975fa1534ef0559ecadd)

debian/control
install-deps.sh
src/test/CMakeLists.txt

index 48517f9771da09fd501bf9f4514ff83031a6573b..4ca0caa76debffc5c9fd399773ebdbe7f1ce5df3 100644 (file)
@@ -79,6 +79,7 @@ Build-Depends: automake,
                parted,
                patch,
                pkg-config,
+# Make-Check   prometheus,
 # Crimson      protobuf-compiler,
                python3-all-dev,
                python3-cherrypy3,
index 14d64724d966640441d0b7c22beac45f1a8e372e..c5bd79e0e33f6bc1a4f378c2915cfdaa8a8cb8ed 100755 (executable)
@@ -304,9 +304,6 @@ else
     case "$ID" in
     debian|ubuntu|devuan|elementary)
         echo "Using apt-get to install dependencies"
-        $SUDO apt install -y docker.io
-        $SUDO systemctl start docker
-        $SUDO systemctl enable docker
         $SUDO apt-get install -y devscripts equivs
         $SUDO apt-get install -y dpkg-dev
         ensure_python3_sphinx_on_ubuntu
@@ -444,7 +441,6 @@ function preload_wheels_for_tox() {
         mv $wip_wheelhouse wheelhouse
         md5sum $require_files $constraint_files > $md5
     fi
-
     popd > /dev/null
 }
 
index cae51bb9840541eb96bf4b8e37b9f5a2ea7d07a6..3c7625d93eba5e9270b03e7139baec3a90052562 100644 (file)
@@ -591,7 +591,23 @@ add_ceph_test(run-cli-tests ${CMAKE_CURRENT_SOURCE_DIR}/run-cli-tests)
 
 add_ceph_test(smoke.sh ${CMAKE_CURRENT_SOURCE_DIR}/smoke.sh)
 
-add_ceph_test(run-promtool-unittests.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-promtool-unittests.sh)
+find_program(PROMTOOL_EXECUTABLE promtool)
+if(PROMTOOL_EXECUTABLE)
+  execute_process(
+    COMMAND ${PROMTOOL_EXECUTABLE} test rules /dev/null
+    RESULT_VARIABLE rc
+    OUTPUT_QUIET)
+  if(NOT rc)
+    add_ceph_test(run-promtool-unittests
+      ${PROMTOOL_EXECUTABLE} test rules ${CMAKE_SOURCE_DIR}/monitoring/prometheus/alerts/test_alerts.yml)
+  else()
+    message(WARNING "'${PROMTOOL_EXECUTABLE} test rules' does not work, "
+      "please use a newer prometheus")
+  endif()
+else()
+  add_ceph_test(run-promtool-unittests
+    {CMAKE_CURRENT_SOURCE_DIR}/run-promtool-unittests.sh)
+endif()
 
 set_property(
   TEST ${tox_tests}