~cjwatson/launchpad-buildd/extended-snap-status

« back to all changes in this revision

Viewing changes to lpbuildd/tests/harness.py

  • Committer: Adam Conrad
  • Date: 2013-10-10 15:02:24 UTC
  • Revision ID: adconrad@0c3.net-20131010150224-5myle0putd2tcstp
Mount /dev/pts with -o gid=5,mode=620 to avoid needing pt_chown.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
__metaclass__ = type
5
5
__all__ = [
6
6
    'BuilddTestCase',
 
7
    'FakeSlave',
7
8
    ]
8
9
 
9
10
import os
25
26
class MockBuildManager(object):
26
27
    """Mock BuildManager class.
27
28
 
28
 
    Only implements 'is_archive_private' and 'needs_sanitized_logs' as False.
 
29
    Only implements 'is_archive_private' as False.
29
30
    """
30
31
    is_archive_private = False
31
32
 
32
 
    @property
33
 
    def needs_sanitized_logs(self):
34
 
        return self.is_archive_private
35
 
 
36
33
 
37
34
class BuilddTestCase(unittest.TestCase):
38
35
    """Unit tests for logtail mechanisms."""
95
92
    sourcepackagerecipe
96
93
    translation-templates
97
94
 
98
 
    >>> s.status()["builder_status"]
 
95
    >>> s.status()
 
96
    ['BuilderStatus.IDLE', '']
 
97
 
 
98
    >>> s.status_dict()["builder_status"]
99
99
    'BuilderStatus.IDLE'
100
100
 
101
101
    >>> fixture.tearDown()
137
137
    def logfile(self):
138
138
        return '/var/tmp/build-slave.log'
139
139
 
140
 
    @property
141
 
    def daemon_port(self):
 
140
    def _hasDaemonStarted(self):
 
141
        """Called by the superclass to check if the daemon is listening.
 
142
 
 
143
        The slave is ready when it's accepting connections.
 
144
        """
142
145
        # This must match buildd-slave-test.conf.
143
 
        return 8221
 
146
        return self._isPortListening('localhost', 8221)