From 74e2d2009b6e3e8aa9d1dd8dbe5eb7553a84f46e Mon Sep 17 00:00:00 2001 From: Rodion Goritskov Date: Thu, 15 Aug 2024 01:25:07 +0400 Subject: miniflux: Add system tests --- rodion/packages/audio.scm | 8 ++--- rodion/packages/games.scm | 2 +- rodion/services/miniflux.scm | 1 - rodion/tests/services.scm | 80 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 rodion/tests/services.scm diff --git a/rodion/packages/audio.scm b/rodion/packages/audio.scm index 3121a14..0c7618b 100644 --- a/rodion/packages/audio.scm +++ b/rodion/packages/audio.scm @@ -110,15 +110,15 @@ (native-inputs (list pkg-config)) (inputs (list alsa-lib - sdl2 - pipewire + ffmpeg + icu4c kdsingleapplication + pipewire qtbase qttools qtsvg - icu4c + sdl2 taglib - ffmpeg zlib)) (arguments `(#:tests? #f)) (source diff --git a/rodion/packages/games.scm b/rodion/packages/games.scm index 8da53f8..aba0515 100644 --- a/rodion/packages/games.scm +++ b/rodion/packages/games.scm @@ -37,7 +37,7 @@ (description "Filename pattern matching library functions") (synopsis "Filename pattern matching library functions for DOS, Windows, and Unix. -Functions for matching filename patterns to filenames. Written in C. Provided as an object file (fpattern.obj) and a header include source file (fpattern.h). +Functions for matching filename patterns to filenames. Written in C. Provided as an object file (fpattern.so) and a header include source file (fpattern.h). Filename patterns are composed of regular (printable) characters which may comprise a filename, as well as special pattern matching characters. A filename patterns is a special kind of regular expression, except that it is not as general and is designed to match only file and directory names instead of arbitrary text strings. The syntax is borrowed from Unix, and is a superset of the MS-DOS and Windows syntax."))) diff --git a/rodion/services/miniflux.scm b/rodion/services/miniflux.scm index 73a5690..39699f0 100644 --- a/rodion/services/miniflux.scm +++ b/rodion/services/miniflux.scm @@ -105,7 +105,6 @@ (extensions (list (service-extension account-service-type miniflux-account) - (service-extension postgresql-service-type (const #t)) (service-extension postgresql-role-service-type miniflux-postgresql-role) (service-extension shepherd-root-service-type diff --git a/rodion/tests/services.scm b/rodion/tests/services.scm new file mode 100644 index 0000000..758be89 --- /dev/null +++ b/rodion/tests/services.scm @@ -0,0 +1,80 @@ +(define-module (rodion tests services) + #:use-module (gnu tests) + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu services) + #:use-module (gnu services networking) + #:use-module (gnu services databases) + #:use-module (gnu packages databases) + #:use-module (guix monads) + #:use-module (guix store) + #:use-module (guix profiles) + #:use-module (rodion services miniflux) + #:use-module (guix gexp)) + +(define %miniflux-os + (simple-operating-system + (service dhcp-client-service-type) + (service postgresql-service-type + (postgresql-configuration + (postgresql postgresql-15))) + (service miniflux-service-type))) + +(define* (run-miniflux-test name test-os) + (define os + (marionette-operating-system + test-os + #:imported-modules '((gnu services herd) + (guix combinators)))) + + (define forwarded-port 8080) + + (define vm + (virtual-machine + (operating-system os) + (port-forwardings `((8080 . ,forwarded-port))))) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (srfi srfi-64) + (gnu build marionette)) + + (define marionette + (make-marionette (list #$vm))) + + (test-runner-current (system-test-runner #$output)) + (test-begin #$name) + + (test-assert #$(string-append name " service running") + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (match (start-service '#$(string->symbol name)) + (#f #f) + (('service response-parts ...) + (match (assq-ref response-parts 'running) + ((#t) #t) + ((pid) (number? pid)))))) + marionette)) + + (test-assert "Miniflux TCP port ready, IPv4" + (wait-for-tcp-port #$forwarded-port marionette)) + + (test-end)))) + (gexp->derivation "miniflux-test" test)) + +(define %test-miniflux + (system-test + (name "miniflux") + (description "Connect to a running Miniflux service.") + (value (run-miniflux-test name %miniflux-os)))) + +(define (system-test->manifest-entry test) + "Return a manifest entry for TEST, a system test." + (manifest-entry + (name (string-append "test." (system-test-name test))) + (version "0") + (item test))) + +(manifest (map system-test->manifest-entry (list %test-miniflux))) -- cgit v1.2.3