]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
Run the zypp-plugin tests
authorMartin Vidner <mvidner@suse.cz>
Thu, 5 Dec 2019 09:58:50 +0000 (10:58 +0100)
committerMartin Vidner <mvidner@suse.cz>
Fri, 13 Dec 2019 15:31:47 +0000 (16:31 +0100)
The tests need rubygem ruby-dbus
but we're not adding a build time dependency in the RPM spec file,
instead putting it to the Docker images used in Travis

Dockerfile.debian
Dockerfile.leap
Dockerfile.tumbleweed
Dockerfile.ubuntu
configure.ac
zypp-plugin/Makefile.am
zypp-plugin/testsuite/.gitignore [new file with mode: 0644]
zypp-plugin/testsuite/Makefile.am [new file with mode: 0644]
zypp-plugin/testsuite/test1

index de789137b6bc8de9db776076162159d982b3a3ac..8e6a89bd128364a6b2632a8dc8b5007debdca135 100644 (file)
@@ -8,6 +8,7 @@ RUN apt-get update && \
   autoconf \
   automake \
   build-essential \
+  dbus \
   debhelper \
   devscripts \
   docbook-xsl \
@@ -27,6 +28,7 @@ RUN apt-get update && \
   libz-dev \
   locales-all \
   rapidjson-dev \
+  ruby-dbus \
   xsltproc
 
 RUN mkdir -p /usr/src/app
index c5d5a3100d149400118b08c0c3f7963e838a9453..5596a63dcc14740715f4f96b8e6f563e300c78e6 100644 (file)
@@ -1,7 +1,14 @@
 # Build the latest openSUSE Leap image
 FROM opensuse/leap
 
-RUN zypper --non-interactive in --no-recommends \
+# we need to install Ruby first to define the %{rb_ver} RPM macro
+# see https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run
+# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#/build-cache
+# why we need "zypper clean -a" at the end
+RUN zypper --non-interactive in --no-recommends --force-resolution ruby && zypper clean -a
+
+RUN RUBY_VERSION=ruby:`rpm --eval '%{rb_ver}'` && \
+  zypper --non-interactive in --no-recommends \
   autoconf \
   automake \
   dbus-1-devel \
@@ -23,6 +30,7 @@ RUN zypper --non-interactive in --no-recommends \
   pam-devel \
   rapidjson-devel \
   rpm-build \
+  "rubygem($RUBY_VERSION:ruby-dbus)" \
   which
 
 RUN mkdir -p /usr/src/app
index 5289fa4881a82f77101d61bee9c86c29467761ed..187ab754fdd9df0472e986be7f5c84eccdbc4b17 100644 (file)
@@ -1,7 +1,14 @@
 # Build the latest openSUSE Tumbleweed image
 FROM opensuse/tumbleweed
 
-RUN zypper --non-interactive in --no-recommends \
+# we need to install Ruby first to define the %{rb_ver} RPM macro
+# see https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run
+# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#/build-cache
+# why we need "zypper clean -a" at the end
+RUN zypper --non-interactive in --no-recommends --force-resolution ruby && zypper clean -a
+
+RUN RUBY_VERSION=ruby:`rpm --eval '%{rb_ver}'` && \
+  zypper --non-interactive in --no-recommends \
   autoconf \
   automake \
   dbus-1-devel \
@@ -23,6 +30,7 @@ RUN zypper --non-interactive in --no-recommends \
   pam-devel \
   rapidjson-devel \
   rpm-build \
+  "rubygem($RUBY_VERSION:ruby-dbus)" \
   which
 
 RUN mkdir -p /usr/src/app
index 3266032393ecf573290b30814fdbabacbb62907c..0cc6bdee0d1c1f71e1569e62195b60d692d97aaa 100644 (file)
@@ -8,6 +8,7 @@ RUN apt-get update && \
   autoconf \
   automake \
   build-essential \
+  dbus \
   debhelper \
   devscripts \
   docbook-xsl \
@@ -28,6 +29,7 @@ RUN apt-get update && \
   libxml2-dev \
   libz-dev \
   rapidjson-dev \
+  ruby-dbus \
   xsltproc
 
 RUN mkdir -p /usr/src/app
index c4cec82c435211e92690052571ffed0ee06aba6d..4379a766f60b9c2aa23e612fe57341ec7acec097 100644 (file)
@@ -193,6 +193,7 @@ AC_OUTPUT(
        testsuite-real/Makefile
        testsuite-cmp/Makefile
        zypp-plugin/Makefile
+       zypp-plugin/testsuite/Makefile
        package/snapper.spec:snapper.spec.in
        dists/debian/snapper-Debian.dsc.in:dists/debian/snapper-Debian.dsc.in.in
        dists/debian/snapper-xUbuntu.dsc.in:dists/debian/snapper-xUbuntu.dsc.in.in
index 90117392b5c0b0bd0d0f44d0f0f32168bbf19962..656873348da865b07f87b3651b842d06521b488b 100644 (file)
@@ -1,3 +1,5 @@
+SUBDIRS = testsuite
+
 if HAVE_ZYPP
 
 plugindir = /usr/lib/zypp/plugins/commit
@@ -15,4 +17,4 @@ snapper_zypp_plugin_LDFLAGS = \
     ../dbus/libdbus.la \
     -lboost_regex
 
-endif
\ No newline at end of file
+endif
diff --git a/zypp-plugin/testsuite/.gitignore b/zypp-plugin/testsuite/.gitignore
new file mode 100644 (file)
index 0000000..42f1710
--- /dev/null
@@ -0,0 +1,3 @@
+*.log
+*.trs
+test-suite.log
diff --git a/zypp-plugin/testsuite/Makefile.am b/zypp-plugin/testsuite/Makefile.am
new file mode 100644 (file)
index 0000000..780192f
--- /dev/null
@@ -0,0 +1,9 @@
+if HAVE_ZYPP
+
+check_SCRIPTS = test1
+noinst_SCRIPTS = mock-snapperd
+
+TESTS = $(check_SCRIPTS)
+
+EXTRA_DIST = $(check_SCRIPTS) $(noinst_SCRIPTS)
+endif
index b54262fb79791595bb13bd54b6701cd07ec3183e..20384e13aae2a2aced63fa14b2f210d59a537fa1 100755 (executable)
@@ -51,6 +51,12 @@ test_pre_del() {
 }
 
 setup() {
+    MOCKDEP=(ruby -rdbus -e 1)
+    if ! "${MOCKDEP[@]}"; then
+        echo "Mock snapperd cannot be run, skipping test"
+        echo "('${MOCKDEP[@]}' failed)"
+        exit 77
+    fi
     $MYDIR/mock-snapperd &
     sleep 1
     PID=$!