tests: openvswitch: Check whether ovs0 is up.

* gnu/tests/networking.scm (run-openvswitch-test)["ovs0 is up"]: New test.
This commit is contained in:
Ludovic Courtès 2021-10-23 15:04:58 +02:00
parent 72f140c253
commit 33c498b9ee
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -286,12 +286,15 @@ (define %openvswitch-os
(define (run-openvswitch-test)
(define os
(marionette-operating-system %openvswitch-os
#:imported-modules '((gnu services herd))))
#:imported-modules '((gnu services herd)
(guix build syscalls))))
(define test
(with-imported-modules '((gnu build marionette))
(with-imported-modules '((gnu build marionette)
(guix build syscalls))
#~(begin
(use-modules (gnu build marionette)
(guix build syscalls)
(ice-9 popen)
(ice-9 rdelim)
(srfi srfi-64))
@ -339,6 +342,18 @@ (define marionette
(current-services))))
marionette))
(test-equal "ovs0 is up"
IFF_UP
(marionette-eval
'(begin
(use-modules (guix build syscalls))
(let* ((sock (socket AF_INET SOCK_STREAM 0))
(flags (network-interface-flags sock "ovs0")))
(close-port sock)
(logand flags IFF_UP)))
marionette))
(test-end)
(exit (= (test-runner-fail-count (test-runner-current)) 0)))))