[Bug 32074] should run regression tests against a mock Avahi by default

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Dec 3 18:05:10 CET 2010


https://bugs.freedesktop.org/show_bug.cgi?id=32074

Simon McVittie <simon.mcvittie at collabora.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
  Status Whiteboard|                            |review-
           Keywords|patch                       |

--- Comment #1 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2010-12-03 09:05:09 PST ---
In general this looks good. Some very brief notes for my own reference:

--- a/tests/twisted/avahi/file-transfer/test-receive-file-ipv6.py
+++ b/tests/twisted/avahi/file-transfer/test-receive-file-ipv6.py
@@ -36,7 +36,8 @@ class TestReceiveFileIPv6(ReceiveFileTest):
         service = e.service
         service.resolve()

-        e = self.q.expect('service-resolved', service = service)
+        e = self.q.expect('service-resolved', service = service,
+                          protocol = avahi.PROTO_INET6)

Check that this works for the real network

diff --git
a/tests/twisted/avahi/file-transfer/test-send-file-to-unknown-contact.py
b/tests/twisted/avahi/file-transfer/test-send-file-to-unknown-contact.py
index cab907c..83ec8a1 100644
--- a/tests/twisted/avahi/file-transfer/test-send-file-to-unknown-contact.py
+++ b/tests/twisted/avahi/file-transfer/test-send-file-to-unknown-contact.py
@@ -19,7 +19,8 @@ class SendFileTransferToUnknownContactTest(SendFileTest):
         try:
             self.request_ft_channel()
         except dbus.DBusException, e:
-            assert e.get_dbus_name() == cs.NOT_AVAILABLE
+            if e.get_dbus_name() != cs.NOT_AVAILABLE:
+                raise

Good independently, but call_async + expect would be even better

+def get_domain():
+    full_domain = socket.getfqdn()
+    if '.' in full_domain:
+        return full_domain.split('.', 1)[1]
+    else:
+        return ''

Shouldn't use this, laptops' FQDNs are meaningless. All we need is
Avahi's idea of the hostname (which we control anyway, so set it to
mockavahi) and Avahi's advertising domain (.local).

+            emit_signal(service_resolver.object_path,
+                        AVAHI_IFACE_SERVICE_RESOLVER, 'Failure',
+                        service_resolver.client, 's',
+                        'fill with a proper error string')

Indeed.

+    def _resolve_hostname(self, protocol, hostname):

I'm dubious about needing this. Surely we ought to advertise everything
we need on mDNS?

+    @dbus.service.method(dbus_interface=AVAHI_IFACE_SERVER,
+                         in_signature='', out_signature='s')
+    def GetHostName(self):
+        return socket.gethostname()

Hard-code this?

+    @dbus.service.method(dbus_interface=AVAHI_IFACE_SERVER,
+                         in_signature='', out_signature='s')
+    def GetHostNameFqdn(self):
+        return socket.getfqdn()

Hard-code this?

+
+    @dbus.service.method(dbus_interface=AVAHI_IFACE_SERVER,
+                         in_signature='', out_signature='s')
+    def GetDomainName(self):
+        return get_domain()

And this?

+    @dbus.service.method(dbus_interface=AVAHI_IFACE_SERVER,
+                         in_signature='', out_signature='i')
+    def GetState(self):
+        return 2

Magic number

+    @dbus.service.method(dbus_interface=AVAHI_IFACE_ENTRY_GROUP,
+                         in_signature='', out_signature='')
+    def Commit(self):
+        self._set_state(1)
+        glib.idle_add(lambda: self._set_state(2))

Magic numbers

+    tests_dir = os.path.dirname(__file__)
+    avahimock_path = os.path.join(tests_dir, 'avahimock.py')
+    Popen([avahimock_path])

Isn't there a better fork/exec we could use?

We could even use service activation, if we make the mock Avahi use the starter
bus.

diff --git a/tests/twisted/tools/org.freedesktop.Avahi.service
b/tests/twisted/tools/org.freedesktop.Avahi.service
new file mode 100644
index 0000000..c5c500c
--- /dev/null
+++ b/tests/twisted/tools/org.freedesktop.Avahi.service
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.freedesktop.Avahi
+Exec=dumb

Should use the fake-launch helper from MC, or not be activatable at all

diff --git a/tests/twisted/tools/with-session-bus.sh
b/tests/twisted/tools/with-session-bus.sh

Copy to telepathy-glib

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the telepathy-bugs mailing list