def setUp(self): if not configurations: self.loadConfigurationFilesToMemory() self.fakeFilesystem = enableMockedFilesystem(dynamicconfig) self._createFakeFilesystem() mockNetworkConf = {'NODES_SUBNET_PREFIX_LENGTH': 22, 'ALLOW_CLEARING_OF_DISK': False, 'OSMOSIS_SERVER_IP': '10.0.0.26', 'PUBLIC_NAT_IP': '192.168.1.2', 'GATEWAY_IP': '192.168.1.2', 'FIRST_IP': '192.168.1.11', 'BOOTSERVER_IP': '192.168.1.1', 'PUBLIC_INTERFACE': '00:1e:67:44:13:a1'} self.dnsMasqMock = FakeDNSMasq() self.expectedDNSMasq = FakeDNSMasq() self._loadAddresses(firstIP=mockNetworkConf["FIRST_IP"], prefixLength=int(mockNetworkConf["NODES_SUBNET_PREFIX_LENGTH"])) self.inaguratorMock = mock.Mock(spec=inaugurate.Inaugurate) self.tftpMock = mock.Mock(spec=tftpboot.TFTPBoot) self.allocationsMock = Allocations() self.reclaimHost = mock.Mock(spec=reclaimhost.ReclaimHost) timer.cancelAllByTag = mock.Mock() timer.scheduleAt = mock.Mock() timer.scheduleIn = mock.Mock() self._hosts = hosts.Hosts() self.expectedAddresses = dict() self.freePoolMock = FreePool(self._hosts) hoststatemachine.HostStateMachine = HostStateMachine network.initialize_globals(mockNetworkConf)
def setUp(self, moduleInWhichToSetupMocks): super(EpollEventLoopTestCase, self).setUp() self._moduleInWhichToSetupMocks = moduleInWhichToSetupMocks self._fakeFilesystem = mockfilesystem.enableMockedFilesystem(self._moduleInWhichToSetupMocks, createfifos) self._pipeMethodsMock = mockpipes.enable([self._moduleInWhichToSetupMocks, createfifos], self._fakeFilesystem) self._moduleInWhichToSetupMocks.select.epoll = self._selectEpollWrapper self._poller = None self._origPollerPoll = None
def setUp(self): self.fakeFilesystem = enableMockedFilesystem(rackattack.common.dnsmasq) self.fakeFilesystem.CreateDirectory("/tmp") self.fakeFilesystem.CreateFile(DNSMasq.LEASES_FILE, create_missing_dirs=True) subprocess.Popen = mock.MagicMock(spec=subprocess.Popen) self.tftpBootMock = mock.Mock(tftpboot.TFTPBoot) DNSMasq.run = lambda x: None self.tested = DNSMasq(self.tftpBootMock, '10.0.0.1', '255.255.255.0', '10.0.0.2', '10.0.0.10', gateway='10.0.0.20', nameserver='8.8.8.8', interface='eth0') self.tested._popen.pid = 12345