launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27936
[Merge] ~cjwatson/launchpad:rename-mock-builder-slaves into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:rename-mock-builder-slaves into launchpad:master.
Commit message:
Rename mock builder slaves to workers
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/413973
Nomenclature is a bit difficult here: within Launchpad, we need to distinguish between the `Builder` database model and builder machines (previously "builder slaves"). Using "builder worker" for instances of the latter is a bit clunky, but in most cases it ends up just being "worker" and that seems clear enough.
There's more to do here, but this branch is big enough as it is. This gets rid of about a third of the occurrences of the word "slave" in Launchpad.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:rename-mock-builder-slaves into launchpad:master.
diff --git a/lib/lp/buildmaster/tests/mock_slaves.py b/lib/lp/buildmaster/tests/mock_workers.py
similarity index 86%
rename from lib/lp/buildmaster/tests/mock_slaves.py
rename to lib/lp/buildmaster/tests/mock_workers.py
index a0f9c9b..14de9b6 100644
--- a/lib/lp/buildmaster/tests/mock_slaves.py
+++ b/lib/lp/buildmaster/tests/mock_workers.py
@@ -4,17 +4,17 @@
"""Mock Build objects for tests soyuz buildd-system."""
__all__ = [
- 'AbortingSlave',
- 'BrokenSlave',
- 'BuildingSlave',
+ 'AbortingWorker',
+ 'BrokenWorker',
+ 'BuildingWorker',
'DeadProxy',
- 'LostBuildingBrokenSlave',
+ 'LostBuildingBrokenWorker',
'make_publisher',
'MockBuilder',
- 'OkSlave',
- 'SlaveTestHelpers',
+ 'OkWorker',
'TrivialBehaviour',
- 'WaitingSlave',
+ 'WaitingWorker',
+ 'WorkerTestHelpers',
]
from collections import OrderedDict
@@ -81,8 +81,8 @@ class MockBuilder:
# XXX: It would be *really* nice to run some set of tests against the real
# BuilderSlave and this one to prevent interface skew.
-class OkSlave:
- """An idle mock slave that prints information about itself.
+class OkWorker:
+ """An idle mock worker that prints information about itself.
The architecture tag can be customised during initialization."""
@@ -149,8 +149,8 @@ class OkSlave:
return dl
-class BuildingSlave(OkSlave):
- """A mock slave that looks like it's currently building."""
+class BuildingWorker(OkWorker):
+ """A mock worker that looks like it's currently building."""
def __init__(self, build_id='1-1'):
super().__init__()
@@ -178,8 +178,8 @@ class BuildingSlave(OkSlave):
return defer.succeed(None)
-class WaitingSlave(OkSlave):
- """A mock slave that looks like it's currently waiting."""
+class WaitingWorker(OkWorker):
+ """A mock worker that looks like it's currently waiting."""
def __init__(self, state='BuildStatus.OK', dependencies=None,
build_id='1-1', filemap=None):
@@ -192,7 +192,7 @@ class WaitingSlave(OkSlave):
else:
self.filemap = filemap
- # By default, the slave only has a buildlog, but callsites
+ # By default, the worker only has a buildlog, but callsites
# can update this list as needed.
self.valid_files = {'buildlog': ''}
self._got_file_record = []
@@ -223,8 +223,8 @@ class WaitingSlave(OkSlave):
return defer.succeed(None)
-class AbortingSlave(OkSlave):
- """A mock slave that looks like it's in the process of aborting."""
+class AbortingWorker(OkWorker):
+ """A mock worker that looks like it's in the process of aborting."""
def status(self):
self.call_log.append('status')
@@ -234,8 +234,8 @@ class AbortingSlave(OkSlave):
})
-class LostBuildingBrokenSlave:
- """A mock slave building bogus Build/BuildQueue IDs that can't be aborted.
+class LostBuildingBrokenWorker:
+ """A mock worker building bogus Build/BuildQueue IDs that can't be aborted.
When 'aborted' it raises an xmlrpc.client.Fault(8002, 'Could not abort')
"""
@@ -259,15 +259,15 @@ class LostBuildingBrokenSlave:
return defer.succeed(("", "", 0))
-class BrokenSlave:
- """A mock slave that reports that it is broken."""
+class BrokenWorker:
+ """A mock worker that reports that it is broken."""
def __init__(self):
self.call_log = []
def status(self):
self.call_log.append('status')
- return defer.fail(xmlrpc.client.Fault(8001, "Broken slave"))
+ return defer.fail(xmlrpc.client.Fault(8001, "Broken worker"))
class TrivialBehaviour:
@@ -293,15 +293,15 @@ class LPBuilddSlaveTestSetup(BuilddSlaveTestSetup):
twistd_script=twistd_script)
-class SlaveTestHelpers(fixtures.Fixture):
+class WorkerTestHelpers(fixtures.Fixture):
@property
def base_url(self):
"""The URL for the XML-RPC service set up by `BuilddSlaveTestSetup`."""
return 'http://localhost:%d' % LPBuilddSlaveTestSetup().daemon_port
- def getServerSlave(self):
- """Set up a test build slave server.
+ def getServerWorker(self):
+ """Set up a test build worker server.
:return: A `BuilddSlaveTestSetup` object.
"""
@@ -310,8 +310,8 @@ class SlaveTestHelpers(fixtures.Fixture):
self, tachandler.logfile, name='xmlrpc-log-file', buffer_now=False)
return tachandler
- def getClientSlave(self, reactor=None, proxy=None,
- pool=None, process_pool=None):
+ def getClientWorker(self, reactor=None, proxy=None,
+ pool=None, process_pool=None):
"""Return a `BuilderSlave` for use in testing.
Points to a fixed URL that is also used by `BuilddSlaveTestSetup`.
@@ -321,10 +321,10 @@ class SlaveTestHelpers(fixtures.Fixture):
reactor=reactor, proxy=proxy, pool=pool, process_pool=process_pool)
def makeCacheFile(self, tachandler, filename, contents=b'something'):
- """Make a cache file available on the remote slave.
+ """Make a cache file available on the remote worker.
:param tachandler: The TacTestSetup object used to start the remote
- slave.
+ worker.
:param filename: The name of the file to create in the file cache
area.
:param contents: Bytes to write to the file.
@@ -334,18 +334,18 @@ class SlaveTestHelpers(fixtures.Fixture):
fd.write(contents)
self.addCleanup(os.unlink, path)
- def triggerGoodBuild(self, slave, build_id=None):
- """Trigger a good build on 'slave'.
+ def triggerGoodBuild(self, worker, build_id=None):
+ """Trigger a good build on 'worker'.
- :param slave: A `BuilderSlave` instance to trigger the build on.
+ :param worker: A `BuilderSlave` instance to trigger the build on.
:param build_id: The build identifier. If not specified, defaults to
an arbitrary string.
:type build_id: str
- :return: The build id returned by the slave.
+ :return: The build id returned by the worker.
"""
if build_id is None:
build_id = 'random-build-id'
- tachandler = self.getServerSlave()
+ tachandler = self.getServerWorker()
chroot_file = 'fake-chroot'
dsc_file = 'thing'
self.makeCacheFile(tachandler, chroot_file)
@@ -356,7 +356,7 @@ class SlaveTestHelpers(fixtures.Fixture):
'suite': 'precise',
'ogrecomponent': 'main',
}
- return slave.build(
+ return worker.build(
build_id, 'binarypackage', chroot_file,
# Although a single-element dict obviously has stable ordering,
# we use an OrderedDict anyway to test that BuilderSlave
diff --git a/lib/lp/buildmaster/tests/test_builder.py b/lib/lp/buildmaster/tests/test_builder.py
index 55f3908..731d8e2 100644
--- a/lib/lp/buildmaster/tests/test_builder.py
+++ b/lib/lp/buildmaster/tests/test_builder.py
@@ -18,7 +18,7 @@ from lp.buildmaster.interfaces.builder import (
from lp.buildmaster.interfaces.buildqueue import IBuildQueueSet
from lp.buildmaster.interfaces.processor import IProcessorSet
from lp.buildmaster.model.buildqueue import BuildQueue
-from lp.buildmaster.tests.mock_slaves import make_publisher
+from lp.buildmaster.tests.mock_workers import make_publisher
from lp.services.database.interfaces import IStore
from lp.services.database.sqlbase import flush_database_updates
from lp.services.features.testing import FeatureFixture
diff --git a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
index 1980b1e..b3f7d0a 100644
--- a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
+++ b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
@@ -34,10 +34,10 @@ from lp.buildmaster.interfaces.processor import IProcessorSet
from lp.buildmaster.model.buildfarmjobbehaviour import (
BuildFarmJobBehaviourBase,
)
-from lp.buildmaster.tests.mock_slaves import (
+from lp.buildmaster.tests.mock_workers import (
MockBuilder,
- OkSlave,
- WaitingSlave,
+ OkWorker,
+ WaitingWorker,
)
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.services.config import config
@@ -209,13 +209,13 @@ class TestDispatchBuildToSlave(StatsMixin, TestCase):
def test_dispatchBuildToSlave(self):
behaviour = self.makeBehaviour(FakeDistroArchSeries())
builder = MockBuilder()
- slave = OkSlave()
+ worker = OkWorker()
logger = BufferLogger()
- behaviour.setBuilder(builder, slave)
+ behaviour.setBuilder(builder, worker)
yield behaviour.dispatchBuildToSlave(logger)
self.assertDispatched(
- slave, logger, 'chroot-fooix-bar-y86.tar.gz', 'chroot')
+ worker, logger, 'chroot-fooix-bar-y86.tar.gz', 'chroot')
@defer.inlineCallbacks
def test_dispatchBuildToSlave_with_other_image_available(self):
@@ -225,13 +225,13 @@ class TestDispatchBuildToSlave(StatsMixin, TestCase):
das.images[BuildBaseImageType.LXD] = 'lxd-fooix-bar-y86.tar.gz'
behaviour = self.makeBehaviour(das)
builder = MockBuilder()
- slave = OkSlave()
+ worker = OkWorker()
logger = BufferLogger()
- behaviour.setBuilder(builder, slave)
+ behaviour.setBuilder(builder, worker)
yield behaviour.dispatchBuildToSlave(logger)
self.assertDispatched(
- slave, logger, 'chroot-fooix-bar-y86.tar.gz', 'chroot')
+ worker, logger, 'chroot-fooix-bar-y86.tar.gz', 'chroot')
@defer.inlineCallbacks
def test_dispatchBuildToSlave_lxd(self):
@@ -241,12 +241,13 @@ class TestDispatchBuildToSlave(StatsMixin, TestCase):
behaviour.image_types = [
BuildBaseImageType.LXD, BuildBaseImageType.CHROOT]
builder = MockBuilder()
- slave = OkSlave()
+ worker = OkWorker()
logger = BufferLogger()
- behaviour.setBuilder(builder, slave)
+ behaviour.setBuilder(builder, worker)
yield behaviour.dispatchBuildToSlave(logger)
- self.assertDispatched(slave, logger, 'lxd-fooix-bar-y86.tar.gz', 'lxd')
+ self.assertDispatched(
+ worker, logger, 'lxd-fooix-bar-y86.tar.gz', 'lxd')
@defer.inlineCallbacks
def test_dispatchBuildToSlave_fallback(self):
@@ -254,22 +255,22 @@ class TestDispatchBuildToSlave(StatsMixin, TestCase):
behaviour.image_types = [
BuildBaseImageType.LXD, BuildBaseImageType.CHROOT]
builder = MockBuilder()
- slave = OkSlave()
+ worker = OkWorker()
logger = BufferLogger()
- behaviour.setBuilder(builder, slave)
+ behaviour.setBuilder(builder, worker)
yield behaviour.dispatchBuildToSlave(logger)
self.assertDispatched(
- slave, logger, 'chroot-fooix-bar-y86.tar.gz', 'chroot')
+ worker, logger, 'chroot-fooix-bar-y86.tar.gz', 'chroot')
@defer.inlineCallbacks
def test_dispatchBuildToSlave_stats(self):
self.setUpStats()
behaviour = self.makeBehaviour(FakeDistroArchSeries())
builder = MockBuilder()
- slave = OkSlave()
+ worker = OkWorker()
logger = BufferLogger()
- behaviour.setBuilder(builder, slave)
+ behaviour.setBuilder(builder, worker)
yield behaviour.dispatchBuildToSlave(logger)
self.assertEqual(1, self.stats_client.incr.call_count)
self.assertEqual(
@@ -351,14 +352,14 @@ class TestHandleStatusMixin:
self.factory = LaunchpadObjectFactory()
self.build = self.makeBuild()
# For the moment, we require a builder for the build so that
- # handleStatus_OK can get a reference to the slave.
+ # handleStatus_OK can get a reference to the worker.
self.builder = self.factory.makeBuilder()
self.build.buildqueue_record.markAsBuilding(self.builder)
- self.slave = WaitingSlave('BuildStatus.OK')
- self.slave.valid_files['test_file_hash'] = ''
+ self.worker = WaitingWorker('BuildStatus.OK')
+ self.worker.valid_files['test_file_hash'] = ''
self.interactor = BuilderInteractor()
self.behaviour = self.interactor.getBuildBehaviour(
- self.build.buildqueue_record, self.builder, self.slave)
+ self.build.buildqueue_record, self.builder, self.worker)
self.addCleanup(shut_down_default_process_pool)
# We overwrite the buildmaster root to use a temp directory.
@@ -385,7 +386,7 @@ class TestHandleStatusMixin:
def test_handleStatus_OK_normal_file(self):
# A filemap with plain filenames should not cause a problem.
# The call to handleStatus will attempt to get the file from
- # the slave resulting in a URL error in this test case.
+ # the worker resulting in a URL error in this test case.
with dbuser(config.builddmaster.dbuser):
yield self.behaviour.handleStatus(
self.build.buildqueue_record, 'OK',
@@ -467,7 +468,7 @@ class TestHandleStatusMixin:
def test_handleStatus_ABORTED_illegal_when_building(self):
self.builder.vm_host = "fake_vm_host"
self.behaviour = self.interactor.getBuildBehaviour(
- self.build.buildqueue_record, self.builder, self.slave)
+ self.build.buildqueue_record, self.builder, self.worker)
with dbuser(config.builddmaster.dbuser):
self.build.updateStatus(BuildStatus.BUILDING)
with ExpectedException(
diff --git a/lib/lp/buildmaster/tests/test_interactor.py b/lib/lp/buildmaster/tests/test_interactor.py
index 29901c2..30e86ed 100644
--- a/lib/lp/buildmaster/tests/test_interactor.py
+++ b/lib/lp/buildmaster/tests/test_interactor.py
@@ -50,15 +50,15 @@ from lp.buildmaster.manager import (
BaseBuilderFactory,
PrefetchedBuilderFactory,
)
-from lp.buildmaster.tests.mock_slaves import (
- AbortingSlave,
- BuildingSlave,
+from lp.buildmaster.tests.mock_workers import (
+ AbortingWorker,
+ BuildingWorker,
DeadProxy,
- LostBuildingBrokenSlave,
+ LostBuildingBrokenWorker,
MockBuilder,
- OkSlave,
- SlaveTestHelpers,
- WaitingSlave,
+ OkWorker,
+ WaitingWorker,
+ WorkerTestHelpers,
)
from lp.services.config import config
from lp.services.twistedsupport.testing import TReqFixture
@@ -193,12 +193,12 @@ class TestBuilderInteractorCleanSlave(TestCase):
run_tests_with = AsynchronousDeferredRunTest
@defer.inlineCallbacks
- def assertCleanCalls(self, builder, slave, calls, done):
+ def assertCleanCalls(self, builder, worker, calls, done):
actually_done = yield BuilderInteractor.cleanSlave(
- extract_vitals_from_db(builder), slave,
+ extract_vitals_from_db(builder), worker,
MockBuilderFactory(builder, None))
self.assertEqual(done, actually_done)
- self.assertEqual(calls, slave.method_log)
+ self.assertEqual(calls, worker.method_log)
@defer.inlineCallbacks
def test_virtual_1_1(self):
@@ -208,7 +208,7 @@ class TestBuilderInteractorCleanSlave(TestCase):
virtualized=True, clean_status=BuilderCleanStatus.DIRTY,
vm_host='lol', vm_reset_protocol=BuilderResetProtocol.PROTO_1_1)
yield self.assertCleanCalls(
- builder, OkSlave(), ['resume', 'echo'], True)
+ builder, OkWorker(), ['resume', 'echo'], True)
@defer.inlineCallbacks
def test_virtual_2_0_dirty(self):
@@ -218,7 +218,7 @@ class TestBuilderInteractorCleanSlave(TestCase):
builder = MockBuilder(
virtualized=True, clean_status=BuilderCleanStatus.DIRTY,
vm_host='lol', vm_reset_protocol=BuilderResetProtocol.PROTO_2_0)
- yield self.assertCleanCalls(builder, OkSlave(), ['resume'], False)
+ yield self.assertCleanCalls(builder, OkWorker(), ['resume'], False)
self.assertEqual(BuilderCleanStatus.CLEANING, builder.clean_status)
@defer.inlineCallbacks
@@ -229,7 +229,7 @@ class TestBuilderInteractorCleanSlave(TestCase):
builder = MockBuilder(
virtualized=True, clean_status=BuilderCleanStatus.CLEANING,
vm_host='lol', vm_reset_protocol=BuilderResetProtocol.PROTO_2_0)
- yield self.assertCleanCalls(builder, OkSlave(), [], False)
+ yield self.assertCleanCalls(builder, OkWorker(), [], False)
self.assertEqual(BuilderCleanStatus.CLEANING, builder.clean_status)
@defer.inlineCallbacks
@@ -243,42 +243,42 @@ class TestBuilderInteractorCleanSlave(TestCase):
with ExpectedException(
CannotResumeHost, "Invalid vm_reset_protocol: None"):
yield BuilderInteractor.cleanSlave(
- extract_vitals_from_db(builder), OkSlave(),
+ extract_vitals_from_db(builder), OkWorker(),
MockBuilderFactory(builder, None))
@defer.inlineCallbacks
def test_nonvirtual_idle(self):
- # An IDLE non-virtual slave is already as clean as we can get it.
+ # An IDLE non-virtual worker is already as clean as we can get it.
yield self.assertCleanCalls(
MockBuilder(
virtualized=False, clean_status=BuilderCleanStatus.DIRTY),
- OkSlave(), ['status'], True)
+ OkWorker(), ['status'], True)
@defer.inlineCallbacks
def test_nonvirtual_building(self):
- # A BUILDING non-virtual slave needs to be aborted. It'll go
+ # A BUILDING non-virtual worker needs to be aborted. It'll go
# through ABORTING and eventually be picked up from WAITING.
yield self.assertCleanCalls(
MockBuilder(
virtualized=False, clean_status=BuilderCleanStatus.DIRTY),
- BuildingSlave(), ['status', 'abort'], False)
+ BuildingWorker(), ['status', 'abort'], False)
@defer.inlineCallbacks
def test_nonvirtual_aborting(self):
- # An ABORTING non-virtual slave must be waited out. It should
+ # An ABORTING non-virtual worker must be waited out. It should
# hit WAITING eventually.
yield self.assertCleanCalls(
MockBuilder(
virtualized=False, clean_status=BuilderCleanStatus.DIRTY),
- AbortingSlave(), ['status'], False)
+ AbortingWorker(), ['status'], False)
@defer.inlineCallbacks
def test_nonvirtual_waiting(self):
- # A WAITING non-virtual slave just needs clean() called.
+ # A WAITING non-virtual worker just needs clean() called.
yield self.assertCleanCalls(
MockBuilder(
virtualized=False, clean_status=BuilderCleanStatus.DIRTY),
- WaitingSlave(), ['status', 'clean'], True)
+ WaitingWorker(), ['status', 'clean'], True)
@defer.inlineCallbacks
def test_nonvirtual_broken(self):
@@ -287,12 +287,12 @@ class TestBuilderInteractorCleanSlave(TestCase):
builder = MockBuilder(
virtualized=False, clean_status=BuilderCleanStatus.DIRTY)
vitals = extract_vitals_from_db(builder)
- slave = LostBuildingBrokenSlave()
+ worker = LostBuildingBrokenWorker()
try:
yield BuilderInteractor.cleanSlave(
- vitals, slave, MockBuilderFactory(builder, None))
+ vitals, worker, MockBuilderFactory(builder, None))
except xmlrpc.client.Fault:
- self.assertEqual(['status', 'abort'], slave.call_log)
+ self.assertEqual(['status', 'abort'], worker.call_log)
else:
self.fail("abort() should crash.")
@@ -304,10 +304,10 @@ class TestBuilderSlaveStatus(TestCase):
run_tests_with = AsynchronousDeferredRunTest
@defer.inlineCallbacks
- def assertStatus(self, slave, builder_status=None, build_status=None,
+ def assertStatus(self, worker, builder_status=None, build_status=None,
build_id=False, logtail=False, filemap=None,
dependencies=None):
- status = yield slave.status()
+ status = yield worker.status()
expected = {}
if builder_status is not None:
@@ -329,22 +329,22 @@ class TestBuilderSlaveStatus(TestCase):
self.assertEqual(expected, status)
- def test_status_idle_slave(self):
- self.assertStatus(OkSlave(), builder_status='BuilderStatus.IDLE')
+ def test_status_idle_worker(self):
+ self.assertStatus(OkWorker(), builder_status='BuilderStatus.IDLE')
- def test_status_building_slave(self):
+ def test_status_building_worker(self):
self.assertStatus(
- BuildingSlave(), builder_status='BuilderStatus.BUILDING',
+ BuildingWorker(), builder_status='BuilderStatus.BUILDING',
build_id=True, logtail=True)
- def test_status_waiting_slave(self):
+ def test_status_waiting_worker(self):
self.assertStatus(
- WaitingSlave(), builder_status='BuilderStatus.WAITING',
+ WaitingWorker(), builder_status='BuilderStatus.WAITING',
build_status='BuildStatus.OK', build_id=True, filemap={})
- def test_status_aborting_slave(self):
+ def test_status_aborting_worker(self):
self.assertStatus(
- AbortingSlave(), builder_status='BuilderStatus.ABORTING',
+ AbortingWorker(), builder_status='BuilderStatus.ABORTING',
build_id=True)
@@ -365,21 +365,21 @@ class TestBuilderInteractorDB(TestCaseWithFactory):
# Set the builder attribute on the buildqueue record so that our
# builder will think it has a current build.
builder = self.factory.makeBuilder(name='builder')
- slave = BuildingSlave()
+ worker = BuildingWorker()
build = self.factory.makeBinaryPackageBuild()
bq = build.queueBuild()
bq.markAsBuilding(builder)
- behaviour = BuilderInteractor.getBuildBehaviour(bq, builder, slave)
+ behaviour = BuilderInteractor.getBuildBehaviour(bq, builder, worker)
self.assertIsInstance(behaviour, BinaryPackageBuildBehaviour)
self.assertEqual(behaviour._builder, builder)
- self.assertEqual(behaviour._slave, slave)
+ self.assertEqual(behaviour._slave, worker)
def _setupBuilder(self):
processor = self.factory.makeProcessor(name="i386")
builder = self.factory.makeBuilder(
processors=[processor], virtualized=True, vm_host="bladh")
builder.setCleanStatus(BuilderCleanStatus.CLEAN)
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkSlave()))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkWorker()))
distroseries = self.factory.makeDistroSeries()
das = self.factory.makeDistroArchSeries(
distroseries=distroseries, architecturetag="i386",
@@ -416,7 +416,7 @@ class TestBuilderInteractorDB(TestCaseWithFactory):
builder_factory.findBuildCandidate = FakeMethod(result=candidate)
vitals = extract_vitals_from_db(builder)
d = BuilderInteractor.findAndStartJob(
- vitals, builder, OkSlave(), builder_factory)
+ vitals, builder, OkWorker(), builder_factory)
return d.addCallback(self.assertEqual, candidate)
@defer.inlineCallbacks
@@ -443,7 +443,7 @@ class TestBuilderInteractorDB(TestCaseWithFactory):
# Starting a job selects a non-superseded candidate, and supersedes
# the candidates that have superseded source packages.
candidate = yield BuilderInteractor.findAndStartJob(
- vitals, builder, OkSlave(), builder_factory)
+ vitals, builder, OkWorker(), builder_factory)
self.assertEqual(candidates[2], candidate)
self.assertEqual(
[BuildStatus.SUPERSEDED, BuildStatus.SUPERSEDED,
@@ -460,7 +460,7 @@ class TestBuilderInteractorDB(TestCaseWithFactory):
builder_factory.findBuildCandidate = FakeMethod(result=candidate)
vitals = extract_vitals_from_db(builder)
d = BuilderInteractor.findAndStartJob(
- vitals, builder, OkSlave(), builder_factory)
+ vitals, builder, OkWorker(), builder_factory)
def check_build_started(candidate):
self.assertEqual(candidate.builder, builder)
@@ -481,7 +481,7 @@ class TestBuilderInteractorDB(TestCaseWithFactory):
BuildDaemonIsolationError,
"Attempted to start build on a dirty slave."):
yield BuilderInteractor.findAndStartJob(
- vitals, builder, OkSlave(), builder_factory)
+ vitals, builder, OkWorker(), builder_factory)
@defer.inlineCallbacks
def test_findAndStartJob_dirties_slave(self):
@@ -492,31 +492,31 @@ class TestBuilderInteractorDB(TestCaseWithFactory):
builder_factory.findBuildCandidate = FakeMethod(result=candidate)
vitals = extract_vitals_from_db(builder)
yield BuilderInteractor.findAndStartJob(
- vitals, builder, OkSlave(), builder_factory)
+ vitals, builder, OkWorker(), builder_factory)
self.assertEqual(BuilderCleanStatus.DIRTY, builder.clean_status)
-class TestSlave(TestCase):
+class TestWorker(TestCase):
"""
Integration tests for BuilderSlave that verify how it works against a
- real slave server.
+ real worker server.
"""
run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30)
def setUp(self):
super().setUp()
- self.slave_helper = self.useFixture(SlaveTestHelpers())
+ self.worker_helper = self.useFixture(WorkerTestHelpers())
self.addCleanup(shut_down_default_process_pool)
@defer.inlineCallbacks
def test_abort(self):
- slave = self.slave_helper.getClientSlave()
+ worker = self.worker_helper.getClientWorker()
# We need to be in a BUILDING state before we can abort.
build_id = 'some-id'
- response = yield self.slave_helper.triggerGoodBuild(slave, build_id)
+ response = yield self.worker_helper.triggerGoodBuild(worker, build_id)
self.assertEqual([BuilderStatus.BUILDING, build_id], response)
- response = yield slave.abort()
+ response = yield worker.abort()
self.assertEqual(BuilderStatus.ABORTING, response)
@defer.inlineCallbacks
@@ -525,36 +525,36 @@ class TestSlave(TestCase):
# valid chroot & filemaps works and returns a BuilderStatus of
# BUILDING.
build_id = 'some-id'
- slave = self.slave_helper.getClientSlave()
- response = yield self.slave_helper.triggerGoodBuild(slave, build_id)
+ worker = self.worker_helper.getClientWorker()
+ response = yield self.worker_helper.triggerGoodBuild(worker, build_id)
self.assertEqual([BuilderStatus.BUILDING, build_id], response)
def test_clean(self):
- slave = self.slave_helper.getClientSlave()
- # XXX: JonathanLange 2010-09-21: Calling clean() on the slave requires
+ worker = self.worker_helper.getClientWorker()
+ # XXX: JonathanLange 2010-09-21: Calling clean() on the worker requires
# it to be in either the WAITING or ABORTED states, and both of these
# states are very difficult to achieve in a test environment. For the
# time being, we'll just assert that a clean attribute exists.
- self.assertNotEqual(getattr(slave, 'clean', None), None)
+ self.assertNotEqual(getattr(worker, 'clean', None), None)
@defer.inlineCallbacks
def test_echo(self):
# Calling 'echo' contacts the server which returns the arguments we
# gave it.
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
- response = yield slave.echo('foo', 'bar', 42)
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
+ response = yield worker.echo('foo', 'bar', 42)
self.assertEqual(['foo', 'bar', 42], response)
@defer.inlineCallbacks
def test_info(self):
- # Calling 'info' gets some information about the slave.
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
- info = yield slave.info()
+ # Calling 'info' gets some information about the worker.
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
+ info = yield worker.info()
# We're testing the hard-coded values, since the version is hard-coded
- # into the remote slave, the supported build managers are hard-coded
- # into the tac file for the remote slave and config is returned from
+ # into the remote worker, the supported build managers are hard-coded
+ # into the tac file for the remote worker and config is returned from
# the configuration file.
self.assertEqual(3, len(info))
self.assertEqual(['1.0', 'i386'], info[:2])
@@ -566,22 +566,22 @@ class TestSlave(TestCase):
@defer.inlineCallbacks
def test_initial_status(self):
- # Calling 'status' returns the current status of the slave. The
+ # Calling 'status' returns the current status of the worker. The
# initial status is IDLE.
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
- status = yield slave.status()
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
+ status = yield worker.status()
self.assertEqual(BuilderStatus.IDLE, status['builder_status'])
@defer.inlineCallbacks
def test_status_after_build(self):
- # Calling 'status' returns the current status of the slave. After a
+ # Calling 'status' returns the current status of the worker. After a
# build has been triggered, the status is BUILDING.
- slave = self.slave_helper.getClientSlave()
+ worker = self.worker_helper.getClientWorker()
build_id = 'status-build-id'
- response = yield self.slave_helper.triggerGoodBuild(slave, build_id)
+ response = yield self.worker_helper.triggerGoodBuild(worker, build_id)
self.assertEqual([BuilderStatus.BUILDING, build_id], response)
- status = yield slave.status()
+ status = yield worker.status()
self.assertEqual(BuilderStatus.BUILDING, status['builder_status'])
self.assertEqual(build_id, status['build_id'])
self.assertIsInstance(status['logtail'], xmlrpc.client.Binary)
@@ -589,58 +589,58 @@ class TestSlave(TestCase):
@defer.inlineCallbacks
def test_ensurepresent_not_there(self):
# ensurepresent checks to see if a file is there.
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
- response = yield slave.ensurepresent('blahblah', None, None, None)
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
+ response = yield worker.ensurepresent('blahblah', None, None, None)
self.assertEqual([False, 'No URL'], response)
@defer.inlineCallbacks
def test_ensurepresent_actually_there(self):
# ensurepresent checks to see if a file is there.
- tachandler = self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
- self.slave_helper.makeCacheFile(tachandler, 'blahblah')
- response = yield slave.ensurepresent('blahblah', None, None, None)
+ tachandler = self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
+ self.worker_helper.makeCacheFile(tachandler, 'blahblah')
+ response = yield worker.ensurepresent('blahblah', None, None, None)
self.assertEqual([True, 'No URL'], response)
def test_sendFileToSlave_not_there(self):
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
- d = slave.sendFileToSlave('blahblah', None, None, None)
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
+ d = worker.sendFileToSlave('blahblah', None, None, None)
return assert_fails_with(d, CannotFetchFile)
@defer.inlineCallbacks
def test_sendFileToSlave_actually_there(self):
- tachandler = self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
- self.slave_helper.makeCacheFile(tachandler, 'blahblah')
- yield slave.sendFileToSlave('blahblah', None, None, None)
- response = yield slave.ensurepresent('blahblah', None, None, None)
+ tachandler = self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
+ self.worker_helper.makeCacheFile(tachandler, 'blahblah')
+ yield worker.sendFileToSlave('blahblah', None, None, None)
+ response = yield worker.ensurepresent('blahblah', None, None, None)
self.assertEqual([True, 'No URL'], response)
@defer.inlineCallbacks
def test_resumeHost_success(self):
# On a successful resume resume() fires the returned deferred
# callback with (stdout, stderr, subprocess exit code).
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
# The configuration testing command-line.
self.assertEqual(
'echo %(vm_host)s', config.builddmaster.vm_resume_command)
- out, err, code = yield slave.resume()
+ out, err, code = yield worker.resume()
self.assertEqual(os.EX_OK, code)
# XXX: JonathanLange 2010-09-23: We should instead pass the
- # expected vm_host into the client slave. Not doing this now,
- # since the SlaveHelper is being moved around.
- self.assertEqual("%s\n" % slave._vm_host, six.ensure_str(out))
+ # expected vm_host into the client worker. Not doing this now,
+ # since the WorkerHelper is being moved around.
+ self.assertEqual("%s\n" % worker._vm_host, six.ensure_str(out))
def test_resumeHost_failure(self):
# On a failed resume, 'resumeHost' fires the returned deferred
# errorback with the `ProcessTerminated` failure.
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
# Override the configuration command-line with one that will fail.
failed_config = """
@@ -656,7 +656,7 @@ class TestSlave(TestCase):
out, err, code = failure.value
# The process will exit with a return code of "1".
self.assertEqual(code, 1)
- d = slave.resume()
+ d = worker.resume()
d.addBoth(check_resume_failure)
return d
@@ -673,8 +673,8 @@ class TestSlave(TestCase):
config.push('timeout_resume_command', timeout_config)
self.addCleanup(config.pop, 'timeout_resume_command')
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
# On timeouts, the response is a twisted `Failure` object containing
# a `TimeoutError` error.
@@ -683,7 +683,7 @@ class TestSlave(TestCase):
out, err, code = failure.value
self.assertEqual(code, signal.SIGKILL)
clock = Clock()
- d = slave.resume(clock=clock)
+ d = worker.resume(clock=clock)
# Move the clock beyond the socket_timeout but earlier than the
# sleep 5. This stops the test having to wait for the timeout.
# Fast tests FTW!
@@ -692,7 +692,7 @@ class TestSlave(TestCase):
return d
-class TestSlaveTimeouts(TestCase):
+class TestWorkerTimeouts(TestCase):
# Testing that the methods that call callRemote() all time out
# as required.
@@ -701,10 +701,10 @@ class TestSlaveTimeouts(TestCase):
def setUp(self):
super().setUp()
- self.slave_helper = self.useFixture(SlaveTestHelpers())
+ self.worker_helper = self.useFixture(WorkerTestHelpers())
self.clock = Clock()
self.proxy = DeadProxy(b"url")
- self.slave = self.slave_helper.getClientSlave(
+ self.worker = self.worker_helper.getClientWorker(
reactor=self.clock, proxy=self.proxy)
self.addCleanup(shut_down_default_process_pool)
@@ -713,31 +713,31 @@ class TestSlaveTimeouts(TestCase):
return assert_fails_with(d, defer.CancelledError)
def test_timeout_abort(self):
- return self.assertCancelled(self.slave.abort())
+ return self.assertCancelled(self.worker.abort())
def test_timeout_clean(self):
- return self.assertCancelled(self.slave.clean())
+ return self.assertCancelled(self.worker.clean())
def test_timeout_echo(self):
- return self.assertCancelled(self.slave.echo())
+ return self.assertCancelled(self.worker.echo())
def test_timeout_info(self):
- return self.assertCancelled(self.slave.info())
+ return self.assertCancelled(self.worker.info())
def test_timeout_status(self):
- return self.assertCancelled(self.slave.status())
+ return self.assertCancelled(self.worker.status())
def test_timeout_ensurepresent(self):
return self.assertCancelled(
- self.slave.ensurepresent(None, None, None, None),
+ self.worker.ensurepresent(None, None, None, None),
config.builddmaster.socket_timeout * 5)
def test_timeout_build(self):
return self.assertCancelled(
- self.slave.build(None, None, None, None, None))
+ self.worker.build(None, None, None, None, None))
-class TestSlaveConnectionTimeouts(TestCase):
+class TestWorkerConnectionTimeouts(TestCase):
# Testing that we can override the default 30 second connection
# timeout.
@@ -748,7 +748,7 @@ class TestSlaveConnectionTimeouts(TestCase):
def setUp(self):
super().setUp()
- self.slave_helper = self.useFixture(SlaveTestHelpers())
+ self.worker_helper = self.useFixture(WorkerTestHelpers())
self.clock = Clock()
self.addCleanup(shut_down_default_process_pool)
@@ -757,8 +757,8 @@ class TestSlaveConnectionTimeouts(TestCase):
# only the config value should.
self.pushConfig('builddmaster', socket_timeout=180)
- slave = self.slave_helper.getClientSlave(reactor=self.clock)
- d = slave.echo()
+ worker = self.worker_helper.getClientWorker(reactor=self.clock)
+ d = worker.echo()
# Advance past the 30 second timeout. The real reactor will
# never call connectTCP() since we're not spinning it up. This
# avoids "connection refused" errors and simulates an
@@ -771,7 +771,7 @@ class TestSlaveConnectionTimeouts(TestCase):
return assert_fails_with(d, defer.CancelledError)
-class TestSlaveWithLibrarian(TestCaseWithFactory):
+class TestWorkerWithLibrarian(TestCaseWithFactory):
"""Tests that need more of Launchpad to run."""
layer = LaunchpadZopelessLayer
@@ -780,7 +780,7 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
def setUp(self):
super().setUp()
- self.slave_helper = self.useFixture(SlaveTestHelpers())
+ self.worker_helper = self.useFixture(WorkerTestHelpers())
self.addCleanup(shut_down_default_process_pool)
def test_ensurepresent_librarian(self):
@@ -792,15 +792,15 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
lf = self.factory.makeLibraryFileAlias(
'HelloWorld.txt', content="Hello World")
self.layer.txn.commit()
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
- d = slave.ensurepresent(lf.content.sha1, lf.http_url, "", "")
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
+ d = worker.ensurepresent(lf.content.sha1, lf.http_url, "", "")
d.addCallback(self.assertEqual, [True, 'Download'])
return d
@defer.inlineCallbacks
def test_retrieve_files_from_filecache(self):
- # Files that are present on the slave can be downloaded with a
+ # Files that are present on the worker can be downloaded with a
# filename made from the sha1 of the content underneath the
# 'filecache' directory.
from twisted.internet import reactor
@@ -809,10 +809,10 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
'HelloWorld.txt', content=content)
self.layer.txn.commit()
expected_url = '%s/filecache/%s' % (
- self.slave_helper.base_url, lf.content.sha1)
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
- yield slave.ensurepresent(lf.content.sha1, lf.http_url, "", "")
+ self.worker_helper.base_url, lf.content.sha1)
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
+ yield worker.ensurepresent(lf.content.sha1, lf.http_url, "", "")
client = self.useFixture(TReqFixture(reactor)).client
response = yield client.get(expected_url).addCallback(check_status)
got_content = yield treq.content(response)
@@ -824,8 +824,8 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
# separately because it increases test run time and it's going
# away at some point anyway, in favour of getFiles().
contents = ["content1", "content2", "content3"]
- self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
+ self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
files = []
content_map = {}
@@ -837,7 +837,7 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
self.assertEqual(content_map[sha1], f.read())
def finished_uploading(ignored):
- d = slave.getFiles(files)
+ d = worker.getFiles(files)
return d.addCallback(got_files)
# Set up some files on the builder and store details in
@@ -854,7 +854,7 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
files.append((lf.content.sha1, tempfile.mkstemp()[1]))
self.addCleanup(os.remove, files[-1][1])
self.layer.txn.commit()
- d = slave.ensurepresent(lf.content.sha1, lf.http_url, "", "")
+ d = worker.ensurepresent(lf.content.sha1, lf.http_url, "", "")
dl.append(d)
return defer.DeferredList(dl).addCallback(finished_uploading)
@@ -863,11 +863,11 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
# getFiles honours the configured limit on active download
# connections.
contents = [self.factory.getUniqueString() for _ in range(10)]
- self.slave_helper.getServerSlave()
+ self.worker_helper.getServerWorker()
process_pool = make_download_process_pool(min=1, max=2)
process_pool.start()
self.addCleanup(process_pool.stop)
- slave = self.slave_helper.getClientSlave(process_pool=process_pool)
+ worker = self.worker_helper.getClientWorker(process_pool=process_pool)
files = []
content_map = {}
@@ -881,7 +881,7 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
self.assertEqual(2, len(process_pool.processes))
def finished_uploading(ignored):
- d = slave.getFiles(files)
+ d = worker.getFiles(files)
return d.addCallback(got_files)
# Set up some files on the builder and store details in
@@ -894,7 +894,7 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
files.append((lf.content.sha1, tempfile.mkstemp()[1]))
self.addCleanup(os.remove, files[-1][1])
self.layer.txn.commit()
- d = slave.ensurepresent(lf.content.sha1, lf.http_url, "", "")
+ d = worker.ensurepresent(lf.content.sha1, lf.http_url, "", "")
dl.append(d)
return defer.DeferredList(dl).addCallback(finished_uploading)
@@ -902,12 +902,12 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
@defer.inlineCallbacks
def test_getFiles_with_empty_file(self):
# getFiles works with zero-length files.
- tachandler = self.slave_helper.getServerSlave()
- slave = self.slave_helper.getClientSlave()
+ tachandler = self.worker_helper.getServerWorker()
+ worker = self.worker_helper.getClientWorker()
temp_fd, temp_name = tempfile.mkstemp()
self.addCleanup(os.remove, temp_name)
empty_sha1 = hashlib.sha1(b'').hexdigest()
- self.slave_helper.makeCacheFile(tachandler, empty_sha1, contents=b'')
- yield slave.getFiles([(empty_sha1, temp_name)])
+ self.worker_helper.makeCacheFile(tachandler, empty_sha1, contents=b'')
+ yield worker.getFiles([(empty_sha1, temp_name)])
with open(temp_name, 'rb') as f:
self.assertEqual(b'', f.read())
diff --git a/lib/lp/buildmaster/tests/test_manager.py b/lib/lp/buildmaster/tests/test_manager.py
index e058811..24814bd 100644
--- a/lib/lp/buildmaster/tests/test_manager.py
+++ b/lib/lp/buildmaster/tests/test_manager.py
@@ -51,15 +51,15 @@ from lp.buildmaster.manager import (
SlaveScanner,
)
from lp.buildmaster.tests.harness import BuilddManagerTestSetup
-from lp.buildmaster.tests.mock_slaves import (
- BrokenSlave,
- BuildingSlave,
- LostBuildingBrokenSlave,
+from lp.buildmaster.tests.mock_workers import (
+ BrokenWorker,
+ BuildingWorker,
+ LostBuildingBrokenWorker,
make_publisher,
MockBuilder,
- OkSlave,
+ OkWorker,
TrivialBehaviour,
- WaitingSlave,
+ WaitingWorker,
)
from lp.buildmaster.tests.test_interactor import (
FakeBuildQueue,
@@ -164,7 +164,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
# Reset sampledata builder.
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
self._resetBuilder(builder)
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkSlave()))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkWorker()))
# Set this to 1 here so that _checkDispatch can make sure it's
# reset to 0 after a successful dispatch.
builder.failure_count = 1
@@ -205,7 +205,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
self.patch(
BuilderSlave, 'makeBuilderSlave',
- FakeMethod(BuildingSlave(build_id='PACKAGEBUILD-8')))
+ FakeMethod(BuildingWorker(build_id='PACKAGEBUILD-8')))
self.assertTrue(builder.builderok)
job = builder.currentjob
self.assertBuildingJob(job, builder)
@@ -244,7 +244,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
login('foo.bar@xxxxxxxxxxxxx')
builder.builderok = True
self.patch(BuilderSlave, 'makeBuilderSlave',
- FakeMethod(BuildingSlave(build_id='PACKAGEBUILD-8')))
+ FakeMethod(BuildingWorker(build_id='PACKAGEBUILD-8')))
transaction.commit()
login(ANONYMOUS)
@@ -263,7 +263,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
factory = LaunchpadObjectFactory()
builder = factory.makeBuilder()
builder.setCleanStatus(BuilderCleanStatus.CLEAN)
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkSlave()))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkWorker()))
transaction.commit()
scanner = self._getScanner(builder_name=builder.name)
yield scanner.scan()
@@ -274,7 +274,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
# Reset sampledata builder.
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
self._resetBuilder(builder)
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkSlave()))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkWorker()))
builder.manual = True
transaction.commit()
scanner = self._getScanner()
@@ -286,7 +286,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
# Reset sampledata builder.
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
self._resetBuilder(builder)
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkSlave()))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkWorker()))
builder.builderok = False
transaction.commit()
scanner = self._getScanner()
@@ -299,7 +299,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
self._resetBuilder(builder)
self.patch(
- BuilderSlave, 'makeBuilderSlave', FakeMethod(BrokenSlave()))
+ BuilderSlave, 'makeBuilderSlave', FakeMethod(BrokenWorker()))
builder.failure_count = 0
transaction.commit()
scanner = self._getScanner(builder_name=builder.name)
@@ -310,7 +310,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
def test_scan_of_partial_utf8_logtail(self):
# The builder returns a fixed number of bytes from the tail of the
# log, so the first character can easily end up being invalid UTF-8.
- class BrokenUTF8Slave(BuildingSlave):
+ class BrokenUTF8Worker(BuildingWorker):
@defer.inlineCallbacks
def status(self):
status = yield super().status()
@@ -322,7 +322,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
builder.builderok = True
self.patch(
BuilderSlave, 'makeBuilderSlave',
- FakeMethod(BrokenUTF8Slave(build_id='PACKAGEBUILD-8')))
+ FakeMethod(BrokenUTF8Worker(build_id='PACKAGEBUILD-8')))
transaction.commit()
login(ANONYMOUS)
@@ -339,7 +339,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
def test_scan_of_logtail_containing_nul(self):
# PostgreSQL text columns can't store ASCII NUL (\0) characters, so
# we make sure to filter those out of the logtail.
- class NULSlave(BuildingSlave):
+ class NULWorker(BuildingWorker):
@defer.inlineCallbacks
def status(self):
status = yield super().status()
@@ -351,7 +351,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
builder.builderok = True
self.patch(
BuilderSlave, 'makeBuilderSlave',
- FakeMethod(NULSlave(build_id='PACKAGEBUILD-8')))
+ FakeMethod(NULWorker(build_id='PACKAGEBUILD-8')))
transaction.commit()
login(ANONYMOUS)
@@ -418,7 +418,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
def test_scan_of_snap_build(self):
# Snap builds return additional status information, which the scan
# collects.
- class SnapBuildingSlave(BuildingSlave):
+ class SnapBuildingWorker(BuildingWorker):
revision_id = None
@defer.inlineCallbacks
@@ -433,15 +433,15 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
builder = self.factory.makeBuilder(
processors=[job.processor], vm_host="fake_vm_host")
job.markAsBuilding(builder)
- slave = SnapBuildingSlave(build_id="SNAPBUILD-%d" % build.id)
- self.patch(BuilderSlave, "makeBuilderSlave", FakeMethod(slave))
+ worker = SnapBuildingWorker(build_id="SNAPBUILD-%d" % build.id)
+ self.patch(BuilderSlave, "makeBuilderSlave", FakeMethod(worker))
transaction.commit()
scanner = self._getScanner(builder_name=builder.name)
yield scanner.scan()
yield scanner.manager.flushLogTails()
self.assertBuildingJob(job, builder, logtail="This is a build log: 0")
self.assertIsNone(build.revision_id)
- slave.revision_id = "dummy"
+ worker.revision_id = "dummy"
scanner = self._getScanner(builder_name=builder.name)
yield scanner.scan()
yield scanner.manager.flushLogTails()
@@ -538,12 +538,12 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
@defer.inlineCallbacks
def test_fail_to_resume_leaves_it_dirty(self):
- # If an attempt to resume a slave fails, its failure count is
+ # If an attempt to resume a worker fails, its failure count is
# incremented and it is left DIRTY.
- # Make a slave with a failing resume() method.
- slave = OkSlave()
- slave.resume = lambda: deferLater(
+ # Make a worker with a failing resume() method.
+ worker = OkWorker()
+ worker.resume = lambda: deferLater(
reactor, 0, defer.fail, Failure(('out', 'err', 1)))
# Reset sampledata builder.
@@ -553,7 +553,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
builder.setCleanStatus(BuilderCleanStatus.DIRTY)
builder.virtualized = True
self.assertEqual(0, builder.failure_count)
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(slave))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(worker))
builder.vm_host = "fake_vm_host"
transaction.commit()
@@ -587,20 +587,20 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
self.assertEqual(BuildStatus.FAILEDTOBUILD, build.status)
@defer.inlineCallbacks
- def test_update_slave_version(self):
- # If the reported slave version differs from the DB's record of it,
+ def test_update_worker_version(self):
+ # If the reported worker version differs from the DB's record of it,
# then scanning the builder updates the DB.
- slave = OkSlave(version="100")
+ worker = OkWorker(version="100")
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
builder.version = "99"
self._resetBuilder(builder)
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(slave))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(worker))
scanner = self._getScanner()
yield scanner.scan()
self.assertEqual("100", builder.version)
def test_updateVersion_no_op(self):
- # If the slave version matches the DB, then updateVersion does not
+ # If the worker version matches the DB, then updateVersion does not
# touch the DB.
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
builder.version = "100"
@@ -617,21 +617,21 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
# then the build should be aborted, and eventually stopped and moved
# to the CANCELLED state if it does not abort by itself.
- # Set up a mock building slave.
- slave = BuildingSlave()
+ # Set up a mock building worker.
+ worker = BuildingWorker()
- # Set the sample data builder building with the slave from above.
+ # Set the sample data builder building with the worker from above.
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
login('foo.bar@xxxxxxxxxxxxx')
builder.builderok = True
# For now, we can only cancel virtual builds.
builder.virtualized = True
builder.vm_host = "fake_vm_host"
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(slave))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(worker))
transaction.commit()
login(ANONYMOUS)
buildqueue = builder.currentjob
- slave.build_id = buildqueue.build_cookie
+ worker.build_id = buildqueue.build_cookie
self.assertBuildingJob(buildqueue, builder)
# Now set the build to CANCELLING.
@@ -645,21 +645,21 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
yield scanner.scan()
# An abort request should be sent.
- self.assertEqual(1, slave.call_log.count("abort"))
+ self.assertEqual(1, worker.call_log.count("abort"))
self.assertEqual(BuildStatus.CANCELLING, build.status)
# Advance time a little. Nothing much should happen.
clock.advance(1)
yield scanner.scan()
- self.assertEqual(1, slave.call_log.count("abort"))
+ self.assertEqual(1, worker.call_log.count("abort"))
self.assertEqual(BuildStatus.CANCELLING, build.status)
# Advance past the timeout. The build state should be cancelled and
- # we should have also called the resume() method on the slave that
+ # we should have also called the resume() method on the worker that
# resets the virtual machine.
clock.advance(SlaveScanner.CANCEL_TIMEOUT)
yield scanner.singleCycle()
- self.assertEqual(1, slave.call_log.count("abort"))
+ self.assertEqual(1, worker.call_log.count("abort"))
self.assertEqual(BuilderCleanStatus.DIRTY, builder.clean_status)
self.assertEqual(BuildStatus.CANCELLED, build.status)
@@ -701,38 +701,38 @@ class TestSlaveScannerWithLibrarian(TestCaseWithFactory):
# And create a SlaveScanner with a slave and a clock that we
# control.
- get_slave = FakeMethod(OkSlave())
+ get_worker = FakeMethod(OkWorker())
clock = task.Clock()
manager = BuilddManager(clock=clock)
manager.logger = BufferLogger()
scanner = SlaveScanner(
builder.name, BuilderFactory(), manager, BufferLogger(),
- slave_factory=get_slave, clock=clock)
+ slave_factory=get_worker, clock=clock)
- # The slave is idle and dirty, so the first scan will clean it
+ # The worker is idle and dirty, so the first scan will clean it
# with a reset.
self.assertEqual(BuilderCleanStatus.DIRTY, builder.clean_status)
yield scanner.scan()
- self.assertEqual(['resume', 'echo'], get_slave.result.method_log)
+ self.assertEqual(['resume', 'echo'], get_worker.result.method_log)
self.assertEqual(BuilderCleanStatus.CLEAN, builder.clean_status)
self.assertIs(None, builder.currentjob)
- # The slave is idle and clean, and there's a build candidate, so
+ # The worker is idle and clean, and there's a build candidate, so
# the next scan will dispatch the build.
- get_slave.result = OkSlave()
+ get_worker.result = OkWorker()
yield scanner.scan()
self.assertEqual(
['status', 'ensurepresent', 'build'],
- get_slave.result.method_log)
+ get_worker.result.method_log)
self.assertEqual(bq, builder.currentjob)
self.assertEqual(BuildQueueStatus.RUNNING, bq.status)
self.assertEqual(BuildStatus.BUILDING, build.status)
self.assertEqual(BuilderCleanStatus.DIRTY, builder.clean_status)
- # build() has been called, so switch in a BUILDING slave.
+ # build() has been called, so switch in a BUILDING worker.
# Scans will now just do a status() each, as the logtail is
# updated.
- get_slave.result = BuildingSlave(build.build_cookie)
+ get_worker.result = BuildingWorker(build.build_cookie)
yield scanner.scan()
yield scanner.manager.flushLogTails()
self.assertEqual("This is a build log: 0", bq.logtail)
@@ -743,43 +743,43 @@ class TestSlaveScannerWithLibrarian(TestCaseWithFactory):
yield scanner.manager.flushLogTails()
self.assertEqual("This is a build log: 2", bq.logtail)
self.assertEqual(
- ['status', 'status', 'status'], get_slave.result.method_log)
+ ['status', 'status', 'status'], get_worker.result.method_log)
# When the build finishes, the scanner will notice and call
# handleStatus(). Our fake handleSuccess() doesn't do anything
# special, but there'd usually be file retrievals in the middle,
# and the log is retrieved by handleStatus() afterwards.
# The builder remains dirty afterward.
- get_slave.result = WaitingSlave(build_id=build.build_cookie)
+ get_worker.result = WaitingWorker(build_id=build.build_cookie)
yield scanner.scan()
- self.assertEqual(['status', 'getFile'], get_slave.result.method_log)
+ self.assertEqual(['status', 'getFile'], get_worker.result.method_log)
self.assertIs(None, builder.currentjob)
self.assertEqual(BuildStatus.UPLOADING, build.status)
self.assertEqual(builder, build.builder)
self.assertEqual(BuilderCleanStatus.DIRTY, builder.clean_status)
- # We're idle and dirty, so let's flip back to an idle slave and
- # confirm that the slave gets cleaned.
- get_slave.result = OkSlave()
+ # We're idle and dirty, so let's flip back to an idle worker and
+ # confirm that the worker gets cleaned.
+ get_worker.result = OkWorker()
yield scanner.scan()
- self.assertEqual(['resume', 'echo'], get_slave.result.method_log)
+ self.assertEqual(['resume', 'echo'], get_worker.result.method_log)
self.assertIs(None, builder.currentjob)
self.assertEqual(BuilderCleanStatus.CLEAN, builder.clean_status)
# Now we can go round the loop again with a second build. (We only
# go far enough to ensure that the lost-job check works on the
# second iteration.)
- get_slave.result = OkSlave()
+ get_worker.result = OkWorker()
yield scanner.scan()
self.assertEqual(
['status', 'ensurepresent', 'build'],
- get_slave.result.method_log)
+ get_worker.result.method_log)
self.assertEqual(bq2, builder.currentjob)
self.assertEqual(BuildQueueStatus.RUNNING, bq2.status)
self.assertEqual(BuildStatus.BUILDING, build2.status)
self.assertEqual(BuilderCleanStatus.DIRTY, builder.clean_status)
- get_slave.result = BuildingSlave(build2.build_cookie)
+ get_worker.result = BuildingWorker(build2.build_cookie)
yield scanner.scan()
yield scanner.manager.flushLogTails()
self.assertEqual("This is a build log: 0", bq2.logtail)
@@ -932,7 +932,7 @@ class TestSlaveScannerWithoutDB(TestCase):
super().setUp()
self.addCleanup(shut_down_default_process_pool)
- def getScanner(self, builder_factory=None, interactor=None, slave=None,
+ def getScanner(self, builder_factory=None, interactor=None, worker=None,
behaviour=None):
if builder_factory is None:
builder_factory = MockBuilderFactory(
@@ -940,46 +940,46 @@ class TestSlaveScannerWithoutDB(TestCase):
if interactor is None:
interactor = BuilderInteractor()
interactor.updateBuild = FakeMethod()
- if slave is None:
- slave = OkSlave()
+ if worker is None:
+ worker = OkWorker()
if behaviour is None:
behaviour = TrivialBehaviour()
return SlaveScanner(
'mock', builder_factory, FakeBuilddManager(), BufferLogger(),
interactor_factory=FakeMethod(interactor),
- slave_factory=FakeMethod(slave),
+ slave_factory=FakeMethod(worker),
behaviour_factory=FakeMethod(behaviour))
@defer.inlineCallbacks
def test_scan_with_job(self):
# SlaveScanner.scan calls updateBuild() when a job is building.
- slave = BuildingSlave('trivial')
+ worker = BuildingWorker('trivial')
bq = FakeBuildQueue('trivial')
scanner = self.getScanner(
builder_factory=MockBuilderFactory(MockBuilder(), bq),
- slave=slave)
+ worker=worker)
yield scanner.scan()
- self.assertEqual(['status'], slave.call_log)
+ self.assertEqual(['status'], worker.call_log)
self.assertEqual(
1, scanner.interactor_factory.result.updateBuild.call_count)
self.assertEqual(0, bq.reset.call_count)
@defer.inlineCallbacks
- def test_scan_recovers_lost_slave_with_job(self):
- # SlaveScanner.scan identifies slaves that aren't building what
- # they should be, resets the jobs, and then aborts the slaves.
- slave = BuildingSlave('nontrivial')
+ def test_scan_recovers_lost_worker_with_job(self):
+ # SlaveScanner.scan identifies workers that aren't building what
+ # they should be, resets the jobs, and then aborts the workers.
+ worker = BuildingWorker('nontrivial')
bq = FakeBuildQueue('trivial')
builder = MockBuilder(virtualized=False)
scanner = self.getScanner(
builder_factory=MockBuilderFactory(builder, bq),
- slave=slave)
+ worker=worker)
- # A single scan will call status(), notice that the slave is lost,
+ # A single scan will call status(), notice that the worker is lost,
# and reset() the job without calling updateBuild().
yield scanner.scan()
- self.assertEqual(['status'], slave.call_log)
+ self.assertEqual(['status'], worker.call_log)
self.assertEqual(
0, scanner.interactor_factory.result.updateBuild.call_count)
self.assertEqual(1, bq.reset.call_count)
@@ -987,50 +987,50 @@ class TestSlaveScannerWithoutDB(TestCase):
scanner.builder_factory.updateTestData(builder, None)
# The next scan will see a dirty idle builder with a BUILDING
- # slave, and abort() it.
+ # worker, and abort() it.
yield scanner.scan()
- self.assertEqual(['status', 'status', 'abort'], slave.call_log)
+ self.assertEqual(['status', 'status', 'abort'], worker.call_log)
@defer.inlineCallbacks
- def test_scan_recovers_lost_slave_when_idle(self):
- # SlaveScanner.scan identifies slaves that are building when
+ def test_scan_recovers_lost_worker_when_idle(self):
+ # SlaveScanner.scan identifies workers that are building when
# they shouldn't be and aborts them.
- slave = BuildingSlave()
- scanner = self.getScanner(slave=slave)
+ worker = BuildingWorker()
+ scanner = self.getScanner(worker=worker)
yield scanner.scan()
- self.assertEqual(['status', 'abort'], slave.call_log)
+ self.assertEqual(['status', 'abort'], worker.call_log)
@defer.inlineCallbacks
def test_scan_building_but_not_dirty_builder_explodes(self):
# Builders with a build assigned must be dirty for safety
# reasons. If we run into one that's clean, we blow up.
- slave = BuildingSlave()
+ worker = BuildingWorker()
builder = MockBuilder(clean_status=BuilderCleanStatus.CLEAN)
bq = FakeBuildQueue()
scanner = self.getScanner(
- slave=slave, builder_factory=MockBuilderFactory(builder, bq))
+ worker=worker, builder_factory=MockBuilderFactory(builder, bq))
with ExpectedException(
BuildDaemonIsolationError,
"Non-dirty builder allegedly building."):
yield scanner.scan()
- self.assertEqual([], slave.call_log)
+ self.assertEqual([], worker.call_log)
@defer.inlineCallbacks
- def test_scan_clean_but_not_idle_slave_explodes(self):
- # Clean builders by definition have slaves that are idle. If
- # an ostensibly clean slave isn't idle, blow up.
- slave = BuildingSlave()
+ def test_scan_clean_but_not_idle_worker_explodes(self):
+ # Clean builders by definition have workers that are idle. If
+ # an ostensibly clean worker isn't idle, blow up.
+ worker = BuildingWorker()
builder = MockBuilder(clean_status=BuilderCleanStatus.CLEAN)
scanner = self.getScanner(
- slave=slave, builder_factory=MockBuilderFactory(builder, None))
+ worker=worker, builder_factory=MockBuilderFactory(builder, None))
with ExpectedException(
BuildDaemonIsolationError,
r"Allegedly clean slave not idle \(%r instead\)" %
'BuilderStatus.BUILDING'):
yield scanner.scan()
- self.assertEqual(['status'], slave.call_log)
+ self.assertEqual(['status'], worker.call_log)
def test_getExpectedCookie_caches(self):
bq = FakeBuildQueue('trivial')
@@ -1143,54 +1143,54 @@ class TestCancellationChecking(TestCaseWithFactory):
def test_ignores_build_not_cancelling(self):
# If the active build is not in a CANCELLING state, ignore it.
- slave = BuildingSlave()
+ worker = BuildingWorker()
scanner = self._getScanner()
- yield scanner.checkCancellation(self.vitals, slave)
- self.assertEqual([], slave.call_log)
+ yield scanner.checkCancellation(self.vitals, worker)
+ self.assertEqual([], worker.call_log)
@defer.inlineCallbacks
def test_cancelling_build_is_aborted(self):
- # The first time we see a CANCELLING build, we abort the slave.
- slave = BuildingSlave()
+ # The first time we see a CANCELLING build, we abort the worker.
+ worker = BuildingWorker()
self.builder.current_build.cancel()
scanner = self._getScanner()
- yield scanner.checkCancellation(self.vitals, slave)
- self.assertEqual(["abort"], slave.call_log)
+ yield scanner.checkCancellation(self.vitals, worker)
+ self.assertEqual(["abort"], worker.call_log)
# A further scan is a no-op, as we remember that we've already
- # requested that the slave abort.
- yield scanner.checkCancellation(self.vitals, slave)
- self.assertEqual(["abort"], slave.call_log)
+ # requested that the worker abort.
+ yield scanner.checkCancellation(self.vitals, worker)
+ self.assertEqual(["abort"], worker.call_log)
@defer.inlineCallbacks
def test_timed_out_cancel_errors(self):
# If a BuildQueue is CANCELLING and the cancel timeout expires,
# an exception is raised so the normal scan error handler can
# finalise the build.
- slave = OkSlave()
+ worker = OkWorker()
build = self.builder.current_build
build.cancel()
clock = task.Clock()
scanner = self._getScanner(clock=clock)
- yield scanner.checkCancellation(self.vitals, slave)
- self.assertEqual(["abort"], slave.call_log)
+ yield scanner.checkCancellation(self.vitals, worker)
+ self.assertEqual(["abort"], worker.call_log)
self.assertEqual(BuildStatus.CANCELLING, build.status)
clock.advance(SlaveScanner.CANCEL_TIMEOUT)
with ExpectedException(
BuildSlaveFailure, "Timeout waiting for .* to cancel"):
- yield scanner.checkCancellation(self.vitals, slave)
+ yield scanner.checkCancellation(self.vitals, worker)
@defer.inlineCallbacks
def test_failed_abort_errors(self):
# If the builder reports a fault while attempting to abort it,
# an exception is raised so the build can be finalised.
- slave = LostBuildingBrokenSlave()
+ worker = LostBuildingBrokenWorker()
self.builder.current_build.cancel()
with ExpectedException(
xmlrpc.client.Fault, "<Fault 8002: %r>" % 'Could not abort'):
- yield self._getScanner().checkCancellation(self.vitals, slave)
+ yield self._getScanner().checkCancellation(self.vitals, worker)
class TestBuilddManager(TestCase):
@@ -1256,7 +1256,7 @@ class TestFailureAssessments(TestCaseWithFactory):
self.build = self.factory.makeSourcePackageRecipeBuild()
self.buildqueue = self.build.queueBuild()
self.buildqueue.markAsBuilding(self.builder)
- self.slave = OkSlave()
+ self.worker = OkWorker()
def _recover_failure(self, fail_notes, retry=True):
# Helper for recover_failure boilerplate.
diff --git a/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py b/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
index 92aa239..e0b5cca 100644
--- a/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
+++ b/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
@@ -50,10 +50,10 @@ from lp.buildmaster.tests.builderproxy import (
ProxyURLMatcher,
RevocationEndpointMatcher,
)
-from lp.buildmaster.tests.mock_slaves import (
+from lp.buildmaster.tests.mock_workers import (
MockBuilder,
- OkSlave,
- SlaveTestHelpers,
+ OkWorker,
+ WorkerTestHelpers,
)
from lp.buildmaster.tests.test_buildfarmjobbehaviour import (
TestGetUploadMethodsMixin,
@@ -137,7 +137,7 @@ class TestCharmRecipeBuildBehaviour(TestCharmRecipeBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
job.verifyBuildRequest(logger)
self.assertEqual("", logger.getLogBuffer())
@@ -150,7 +150,7 @@ class TestCharmRecipeBuildBehaviour(TestCharmRecipeBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder(virtualized=False)
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(AssertionError, job.verifyBuildRequest, logger)
self.assertEqual(
@@ -160,7 +160,7 @@ class TestCharmRecipeBuildBehaviour(TestCharmRecipeBuildBehaviourBase):
# verifyBuildRequest raises when the DAS has no chroot.
job = self.makeJob()
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(CannotBuild, job.verifyBuildRequest, logger)
self.assertIn("Missing chroot", str(e))
@@ -198,9 +198,9 @@ class TestAsyncCharmRecipeBuildBehaviour(
job = super().makeJob(**kwargs)
builder = MockBuilder()
builder.processor = job.build.processor
- slave = self.useFixture(SlaveTestHelpers()).getClientSlave()
- job.setBuilder(builder, slave)
- self.addCleanup(slave.pool.closeCachedConnections)
+ worker = self.useFixture(WorkerTestHelpers()).getClientWorker()
+ job.setBuilder(builder, worker)
+ self.addCleanup(worker.pool.closeCachedConnections)
return job
@defer.inlineCallbacks
@@ -424,8 +424,8 @@ class TestAsyncCharmRecipeBuildBehaviour(
job = self.makeJob()
builder = MockBuilder()
builder.processor = job.build.processor
- slave = OkSlave()
- job.setBuilder(builder, slave)
+ worker = OkWorker()
+ job.setBuilder(builder, worker)
chroot_lfa = self.factory.makeLibraryFileAlias(db_only=True)
job.build.distro_arch_series.addOrUpdateChroot(
chroot_lfa, image_type=BuildBaseImageType.CHROOT)
@@ -434,7 +434,7 @@ class TestAsyncCharmRecipeBuildBehaviour(
lxd_lfa, image_type=BuildBaseImageType.LXD)
yield job.dispatchBuildToSlave(DevNullLogger())
self.assertEqual(
- ("ensurepresent", lxd_lfa.http_url, "", ""), slave.call_log[0])
+ ("ensurepresent", lxd_lfa.http_url, "", ""), worker.call_log[0])
self.assertEqual(1, self.stats_client.incr.call_count)
self.assertEqual(
self.stats_client.incr.call_args_list[0][0],
@@ -447,14 +447,14 @@ class TestAsyncCharmRecipeBuildBehaviour(
job = self.makeJob()
builder = MockBuilder()
builder.processor = job.build.processor
- slave = OkSlave()
- job.setBuilder(builder, slave)
+ worker = OkWorker()
+ job.setBuilder(builder, worker)
chroot_lfa = self.factory.makeLibraryFileAlias(db_only=True)
job.build.distro_arch_series.addOrUpdateChroot(
chroot_lfa, image_type=BuildBaseImageType.CHROOT)
yield job.dispatchBuildToSlave(DevNullLogger())
self.assertEqual(
- ("ensurepresent", chroot_lfa.http_url, "", ""), slave.call_log[0])
+ ("ensurepresent", chroot_lfa.http_url, "", ""), worker.call_log[0])
class MakeCharmRecipeBuildMixin:
diff --git a/lib/lp/code/model/tests/test_recipebuilder.py b/lib/lp/code/model/tests/test_recipebuilder.py
index add7e6e..9077a08 100644
--- a/lib/lp/code/model/tests/test_recipebuilder.py
+++ b/lib/lp/code/model/tests/test_recipebuilder.py
@@ -23,10 +23,10 @@ from lp.buildmaster.interfaces.buildfarmjobbehaviour import (
IBuildFarmJobBehaviour,
)
from lp.buildmaster.interfaces.processor import IProcessorSet
-from lp.buildmaster.tests.mock_slaves import (
+from lp.buildmaster.tests.mock_workers import (
MockBuilder,
- OkSlave,
- WaitingSlave,
+ OkWorker,
+ WaitingWorker,
)
from lp.buildmaster.tests.test_buildfarmjobbehaviour import (
TestGetUploadMethodsMixin,
@@ -127,7 +127,7 @@ class TestRecipeBuilder(TestRecipeBuilderBase):
# valid builder set.
job = self.makeJob()
builder = MockBuilder("bob-de-bouwer")
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
job.verifyBuildRequest(logger)
self.assertEqual("", logger.getLogBuffer())
@@ -137,7 +137,7 @@ class TestRecipeBuilder(TestRecipeBuilderBase):
job = self.makeJob()
builder = MockBuilder('non-virtual builder')
builder.virtualized = False
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(AssertionError, job.verifyBuildRequest, logger)
self.assertEqual(
@@ -148,7 +148,7 @@ class TestRecipeBuilder(TestRecipeBuilderBase):
build = self.factory.makeSourcePackageRecipeBuild(
pocket=PackagePublishingPocket.SECURITY)
job = IBuildFarmJobBehaviour(build)
- job.setBuilder(MockBuilder("bob-de-bouwer"), OkSlave())
+ job.setBuilder(MockBuilder("bob-de-bouwer"), OkWorker())
e = self.assertRaises(
AssertionError, job.verifyBuildRequest, BufferLogger())
self.assertIn('invalid pocket due to the series status of', str(e))
@@ -413,9 +413,9 @@ class TestBuildNotifications(TestCaseWithFactory):
config.push('tmp_builddmaster_root', tmp_builddmaster_root)
self.addCleanup(config.pop, 'tmp_builddmaster_root')
self.queue_record.builder = self.factory.makeBuilder()
- slave = WaitingSlave('BuildStatus.OK')
+ worker = WaitingWorker('BuildStatus.OK')
return BuilderInteractor.getBuildBehaviour(
- self.queue_record, self.queue_record.builder, slave)
+ self.queue_record, self.queue_record.builder, worker)
def assertDeferredNotifyCount(self, status, behaviour, expected_count):
d = behaviour.handleStatus(self.queue_record, status, {'filemap': {}})
diff --git a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
index 0961a2b..ded5db8 100644
--- a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
+++ b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
@@ -61,11 +61,11 @@ from lp.buildmaster.tests.builderproxy import (
ProxyURLMatcher,
RevocationEndpointMatcher,
)
-from lp.buildmaster.tests.mock_slaves import (
+from lp.buildmaster.tests.mock_workers import (
MockBuilder,
- OkSlave,
- SlaveTestHelpers,
- WaitingSlave,
+ OkWorker,
+ WaitingWorker,
+ WorkerTestHelpers,
)
from lp.buildmaster.tests.test_buildfarmjobbehaviour import (
TestGetUploadMethodsMixin,
@@ -122,9 +122,9 @@ class MakeOCIBuildMixin:
job = IBuildFarmJobBehaviour(build)
builder = MockBuilder()
builder.processor = job.build.processor
- slave = self.useFixture(SlaveTestHelpers()).getClientSlave()
- job.setBuilder(builder, slave)
- self.addCleanup(slave.pool.closeCachedConnections)
+ worker = self.useFixture(WorkerTestHelpers()).getClientWorker()
+ job.setBuilder(builder, worker)
+ self.addCleanup(worker.pool.closeCachedConnections)
self.addCleanup(shut_down_default_process_pool)
# Taken from test_archivedependencies.py
@@ -591,8 +591,8 @@ class TestAsyncOCIRecipeBuildBehaviour(
job = self.makeJob(git_ref=ref, allow_internet=False)
builder = MockBuilder()
builder.processor = job.build.processor
- slave = OkSlave()
- job.setBuilder(builder, slave)
+ worker = OkWorker()
+ job.setBuilder(builder, worker)
chroot_lfa = self.factory.makeLibraryFileAlias(db_only=True)
job.build.distro_arch_series.addOrUpdateChroot(
chroot_lfa, image_type=BuildBaseImageType.CHROOT)
@@ -601,7 +601,7 @@ class TestAsyncOCIRecipeBuildBehaviour(
lxd_lfa, image_type=BuildBaseImageType.LXD)
yield job.dispatchBuildToSlave(DevNullLogger())
self.assertEqual(
- ('ensurepresent', lxd_lfa.http_url, '', ''), slave.call_log[0])
+ ('ensurepresent', lxd_lfa.http_url, '', ''), worker.call_log[0])
self.assertEqual(1, self.stats_client.incr.call_count)
self.assertEqual(
self.stats_client.incr.call_args_list[0][0],
@@ -616,14 +616,14 @@ class TestAsyncOCIRecipeBuildBehaviour(
job = self.makeJob(git_ref=ref, allow_internet=False)
builder = MockBuilder()
builder.processor = job.build.processor
- slave = OkSlave()
- job.setBuilder(builder, slave)
+ worker = OkWorker()
+ job.setBuilder(builder, worker)
chroot_lfa = self.factory.makeLibraryFileAlias(db_only=True)
job.build.distro_arch_series.addOrUpdateChroot(
chroot_lfa, image_type=BuildBaseImageType.CHROOT)
yield job.dispatchBuildToSlave(DevNullLogger())
self.assertEqual(
- ('ensurepresent', chroot_lfa.http_url, '', ''), slave.call_log[0])
+ ('ensurepresent', chroot_lfa.http_url, '', ''), worker.call_log[0])
@defer.inlineCallbacks
def test_dispatchBuildToSlave_oci_feature_flag_enabled(self):
@@ -646,8 +646,8 @@ class TestAsyncOCIRecipeBuildBehaviour(
job = self.makeJob(git_ref=ref, build=build)
builder = MockBuilder()
builder.processor = job.build.processor
- slave = OkSlave()
- job.setBuilder(builder, slave)
+ worker = OkWorker()
+ job.setBuilder(builder, worker)
chroot_lfa = self.factory.makeLibraryFileAlias(db_only=True)
job.build.distro_arch_series.addOrUpdateChroot(
@@ -659,11 +659,10 @@ class TestAsyncOCIRecipeBuildBehaviour(
self.assertEqual(distroseries.name,
job.build.distro_arch_series.distroseries.name)
self.assertEqual(
- ('ensurepresent', lxd_lfa.http_url, '', ''), slave.call_log[0])
- # grab the build method log from the OKMockSlave
- # and check inside the arguments dict that we build
- # for Distro series
- self.assertEqual(distroseries.name, slave.call_log[1][5]['series'])
+ ('ensurepresent', lxd_lfa.http_url, '', ''), worker.call_log[0])
+ # grab the build method log from the OKWorker and check inside the
+ # arguments dict that we build for distro series
+ self.assertEqual(distroseries.name, worker.call_log[1][5]['series'])
@defer.inlineCallbacks
def test_extraBuildArgs_disallow_internet(self):
@@ -693,7 +692,7 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin,
path = os.path.join(self.test_files_dir, name)
with open(path, 'wb') as fp:
fp.write(six.ensure_binary(content))
- self.slave.valid_files[hash] = path
+ self.worker.valid_files[hash] = path
def setUp(self):
super().setUp()
@@ -701,14 +700,14 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin,
self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'}))
self.build = self.makeBuild()
# For the moment, we require a builder for the build so that
- # handleStatus_OK can get a reference to the slave.
+ # handleStatus_OK can get a reference to the worker.
self.builder = self.factory.makeBuilder()
self.build.buildqueue_record.markAsBuilding(self.builder)
- self.slave = WaitingSlave('BuildStatus.OK')
- self.slave.valid_files['test_file_hash'] = ''
+ self.worker = WaitingWorker('BuildStatus.OK')
+ self.worker.valid_files['test_file_hash'] = ''
self.interactor = BuilderInteractor()
self.behaviour = self.interactor.getBuildBehaviour(
- self.build.buildqueue_record, self.builder, self.slave)
+ self.build.buildqueue_record, self.builder, self.worker)
self.addCleanup(shut_down_default_process_pool)
# We overwrite the buildmaster root to use a temp directory.
@@ -786,9 +785,9 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin,
self.assertEqual(
['buildlog', 'manifest_hash', 'digests_hash', 'config_1_hash',
'layer_2_hash'],
- self.slave._got_file_record)
+ self.worker._got_file_record)
# This hash should not appear as it is already in the librarian
- self.assertNotIn('layer_1_hash', self.slave._got_file_record)
+ self.assertNotIn('layer_1_hash', self.worker._got_file_record)
self.assertEqual(BuildStatus.UPLOADING, self.build.status)
self.assertResultCount(1, "incoming")
@@ -825,10 +824,10 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin,
{'filemap': self.filemap})
self.assertEqual(
['buildlog', 'manifest_hash', 'digests_hash', 'config_1_hash'],
- self.slave._got_file_record)
+ self.worker._got_file_record)
# This hash should not appear as it is already in the librarian
- self.assertNotIn('layer_1_hash', self.slave._got_file_record)
- self.assertNotIn('layer_2_hash', self.slave._got_file_record)
+ self.assertNotIn('layer_1_hash', self.worker._got_file_record)
+ self.assertNotIn('layer_2_hash', self.worker._got_file_record)
# layer_2 should have been retrieved from the librarian
layer_2_path = os.path.join(
@@ -909,7 +908,7 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin,
def test_handleStatus_ABORTED_illegal_when_building(self):
self.builder.vm_host = "fake_vm_host"
self.behaviour = self.interactor.getBuildBehaviour(
- self.build.buildqueue_record, self.builder, self.slave)
+ self.build.buildqueue_record, self.builder, self.worker)
with dbuser(config.builddmaster.dbuser):
self.build.updateStatus(BuildStatus.BUILDING)
with ExpectedException(
diff --git a/lib/lp/services/statsd/tests/test_numbercruncher.py b/lib/lp/services/statsd/tests/test_numbercruncher.py
index 0885072..4fb881f 100644
--- a/lib/lp/services/statsd/tests/test_numbercruncher.py
+++ b/lib/lp/services/statsd/tests/test_numbercruncher.py
@@ -27,7 +27,7 @@ from lp.buildmaster.interactor import BuilderSlave
from lp.buildmaster.interfaces.builder import IBuilderSet
from lp.buildmaster.interfaces.processor import IProcessorSet
from lp.buildmaster.model.buildqueue import BuildQueue
-from lp.buildmaster.tests.mock_slaves import OkSlave
+from lp.buildmaster.tests.mock_workers import OkWorker
from lp.code.enums import CodeImportJobState
from lp.services.database.isolation import is_transaction_in_progress
from lp.services.database.policy import DatabaseBlockedPolicy
@@ -56,7 +56,7 @@ class TestNumberCruncher(StatsMixin, TestCaseWithFactory):
def test_single_processor_counts(self):
builder = self.factory.makeBuilder()
builder.setCleanStatus(BuilderCleanStatus.CLEAN)
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkSlave()))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkWorker()))
transaction.commit()
clock = task.Clock()
manager = NumberCruncher(clock=clock)
@@ -89,7 +89,7 @@ class TestNumberCruncher(StatsMixin, TestCaseWithFactory):
)]
for builder in builders:
builder.setCleanStatus(BuilderCleanStatus.CLEAN)
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkSlave()))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkWorker()))
transaction.commit()
clock = task.Clock()
manager = NumberCruncher(clock=clock)
@@ -141,7 +141,7 @@ class TestNumberCruncher(StatsMixin, TestCaseWithFactory):
build.queueBuild()
build.buildqueue_record.markAsBuilding(builder=building_builder)
builds.append(build)
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkSlave()))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkWorker()))
transaction.commit()
clock = task.Clock()
manager = NumberCruncher(clock=clock)
@@ -201,7 +201,7 @@ class TestNumberCruncher(StatsMixin, TestCaseWithFactory):
builder.setCleanStatus(BuilderCleanStatus.CLEANING)
build = self.factory.makeSnapBuild()
build.queueBuild()
- self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkSlave()))
+ self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(OkWorker()))
transaction.commit()
clock = task.Clock()
manager = NumberCruncher(clock=clock)
diff --git a/lib/lp/snappy/tests/test_snapbuildbehaviour.py b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
index fc2d5a8..14cd8e5 100644
--- a/lib/lp/snappy/tests/test_snapbuildbehaviour.py
+++ b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
@@ -55,10 +55,10 @@ from lp.buildmaster.tests.builderproxy import (
ProxyURLMatcher,
RevocationEndpointMatcher,
)
-from lp.buildmaster.tests.mock_slaves import (
+from lp.buildmaster.tests.mock_workers import (
MockBuilder,
- OkSlave,
- SlaveTestHelpers,
+ OkWorker,
+ WorkerTestHelpers,
)
from lp.buildmaster.tests.test_buildfarmjobbehaviour import (
TestGetUploadMethodsMixin,
@@ -174,7 +174,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
job.verifyBuildRequest(logger)
self.assertEqual("", logger.getLogBuffer())
@@ -187,7 +187,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder(virtualized=False)
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(AssertionError, job.verifyBuildRequest, logger)
self.assertEqual(
@@ -201,7 +201,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(ArchiveDisabled, job.verifyBuildRequest, logger)
self.assertEqual("Disabled Archive is disabled.", str(e))
@@ -214,7 +214,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
job.verifyBuildRequest(logger)
self.assertEqual("", logger.getLogBuffer())
@@ -226,7 +226,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(
SnapBuildArchiveOwnerMismatch, job.verifyBuildRequest, logger)
@@ -239,7 +239,7 @@ class TestSnapBuildBehaviour(TestSnapBuildBehaviourBase):
# verifyBuildRequest raises when the DAS has no chroot.
job = self.makeJob()
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(CannotBuild, job.verifyBuildRequest, logger)
self.assertIn("Missing chroot", str(e))
@@ -271,14 +271,14 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
self.setUpStats()
def makeJob(self, **kwargs):
- # We need a builder slave in these tests, in order that requesting a
- # proxy token can piggyback on its reactor and pool.
+ # We need a builder worker in these tests, in order that requesting
+ # a proxy token can piggyback on its reactor and pool.
job = super().makeJob(**kwargs)
builder = MockBuilder()
builder.processor = job.build.processor
- slave = self.useFixture(SlaveTestHelpers()).getClientSlave()
- job.setBuilder(builder, slave)
- self.addCleanup(slave.pool.closeCachedConnections)
+ worker = self.useFixture(WorkerTestHelpers()).getClientWorker()
+ job.setBuilder(builder, worker)
+ self.addCleanup(worker.pool.closeCachedConnections)
return job
@defer.inlineCallbacks
@@ -971,8 +971,8 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
job = self.makeJob(allow_internet=False)
builder = MockBuilder()
builder.processor = job.build.processor
- slave = OkSlave()
- job.setBuilder(builder, slave)
+ worker = OkWorker()
+ job.setBuilder(builder, worker)
chroot_lfa = self.factory.makeLibraryFileAlias(db_only=True)
job.build.distro_arch_series.addOrUpdateChroot(
chroot_lfa, image_type=BuildBaseImageType.CHROOT)
@@ -981,7 +981,7 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
lxd_lfa, image_type=BuildBaseImageType.LXD)
yield job.dispatchBuildToSlave(DevNullLogger())
self.assertEqual(
- ('ensurepresent', lxd_lfa.http_url, '', ''), slave.call_log[0])
+ ('ensurepresent', lxd_lfa.http_url, '', ''), worker.call_log[0])
self.assertEqual(1, self.stats_client.incr.call_count)
self.assertEqual(
self.stats_client.incr.call_args_list[0][0],
@@ -993,14 +993,14 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
job = self.makeJob(allow_internet=False)
builder = MockBuilder()
builder.processor = job.build.processor
- slave = OkSlave()
- job.setBuilder(builder, slave)
+ worker = OkWorker()
+ job.setBuilder(builder, worker)
chroot_lfa = self.factory.makeLibraryFileAlias(db_only=True)
job.build.distro_arch_series.addOrUpdateChroot(
chroot_lfa, image_type=BuildBaseImageType.CHROOT)
yield job.dispatchBuildToSlave(DevNullLogger())
self.assertEqual(
- ('ensurepresent', chroot_lfa.http_url, '', ''), slave.call_log[0])
+ ('ensurepresent', chroot_lfa.http_url, '', ''), worker.call_log[0])
class MakeSnapBuildMixin:
diff --git a/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py b/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
index 4f06427..1f89c74 100644
--- a/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
+++ b/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
@@ -39,11 +39,11 @@ from lp.buildmaster.interfaces.buildfarmjobbehaviour import (
IBuildFarmJobBehaviour,
)
from lp.buildmaster.manager import BuilddManager
-from lp.buildmaster.tests.mock_slaves import (
- AbortingSlave,
- BuildingSlave,
- OkSlave,
- WaitingSlave,
+from lp.buildmaster.tests.mock_workers import (
+ AbortingWorker,
+ BuildingWorker,
+ OkWorker,
+ WaitingWorker,
)
from lp.buildmaster.tests.test_buildfarmjobbehaviour import (
TestGetUploadMethodsMixin,
@@ -177,7 +177,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
# purpose is "PRIMARY" because this ensures that the package mangling
# tools will run over the built packages.
archive = self.factory.makeArchive(virtualized=False)
- slave = OkSlave()
+ worker = OkWorker()
builder = self.factory.makeBuilder(virtualized=False)
builder.setCleanStatus(BuilderCleanStatus.CLEAN)
vitals = extract_vitals_from_db(builder)
@@ -189,11 +189,11 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
bq = build.queueBuild()
bq.markAsBuilding(builder)
interactor = BuilderInteractor()
- behaviour = interactor.getBuildBehaviour(bq, builder, slave)
+ behaviour = interactor.getBuildBehaviour(bq, builder, worker)
yield interactor._startBuild(
- bq, vitals, builder, slave, behaviour, BufferLogger())
+ bq, vitals, builder, worker, behaviour, BufferLogger())
yield self.assertExpectedInteraction(
- slave.call_log, builder, build, behaviour, lf, archive,
+ worker.call_log, builder, build, behaviour, lf, archive,
ArchivePurpose.PRIMARY, 'universe')
self.assertEqual(1, self.stats_client.incr.call_count)
self.assertEqual(
@@ -207,7 +207,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
# If there is a primary component override, it is honoured for
# non-virtual PPA builds too.
archive = self.factory.makeArchive(virtualized=False)
- slave = OkSlave()
+ worker = OkWorker()
builder = self.factory.makeBuilder(virtualized=False)
builder.setCleanStatus(BuilderCleanStatus.CLEAN)
vitals = extract_vitals_from_db(builder)
@@ -224,17 +224,17 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
bq = build.queueBuild()
bq.markAsBuilding(builder)
interactor = BuilderInteractor()
- behaviour = interactor.getBuildBehaviour(bq, builder, slave)
+ behaviour = interactor.getBuildBehaviour(bq, builder, worker)
yield interactor._startBuild(
- bq, vitals, builder, slave, behaviour, BufferLogger())
+ bq, vitals, builder, worker, behaviour, BufferLogger())
yield self.assertExpectedInteraction(
- slave.call_log, builder, build, behaviour, lf, archive,
+ worker.call_log, builder, build, behaviour, lf, archive,
ArchivePurpose.PRIMARY, 'main')
@defer.inlineCallbacks
def test_virtual_ppa_dispatch(self):
archive = self.factory.makeArchive(virtualized=True)
- slave = OkSlave()
+ worker = OkWorker()
builder = self.factory.makeBuilder(
virtualized=True, vm_host="foohost")
builder.setCleanStatus(BuilderCleanStatus.CLEAN)
@@ -247,11 +247,11 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
bq = build.queueBuild()
bq.markAsBuilding(builder)
interactor = BuilderInteractor()
- behaviour = interactor.getBuildBehaviour(bq, builder, slave)
+ behaviour = interactor.getBuildBehaviour(bq, builder, worker)
yield interactor._startBuild(
- bq, vitals, builder, slave, behaviour, BufferLogger())
+ bq, vitals, builder, worker, behaviour, BufferLogger())
yield self.assertExpectedInteraction(
- slave.call_log, builder, build, behaviour, lf, archive,
+ worker.call_log, builder, build, behaviour, lf, archive,
ArchivePurpose.PPA)
self.assertEqual(1, self.stats_client.incr.call_count)
self.assertEqual(
@@ -266,7 +266,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
self.pushConfig(
"launchpad", internal_macaroon_secret_key="some-secret")
archive = self.factory.makeArchive(private=True)
- slave = OkSlave()
+ worker = OkWorker()
builder = self.factory.makeBuilder()
builder.setCleanStatus(BuilderCleanStatus.CLEAN)
vitals = extract_vitals_from_db(builder)
@@ -288,11 +288,11 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
bq = build.queueBuild()
bq.markAsBuilding(builder)
interactor = BuilderInteractor()
- behaviour = interactor.getBuildBehaviour(bq, builder, slave)
+ behaviour = interactor.getBuildBehaviour(bq, builder, worker)
yield interactor._startBuild(
- bq, vitals, builder, slave, behaviour, BufferLogger())
+ bq, vitals, builder, worker, behaviour, BufferLogger())
yield self.assertExpectedInteraction(
- slave.call_log, builder, build, behaviour, lf, archive,
+ worker.call_log, builder, build, behaviour, lf, archive,
ArchivePurpose.PPA,
extra_uploads=[
(Equals(sprf_url),
@@ -304,7 +304,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
def test_partner_dispatch_no_publishing_history(self):
archive = self.factory.makeArchive(
virtualized=False, purpose=ArchivePurpose.PARTNER)
- slave = OkSlave()
+ worker = OkWorker()
builder = self.factory.makeBuilder(virtualized=False)
builder.setCleanStatus(BuilderCleanStatus.CLEAN)
vitals = extract_vitals_from_db(builder)
@@ -316,11 +316,11 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
bq = build.queueBuild()
bq.markAsBuilding(builder)
interactor = BuilderInteractor()
- behaviour = interactor.getBuildBehaviour(bq, builder, slave)
+ behaviour = interactor.getBuildBehaviour(bq, builder, worker)
yield interactor._startBuild(
- bq, vitals, builder, slave, behaviour, BufferLogger())
+ bq, vitals, builder, worker, behaviour, BufferLogger())
yield self.assertExpectedInteraction(
- slave.call_log, builder, build, behaviour, lf, archive,
+ worker.call_log, builder, build, behaviour, lf, archive,
ArchivePurpose.PARTNER)
def test_dont_dispatch_release_builds(self):
@@ -515,7 +515,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
class TestBinaryBuildPackageBehaviourBuildCollection(TestCaseWithFactory):
"""Tests for the BinaryPackageBuildBehaviour.
- Using various mock slaves, we check how updateBuild() behaves in
+ Using various mock workers, we check how updateBuild() behaves in
various scenarios.
"""
@@ -576,7 +576,7 @@ class TestBinaryBuildPackageBehaviourBuildCollection(TestCaseWithFactory):
self.assertEqual(BuildStatus.FAILEDTOBUILD, self.build.status)
d = self.updateBuild(
- self.candidate, WaitingSlave('BuildStatus.PACKAGEFAIL'))
+ self.candidate, WaitingWorker('BuildStatus.PACKAGEFAIL'))
return d.addCallback(got_update)
def test_depwait_collection(self):
@@ -589,7 +589,7 @@ class TestBinaryBuildPackageBehaviourBuildCollection(TestCaseWithFactory):
self.assertEqual(DEPENDENCIES, self.build.dependencies)
d = self.updateBuild(
- self.candidate, WaitingSlave('BuildStatus.DEPFAIL', DEPENDENCIES))
+ self.candidate, WaitingWorker('BuildStatus.DEPFAIL', DEPENDENCIES))
return d.addCallback(got_update)
def test_chrootfail_collection(self):
@@ -599,16 +599,16 @@ class TestBinaryBuildPackageBehaviourBuildCollection(TestCaseWithFactory):
self.assertEqual(BuildStatus.CHROOTWAIT, self.build.status)
d = self.updateBuild(
- self.candidate, WaitingSlave('BuildStatus.CHROOTFAIL'))
+ self.candidate, WaitingWorker('BuildStatus.CHROOTFAIL'))
return d.addCallback(got_update)
def test_building_collection(self):
# The builder is still building the package.
def got_update(ignored):
- # The fake log is returned from the BuildingSlave() mock.
+ # The fake log is returned from the BuildingWorker() mock.
self.assertEqual("This is a build log: 0", self.candidate.logtail)
- d = self.updateBuild(self.candidate, BuildingSlave())
+ d = self.updateBuild(self.candidate, BuildingWorker())
return d.addCallback(got_update)
def test_aborting_collection(self):
@@ -618,7 +618,7 @@ class TestBinaryBuildPackageBehaviourBuildCollection(TestCaseWithFactory):
"Waiting for slave process to be terminated",
self.candidate.logtail)
- d = self.updateBuild(self.candidate, AbortingSlave())
+ d = self.updateBuild(self.candidate, AbortingWorker())
return d.addCallback(got_update)
def test_collection_for_deleted_source(self):
@@ -633,7 +633,7 @@ class TestBinaryBuildPackageBehaviourBuildCollection(TestCaseWithFactory):
self.assertEqual(
BuildStatus.SUPERSEDED, self.build.status)
- d = self.updateBuild(self.candidate, WaitingSlave('BuildStatus.OK'))
+ d = self.updateBuild(self.candidate, WaitingWorker('BuildStatus.OK'))
return d.addCallback(got_update)
def test_uploading_collection(self):
@@ -644,14 +644,14 @@ class TestBinaryBuildPackageBehaviourBuildCollection(TestCaseWithFactory):
# upload processing succeeded.
self.assertIs(None, self.build.upload_log)
- d = self.updateBuild(self.candidate, WaitingSlave('BuildStatus.OK'))
+ d = self.updateBuild(self.candidate, WaitingWorker('BuildStatus.OK'))
return d.addCallback(got_update)
def test_log_file_collection(self):
self.build.updateStatus(BuildStatus.FULLYBUILT)
old_tmps = sorted(os.listdir('/tmp'))
- slave = WaitingSlave('BuildStatus.OK')
+ worker = WaitingWorker('BuildStatus.OK')
def got_log(logfile_lfa_id):
# Grabbing logs should not leave new files in /tmp (bug #172798)
@@ -681,18 +681,18 @@ class TestBinaryBuildPackageBehaviourBuildCollection(TestCaseWithFactory):
fd, tmp_orig_file_name = tempfile.mkstemp()
self.addCleanup(os.remove, tmp_orig_file_name)
- # Check that the original file from the slave matches the
+ # Check that the original file from the worker matches the
# uncompressed file in the librarian.
def got_orig_log(ignored):
orig_file_content = open(tmp_orig_file_name, 'rb').read()
self.assertEqual(orig_file_content, uncompressed_file)
- d = removeSecurityProxy(slave).getFile(
+ d = removeSecurityProxy(worker).getFile(
'buildlog', tmp_orig_file_name)
return d.addCallback(got_orig_log)
behaviour = IBuildFarmJobBehaviour(self.build)
- behaviour.setBuilder(self.builder, slave)
+ behaviour.setBuilder(self.builder, worker)
d = behaviour.getLogFromSlave(self.build.buildqueue_record)
return d.addCallback(got_log)
@@ -713,7 +713,7 @@ class TestBinaryBuildPackageBehaviourBuildCollection(TestCaseWithFactory):
self.layer.txn.commit()
self.assertTrue(self.build.log.restricted)
- d = self.updateBuild(self.candidate, WaitingSlave('BuildStatus.OK'))
+ d = self.updateBuild(self.candidate, WaitingWorker('BuildStatus.OK'))
return d.addCallback(got_update)
diff --git a/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py b/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
index 0c39013..4ca994c 100644
--- a/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
+++ b/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
@@ -26,9 +26,9 @@ from lp.buildmaster.interfaces.buildfarmjobbehaviour import (
IBuildFarmJobBehaviour,
)
from lp.buildmaster.interfaces.processor import IProcessorSet
-from lp.buildmaster.tests.mock_slaves import (
+from lp.buildmaster.tests.mock_workers import (
MockBuilder,
- OkSlave,
+ OkWorker,
)
from lp.buildmaster.tests.test_buildfarmjobbehaviour import (
TestGetUploadMethodsMixin,
@@ -113,7 +113,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
job.verifyBuildRequest(logger)
self.assertEqual("", logger.getLogBuffer())
@@ -126,7 +126,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder(virtualized=False)
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(AssertionError, job.verifyBuildRequest, logger)
self.assertEqual(
@@ -140,7 +140,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(ArchiveDisabled, job.verifyBuildRequest, logger)
self.assertEqual("Disabled Archive is disabled.", str(e))
@@ -153,7 +153,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
job.verifyBuildRequest(logger)
self.assertEqual("", logger.getLogBuffer())
@@ -165,7 +165,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
transaction.commit()
job.build.distro_arch_series.addOrUpdateChroot(lfa)
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(
LiveFSBuildArchiveOwnerMismatch, job.verifyBuildRequest, logger)
@@ -178,7 +178,7 @@ class TestLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
# verifyBuildRequest raises when the DAS has no chroot.
job = self.makeJob()
builder = MockBuilder()
- job.setBuilder(builder, OkSlave())
+ job.setBuilder(builder, OkWorker())
logger = BufferLogger()
e = self.assertRaises(CannotBuild, job.verifyBuildRequest, logger)
self.assertIn("Missing chroot", str(e))
@@ -281,8 +281,8 @@ class TestAsyncLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
job = self.makeJob()
builder = MockBuilder()
builder.processor = job.build.processor
- slave = OkSlave()
- job.setBuilder(builder, slave)
+ worker = OkWorker()
+ job.setBuilder(builder, worker)
chroot_lfa = self.factory.makeLibraryFileAlias(db_only=True)
job.build.distro_arch_series.addOrUpdateChroot(
chroot_lfa, image_type=BuildBaseImageType.CHROOT)
@@ -291,21 +291,21 @@ class TestAsyncLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
lxd_lfa, image_type=BuildBaseImageType.LXD)
yield job.dispatchBuildToSlave(DevNullLogger())
self.assertEqual(
- ('ensurepresent', lxd_lfa.http_url, '', ''), slave.call_log[0])
+ ('ensurepresent', lxd_lfa.http_url, '', ''), worker.call_log[0])
@defer.inlineCallbacks
def test_dispatchBuildToSlave_falls_back_to_chroot(self):
job = self.makeJob()
builder = MockBuilder()
builder.processor = job.build.processor
- slave = OkSlave()
- job.setBuilder(builder, slave)
+ worker = OkWorker()
+ job.setBuilder(builder, worker)
chroot_lfa = self.factory.makeLibraryFileAlias(db_only=True)
job.build.distro_arch_series.addOrUpdateChroot(
chroot_lfa, image_type=BuildBaseImageType.CHROOT)
yield job.dispatchBuildToSlave(DevNullLogger())
self.assertEqual(
- ('ensurepresent', chroot_lfa.http_url, '', ''), slave.call_log[0])
+ ('ensurepresent', chroot_lfa.http_url, '', ''), worker.call_log[0])
class MakeLiveFSBuildMixin:
diff --git a/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py b/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py
index 5bfd56d..fc1a712 100644
--- a/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py
+++ b/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py
@@ -18,9 +18,9 @@ from lp.buildmaster.interactor import BuilderInteractor
from lp.buildmaster.interfaces.buildfarmjobbehaviour import (
IBuildFarmJobBehaviour,
)
-from lp.buildmaster.tests.mock_slaves import (
- SlaveTestHelpers,
- WaitingSlave,
+from lp.buildmaster.tests.mock_workers import (
+ WaitingWorker,
+ WorkerTestHelpers,
)
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.services.config import config
@@ -59,13 +59,13 @@ class MakeBehaviourMixin(object):
def makeBehaviour(self, branch=None, use_fake_chroot=True, **kwargs):
"""Create a TranslationTemplatesBuildBehaviour.
- Anything that might communicate with build slaves and such
+ Anything that might communicate with build workers and such
(which we can't really do here) is mocked up.
"""
build = self.factory.makeTranslationTemplatesBuild(branch=branch)
behaviour = IBuildFarmJobBehaviour(build)
- slave = WaitingSlave(**kwargs)
- behaviour.setBuilder(self.factory.makeBuilder(), slave)
+ worker = WaitingWorker(**kwargs)
+ behaviour.setBuilder(self.factory.makeBuilder(), worker)
if use_fake_chroot:
behaviour.distro_arch_series.addOrUpdateChroot(
self.factory.makeLibraryFileAlias(db_only=True))
@@ -91,7 +91,7 @@ class TestTranslationTemplatesBuildBehaviour(
def setUp(self):
super(TestTranslationTemplatesBuildBehaviour, self).setUp()
- self.slave_helper = self.useFixture(SlaveTestHelpers())
+ self.worker_helper = self.useFixture(WorkerTestHelpers())
def test_getLogFileName(self):
# Each job has a unique log file name.